chesterpolo / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

non-parsed CGI #199

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is there a way to enable non-parsed CGIs, so any CGI output will be sent 
immediately to the client. In the default mode, the CGI execution must end 
before anything is send.

Original issue reported on code.google.com by abili...@gmail.com on 28 Oct 2010 at 4:20

GoogleCodeExporter commented 9 years ago
You're not entirely correct.
When CGI process is spawned, mongoose buffers all HTTP headers in and does not 
send the output to the client. However, when all HTTP headers are buffered and 
parsed, CGI data is sent immediately as it is read from the CGI process.

Original comment by valenok on 30 Oct 2010 at 7:14

GoogleCodeExporter commented 9 years ago
Sorry, but I built this tiny CGI in C as an example:

int main() {
    printf("HTTP/1.1 200 OK\n");
    printf("Content-type: text/html\n\n");
    printf("Test");
    Sleep(5000);
    return 0;
}

The code is compiled in Windows. Its called from javascript with a 
XMLHttpRequest. The word "Test" wont appear in the output for 5 seconds. If I 
remove the delay in the CGI, the output will appear instantly. I tried sending 
the raw HTTP transaction to the server, and I have to wait for 5 seconds until 
I see the result.

Any ideas?

Original comment by abili...@gmail.com on 30 Oct 2010 at 3:34

GoogleCodeExporter commented 9 years ago
Submitted 
http://code.google.com/p/mongoose/source/detail?r=8e51a29c2af65d55dc2a07d71ba1a4
69448e56fa

Original comment by valenok on 15 Nov 2010 at 9:49