You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Martin Knowles <mj...@lucidoc.com> on 2002/07/04 04:07:58 UTC

Do-it-yourself byteserving via CGI?

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
solutions:

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

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.
-= mjk@lucidoc.com - http://www.lucidoc.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org