-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
44 lines (42 loc) · 866 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* File: main.cpp
* Author: dave
*
* Created on 09 February 2014, 12:55
*/
#include <fcgiapp.h>
//#include <fcgi_stdio.h>
//#include <fastcgi++/manager.hpp>
//#include "include/Listener.h"
#include <exception>
#include <iostream>
int main()
{
try
{
int fd = FCGX_OpenSocket(":7000", 500);
FCGX_Init();
FCGX_Request request;
FCGX_InitRequest(&request, fd, 0);
// FCGX_Stream* in;
// FCGX_Stream* out;
// FCGX_Stream* err;
// FCGX_ParamArray params;
// int resp = FCGX_Accept(&in, &out, &err, ¶ms);
while (FCGX_Accept_r(&request) >= 0)
{
FCGX_PutS("Content-type: text/html\r\n"
"\r\n"
"<title>It worked</title>"
"<h1>Finally!</h1>\n", request.out);
}
// Fastcgipp::Manager<Listener> fcgi(fd);
// fcgi.handler();
}
catch(std::exception& e)
{
std::cerr << e.what() << std::endl;
return -1;
}
return 0;
}