Missing characters from input stream from fastcgi request
Tomas Friml <[email protected]> Sun, 28 Nov 2010 22:17:33 +1300
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I'm trying to develop simple RESTful api using FastCGI (and restcgi). When I
tried to implement POST method I noticed that the input stream (representing
request body) is wrong. I did a little test and looks like when I try to
read the stream only every other character is received.
Body sent: name=john&surname=smith Received: aejh&unm=mt
I've tried more clients just to make sure it's not the client messing with
the data. My code is:
int main(int argc, char* argv[]) {
// FastCGI initialization.
FCGX_Init();
FCGX_Request request;
FCGX_InitRequest(&request, 0, 0);
while (FCGX_Accept_r(&request) >= 0) {
// FastCGI request setup.
fcgi_streambuf fisbuf(request.in);
std::istream is(&fisbuf);
fcgi_streambuf fosbuf(request.out);
std::ostream os(&fosbuf);
std::string str;
is >> str;
std::cerr << str; // this way I can see it in apache error log
// restcgi code here
}
return 0;
}
I'm using fast_cgi module with apache (not sure if that makes any
difference).
Any idea what am I doing wrong?
Cheers, Tom
_______________________________________________
FastCGI-developers mailing list
FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers