00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <exception>
00025 #include <iostream>
00026
00027 #include <unistd.h>
00028
00029 #include "cgicc/Cgicc.h"
00030 #include "cgicc/HTTPHTMLHeader.h"
00031 #include "cgicc/HTMLClasses.h"
00032
00033 #include "FCgiIO.h"
00034
00035 using namespace std;
00036 using namespace cgicc;
00037
00038 int
00039 main(int ,
00040 const char **,
00041 char **)
00042 {
00043 unsigned count = 0;
00044
00045 FCGX_Request request;
00046
00047 FCGX_Init();
00048 FCGX_InitRequest(&request, 0, 0);
00049
00050 while(FCGX_Accept_r(&request) == 0) {
00051
00052 try {
00053 FCgiIO IO(request);
00054 Cgicc CGI(&IO);
00055
00056
00057 IO << HTTPHTMLHeader() << HTMLDoctype( HTMLDoctype::eStrict ) << endl
00058 << html().set( "lang", "en" ).set( "dir", "ltr" ) << endl;
00059
00060
00061 IO << head() << endl
00062 << title() << "GNU cgicc v" << CGI.getVersion() << title() << endl
00063 << head() << endl;
00064
00065
00066 IO << body() << endl;
00067
00068
00069 IO << h1("Cgicc/FastCGI Test") << endl
00070 << "PID: " << getpid() << br() << endl
00071 << "count: " << count++ << br() << endl;
00072
00073 IO << "Form Elements:" << br() << endl;
00074
00075 for(const_form_iterator i = CGI.getElements().begin();
00076 i != CGI.getElements().end(); ++i )
00077 IO << i->getName() << " = " << i->getValue() << br() << endl;
00078
00079
00080 IO << body() << html();
00081 }
00082 catch(const exception&) {
00083
00084 }
00085
00086 FCGX_Finish_r(&request);
00087 }
00088
00089 return 0;
00090 }