You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@gonzo.ben.algroup.co.uk> on 1995/10/21 16:46:19 UTC

Server push problem

>From c.i.w.s.u:

From: mg@obd.com
Newsgroups: comp.infosystems.www.servers.unix
Subject: Problem with server push and Apache
Date: Mon, 16 Oct 1995 01:49:27 GMT
Organization: OKI Business Documentation
Message-ID: <DG...@waterw.com>

I am having trouble with server push using the Apache server.  The server does
not appear to pass the output of the cgi script until the script exits.  I have tried this
with both a perl script setting $| = 1 to force flushing of the output after each line
and a small C program using fflush() to flush the output buffer, and in both cases
the output of the script is received as a single burst of output instead of a steady
stream.  I have verified this by using telnet to connect to the http port and entering
a GET command.  As far as I can tell, the buffer is getting flushed because the
output appears as I expect when I use the program tee(1).

Is there some configuration magic necessary or something special to do with
the script to force the output to essentially be unbuffered by the server?

	Morris Goldstein (mg@obd.com)

--------------------------------------

This is of course, true - we buffer in great big lumps, and this will totally
stuff server push. Would anyone care to express views on these possibilities?

1. Don't buffer CGI output.

2. Recognise the MIME multipart header and look for the separator.

3. Add a timeout.

4. Do a combination of 2 & 3.

5. Do any of the above on a configuration file flag.

6. Declare server push to be a non-standard extension and ignore the problem.

Cheers,

Ben.

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant        Fax:   +44 (181) 994 6472
and Technical Director      Email: ben@algroup.co.uk
A.L. Digital Ltd,
London, England.

Re: Server push problem

Posted by Brian Behlendorf <br...@organic.com>.
On Sat, 21 Oct 1995, Ben Laurie wrote:
[server-push problems]
> --------------------------------------
> 
> This is of course, true - we buffer in great big lumps, and this will totally
> stuff server push. Would anyone care to express views on these possibilities?
> 
> 1. Don't buffer CGI output.
> 
> 2. Recognise the MIME multipart header and look for the separator.
> 
> 3. Add a timeout.
> 
> 4. Do a combination of 2 & 3.
> 
> 5. Do any of the above on a configuration file flag.
> 
> 6. Declare server push to be a non-standard extension and ignore the problem.

There are two ways to do server-push with Apache with a minimum of hassle:

1) Make your CGI script an NPH script, by prepending the name with "nph-" 
(a hack if ever there was one!) This has another important benefit, which 
is that it detaches the script from the server process so you don't tie 
up resources while someone downloads your 600K server push over a 14.4 
modem.  However, you can't get size or content-type information in the log 
file.

2) Cat the output of your script into its own file and serve it up as an 
as-is file.  This has the drawback in that one can't set sleeps() to 
simulate controlled animation, but it does give you file and content-type 
information and it tends to be easier on your server.  One bash script 
I've seen that implements server-push fires off 10 + 4X shell processes 
(where X is the number of frames) to accomplish its task - ICK!

Might be cool to document this somewhere. 

	Brian

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com  brian@hyperreal.com  http://www.[hyperreal,organic].com/