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).

this date in:
About Me

Greatest Hits
Correlation vs. Causality
The Tyranny of Email
Unnatural Selection
On Blame
Try, or Try Not
Books and Wine
Emergent Properties
God and Beauty
Moving Mount Fuji
The Nest
Rock 'n Roll
IQ and Populations
Are You a Bright?
Adding Value
The Joy of Craftsmanship
The Emperor's New Code
Toy Story
The Return of the King
Religion vs IQ
In the Wet
solving bongard problems
visiting Titan
unintelligent design
the nuclear option
estimating in meatspace
second gear
On the Persistence of Bad Design...
Texas chili cookoff
almost famous design and stochastic debugging
may I take your order?
universal healthcare
triple double
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
the first bird
Gödel Escher Bach: Birthday Cantatatata
Father's Day (in pictures)
your cat for my car
Jobsnotes of note
world population map
no joy in Baker
vote smart
exact nonsense
introducing eyesFinder
to space
where are the desktop apps?
still the first bird
electoral fail
progress ratches
2020 explained