Re: flush to client before receive complete

Ari Koponen <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel,gmane.spam.detected
Message-ID <[email protected]>
On Wed, Feb 11, 2009 at 8:39 PM,  <[email protected]> wrote:
> 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?

Just a thought: Have you tried the -flush option for the mod_fastcgi.
>From the Docs:

"FastCGI application output is buffered by default. This is not the
case for CGI scripts (under Apache 1.3). To override the default
behavior, use the -flush option (not available for dynamic
applications)."

I don't have experience from this issue though..
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.