Critical Section


nph and mod_gzip

Saturday,  05/01/04  08:14 PM

If you write nph CGIs, be sure to exclude them from mod_gzip.  That's the message of this post; feel free to skip the rest if this is geek to you.

This is only of esoteric interest to 99.99% of you, but posting it here this is the best way for me to find it again.  Also this wasn't anywhere on the web - that Google knew of, anyway - so now maybe someone else who's looking will be able to find it, too.

Today I wrote an nph CGI, and it wasn't working.  After a lot of poking around and trying things, I finally realized why it didn't work: I have mod_gzip enabled!  Of course.  The answer was to disable mod_gzip for nph CGIs, with the following apache directive:

mod_gzip_item_exclude file nph.*\.cgi$

In order to perform its compression mod_gzip has to buffer all the output from a CGI, thereby negating the "pass everything through in realtime" behavior of an nph CGI.

For those who are wondering, nph means "non-parsed headers".  Any CGI program whose name begins with "nph-" is assumed to use "non-parsed headers", which means apache will simply pass through the output of the CGI directly to the browser.  In such cases the CGI must generate all the HTTP headers, even the "HTTP/1.0 200 OK" response.  This is most useful for CGIs which generate ongoing output from some long-running process, such as progress messages or a debugging log.

And for those who are wondering, mod_gzip is an apache module which enables LZW compression for output pages to browsers which support it.  This enables a reduction of bandwidth of over 50%, and I highly recommend it (see my site optimization article from a year ago for more information).

Home
Archive
'09
'08   '07   '06
'05   '04   '03
All Articles
Re:Cycling
Re:The Book
Re:Software
Re:Philosophy
About Me
W=UH
Email
Search

RSS   OPML

Greatest Hits
Correlation vs. Causality
The Tyranny of Email
Unnatural Selection
Lying
Aperio's Mission = Automating Pathology
On Blame
Try, or Try Not
Books and Wine
Google and Blogs
Emergent Properties
God and Beauty
Moving Mount Fuji The Nest Rock 'n Roll
IQ and Populations
Are You a Bright?
Adding Value
Confidence
The Joy of Craftsmanship
The Emperor's New Code
Toy Story
The Return of the King
Religion vs IQ
Most Spectacular Photos of 2003
In the Wet
the big day
solving bongard problems
visiting Titan
unintelligent design
Shorthorn
the nuclear option
second gear
On the Persistence of Bad Design...
Texas chili cookoff
the inflection point
almost famous design and stochastic debugging
may I take your order?
paper art
triple double
China's olympic gardens
New Yorker covers
Death Rider! (da da dum)
how did I get here (Mt.Whitney)?
the Law of Significance
Holiday Inn
Daniel Jacoby's photographs
room with a view
weird disaster update
in praise of paddle shifting
the first bird
Gödel Escher Bach: Birthday Cantatatata
shining a light
Father's Day (in pictures)
Tour de France 2009
Π