Re: Server push applications using FastCGI

blong@fiction.net
Fri, 26 Jul 1996 15:16:24 -0500

Message-Id: <199607262016.PAA08758@fiction.isdn.uiuc.edu>
Date: Fri, 26 Jul 1996 15:16:24 -0500
From: blong@fiction.net
To: rnewman@nfic.com (Ron Newman)
Subject: Re: Server push applications using FastCGI
In-Reply-To: <199607261850.OAA09047@janis-joplin.nfic.com>; from Ron Newman on Jul 26, 1996 14:50:15 -0400

On 7/26, Ron Newman uttered the following other thing:
> 
> I asked whether a FastCGI program can intermittendly stream output
> to the client, based on a possibly false impression that a CGI program
> can do so only if written as a non-parse-header (NPH) program.  
> Mark Brown replied:
> 
>     A Web server that implements FastCGI sends application data to the
>     client as long as there is any data to send; the data doesn't linger
>     indefinitely in the server's buffer.  (Actually, the spec is silent on
>     the issue, because I didn't realize it *was* an issue.  The Open
>     Market server treats NPH and non-NPH CGI scripts the same with respect
>     to buffering.  As a result of your query the spec will improve;
>     thanks!)
> 
> I based my question on statements in the book "Build a Web Site"
> by net.Genesis, pages 348-351.  This give an example of an
> NPH server-push script, and claims:
>   
>    "The obvious question is why this has to be an NPH script 
>     in order to work.  With regular CGI scripts, the server waits
>     patiently until the CGi program has completed its processing.
>     Then once it has received all output from the CGI program,
>     it sends a response to the client.  But our sample program
>     is supposed to send each one of the parts every ten seconds.
>     Without an NPH script, the server would not send any of 
>     the parts to the client until it had received all the parts
>     from the program.  The server would then take the entire
>     response and send it to the client, which would completely
>     ruin the functionality of the program."
> 
> The CGI spec itself seems to be silent on this issue.

Yes, the CGI spec is silent.  Netscape (or Netsite) never used
buffering, and they introduced the concept of server-push.  NCSA 1.3
and 1.4 (and earlier) used buffered I/O, so they required you to use
an NPH script.  The CGI "spec" (ie, the CGI ietf draft) was drafted
quite a bit after either of these.  NCSA 1.5 doesn't do buffering,
Openmarket doesn't do buffering, and I'm not sure about the latest
Apache, but I think they don't do buffering.

On the other hand, remember that the CGI script can't use buffering
itself, either, or it doesn't matter if the server does.

Brandon

-- 
 Brandon Long           "Understanding is a three-edged sword"
 HTTPd/SDG/NCSA                -- Kosh (Babylon 5)
 blong@fiction.net
 www.uiuc.edu/ph/www/blong         Don't worry, these aren't even my views.