You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Keijser, Jan Just" <KE...@logica.com> on 1999/11/30 21:12:37 UTC

unbuffered CGI's on Win32

Hi again,

I've been investigating the use of unbuffered CGI's on Win95/98 and I
*think* I have found the problem but I don't know the best solution.

A short description of the problem:
if a user has a CGI that returns output every 2 seconds, the output is sent
to the browser only after the entire CGI script has completed. On real
systems (e.g. UNIX) the output is sent while the CGI is executing.

The problem is _NOT_ related to buffered pipes to/from the CGI program. The
output from the CGI program is read in a timely fashion (i.e. unbuffered and
not only after the CGI has completed). The problem lies in sending the data
back to the browser. I have isolated the cause of this: file main/buff.c,
lines

	if (!(fb->flags & B_WR)) {
/* unbuffered write -- have to use bcwrite since we aren't taking care
 * of chunking any other way */
	return bcwrite(fb, buf, nbyte);
    }

This is never called, since I cannot find any line that does 
  fb->flags &= B_WR;
or something similar; as an experiment, I removed the 'if' statement and
just plain called bcwrite. Lo and behold, the CGI output was unbuffered! 

The question now is, can I just remove the 'if' statement? Why is it there
in the first place?

Regards,

JJ Keijser
Logica Inc