Re: flush to client before receive complete

[email protected]
Newsgroups gmane.comp.web.fastcgi.devel
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..
> _______________________________________________
> FastCGI-developers mailing list
> FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org
> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers
>

Thanks for the suggestion.  I added -flush to my FastCgiServer line in
httpd.conf but didn't get the early response.

>From what I can tell, server-side push in apache isn't designed for this
special case of sending data full-duplex mode, where data can transmit in
both directions simultaneously.  Since the post is chunked, the response
is chunked by default so it seems like it should work.

Although I'm not sure, at this point I doubt it is a fastcgi config issue
or bug, but rather an apache config issue.

Thanks again,
-Jon
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.