[FASTCGI] flush to client before receive complete

jon at melodis.com jon at melodis.com
Wed Feb 11 13:39:08 EST 2009


Hello,

I'm using FCGI in an application where the client streams data over
chunked http to apache for several seconds.

I would like to sometimes send a response to the client before the client
is finished streaming data to apache.

The main loop in my barebones cgi program looks like this:

while (FCGI_Accept() >= 0)
{
  /* send result back to client right away */
  char sz[] = "Content-Type: text/html\r\n\r\nEarly Result\n";
  fwrite(sz, 1, strlen(sz), stdout);
  fflush(stdout);
}

When I stream data to this fcgi program I don't receive results until all
data is finished streaming to apache.  I'm expecting to get results right
away.  (I've tested my client to make sure it can receive results early.)

Does anyone know if this a basic limitation of apache or the http
protocol, or if there is a fcgi workaround, or apache config workaround?

Thanks for any help,
Jon









More information about the FastCGI-developers mailing list