opensubscriber
   Find in this group all groups
 
Unknown more information…

h : help-cgicc@gnu.org 10 August 2009 • 10:23PM -0400

[help-cgicc] newbie question, help heeded
by Eduard Bareev

REPLY TO AUTHOR
 
REPLY TO GROUP




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
eduard@bare...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

opensubscriber is not affiliated with the authors of this message nor responsible for its content.