httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Knowles" <>
Subject Do-it-yourself byteserving via CGI?
Date Thu, 04 Jul 2002 02:07:58 GMT
I'm running Apache 2.0.39/linux (win32 as well for testing), hosting a site
that has to serve large PDF files from an Oracle database. If I simply emit
the content of the PDF to Apache as the output of a cgi script, Apache
handles the appropriate slicing, dicing, and construction of the multipart
206 Partial Content response automagically, which is fine--except that the
PDFs can be somewhat large compared to the byteranges that Acrobat Reader
generally requests (about 50K compared to 15MB...). Fetching the entire PDF
and having Acrobat generate the multipart reply is rather inefficient (not
to mention generating a lot of unnecessary network traffic), especially
since Oracle lets you retrieve specific byteranges from a BLOB--which is
precisely what I need.

I've written myself a Perl script based on the (somewhat broken)
demonstration PDF byteserving code Adobe provides, which runs fine in
NPH--but if I run in NPH, I seem to lose keepalive, so Acrobat Reader won't
download more than about the first 600K of the PDF if you ask it to download
the whole file.

Is there a clean way around this? I've thought of a couple of possible

- use NPH and deal with the keepalive problem
- find a way to suppress Apache's default handling of requests that include
Bytes: in the header (there doesn't seem to be a configuration directive to
do this, but I might be missing something; I've also considered writing a
filter that changes the Bytes: header to x-Bytes: or something, but that's

Or, is there a way to have Apache cache the entire reply locally and serve
up various byteranges without re-requesting the content from the CGI script?

Thanks in advance!

-= Martin Knowles, Director of Development - Lucidoc Corp.
-= -

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message