newbie question, help heeded
Eduard Bareev <[email protected]> Mon, 10 Aug 2009 18:23:58 +0400
| Newsgroups | gmane.comp.gcc.cgicc.general |
|---|---|
| Message-ID | <[email protected]> |
--===============0422295060==
Content-Type: multipart/alternative; boundary=001636c5a3982acb800470ca562b
--001636c5a3982acb800470ca562b
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hi!
I trying to develop highspeed web-service and i have some questions, and
also i am not c++ programmer, this is my first cpp project.
I have this following code:
-------------------------------------------
#include <string>
#include "fcgi_stdio.h"
#include <stdlib.h>
#include <iostream>
void handle(FCGX_Request request){
FCGX_FPrintF(request.out, "Content-type:
text/html\r\n\r\n<TITLE>fastcgi</TITLE>\n<H1>Fastcgi: Hello world!</H1>\n");
}
int main(int argc, char* const argv[] )
{
std::string port=":9001";
int listenQueueBacklog = 400;
FCGX_Stream *in, *out, *err;
FCGX_ParamArray envp;
if(FCGX_Init()) exit(1);
int listen_socket = FCGX_OpenSocket(port.c_str(), listenQueueBacklog);
if(listen_socket < 0) exit(1);
FCGX_Request request;
if(FCGX_InitRequest(&request, listen_socket, 0)) exit(1);
int reqCounter = 0;
while(FCGX_Accept_r(&request) == 0)
{
handle(request);
reqCounter++;
FCGX_FPrintF(request.out, "\n\r\n\r counter: %d", reqCounter);
FCGX_Finish_r(&request);
}
return 0;
}
-------------------------------------------
It works good listening 9001 port and serving resquests from nginx http
server. I choose fcgi_stdio beacuse it can listen on tcp socket and it is
simple to integrate it with nginx web server.
Question:
Can i use this configuration and include GNU Cgicc Library to access post
field values, headers, cookie?
Anyone, please point to an example of using this both libraries in my case!
Thanks!
--
Eduard Bareev
[email protected]
--001636c5a3982acb800470ca562b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi!<br>I trying to develop highspeed web-service and i have some questions,=
and also i am not c++ programmer, this is my first cpp project.<br><br>I h=
ave this following code:<br>-------------------------------------------<br>
#include <string><br>#include "fcgi_stdio.h"<br>#include &l=
t;stdlib.h><br>#include <iostream><br><br>void handle(FCGX_Request=
request){<br>=A0=A0=A0=A0=A0=A0=A0 FCGX_FPrintF(request.out, "Content=
-type: text/html\r\n\r\n<TITLE>fastcgi</TITLE>\n<H1>Fastc=
gi: Hello world!</H1>\n");<br>
}<br><br>int main(int argc, char* const argv[] )<br>{<br>=A0=A0=A0 std::str=
ing port=3D":9001";=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0 int listen=
QueueBacklog =3D 400;=A0=A0=A0 <br>=A0=A0=A0 FCGX_Stream *in, *out, *err;<b=
r>=A0=A0=A0 FCGX_ParamArray envp;<br>=A0=A0=A0 <br>
=A0=A0=A0 if(FCGX_Init())=A0=A0=A0 exit(1); <br><br>=A0=A0=A0 int listen_so=
cket =3D FCGX_OpenSocket(port.c_str(), listenQueueBacklog); <br>=A0=A0=A0 i=
f(listen_socket < 0)=A0=A0=A0 exit(1);<br><br>=A0=A0=A0 FCGX_Request req=
uest;<br>=A0=A0=A0 if(FCGX_InitRequest(&request,=A0 listen_socket, 0)) =
exit(1); <br>
<br>=A0=A0=A0 int reqCounter =3D 0;<br>=A0=A0=A0 while(FCGX_Accept_r(&r=
equest) =3D=3D 0)<br>=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0 handle(request);<=
br>=A0=A0=A0=A0=A0=A0=A0 reqCounter++;<br>=A0=A0=A0=A0=A0=A0=A0 FCGX_FPrint=
F(request.out, "\n\r\n\r counter: %d", reqCounter);<br>
=A0=A0=A0=A0=A0=A0=A0 FCGX_Finish_r(&request);<br>=A0=A0=A0 }<br>=A0=A0=
=A0 return 0;<br>}<br>-------------------------------------------<br><br>It=
works good listening 9001 port and serving resquests from nginx http serve=
r. I choose fcgi_stdio beacuse it can listen on tcp socket and it is simple=
to integrate it with nginx web server.<br>
<br>Question:<br>Can i use this configuration and include GNU Cgicc Library=
to access post field values, headers, cookie?<br>Anyone, please point to a=
n example of using this both libraries in my case!<br><br>Thanks!<br clear=
=3D"all">
<br>-- <br>Eduard Bareev<br><a href=3D"mailto:[email protected]">eduard@bare=
ev.ru</a><br>
--001636c5a3982acb800470ca562b--
--===============0422295060==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
help-cgicc mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-cgicc
--===============0422295060==--