Chapter 7
(Optional/Advanced)
Non-Parsed Headers ("Server Push")
Customary Server/CGI Interaction:
script outputs
Content-Type
and perhaps a few other headers
server adds a status code ("200 Ok", "500 Server Error", etc.)
server may add other headers e.g.
Server
identifying the server software
script runs, sends its output to server
server caches the output of the script
server keeps caching until it gets an EOF from the script
server sends all of the output to the browser at one time
To Deliver Realtime Data, Disable Server Caching:
use
non-parsed headers
to see the output as it is produced
the script takes complete responsibility for generation of headers
the server lets the data pass through to the client without caching it or adding headers
lower overhead for the web server itself
give the script a name that starts with
nph-
example
: count down for twenty seconds
source code
:
Set the global special variable "$|" to 1.
This causes the output on the currently selected output filehandle (STDOUT by default) to be "unbuffered".
The data is output immediately instead of being buffered.
Back
Home
Curriculum
Contents
http://www.keller.com/perlweb/chap7/index.html
Updated
Wednesday, 31-Oct-2001 14:25:00 CST
Copyright © 2000
Dan Keller Technical Services
4500 19th St., San Francisco
California, USA 94114
tel: 415 / 861-4500