Tom Murphy wrote:
I have a client for whom I manage documents, some of which are in pdf
format. The documents are not in the web tree, and are served based on
custom access etc., and some are encrypted on the files system. I am
successfully do all this, and ultimately use send_fd to send the file(s).
The client has noticed that through the managed process, the time to view
the pdf is longer than viewing the same file through the default handler.
I have discovered that this is most likely due to the fact that Apache is
byteserving the file, allowing the first page to be viewed even though the
complete file has not been downloaded. The complete time to download
between the default handler and my handler are quite close, but the document
comes up for partial view much quicker with the default handler.

I have been able to use Apache::File to modify my handler to recognize when
a byteserving request has come in ( using ap_set_byterange), and access the
ap_each_byterange call to decode the header. However, it does not seem like
the ap_send_fd_length is mod_perl accessible.
$r->send_fd($fh, $length);

see recipe 6.3 in the mod_perl developer's cookbook, but that's about all there is to the call. recipe 6.7 explains byteserving in general, but it seems you've already seen the appropriate methods in Apache::File.

Is there any issue with
adding access to this API function?
no :)

Also, will I have a problem setting the
PARTIAL_CONTENT response?
you shouldn't if you use the proper series of API calls - order is important. see http://www.modperlcookbook.org/code/ch06/Cookbook/SendAnyDoc.pm for an example.

With the clients encrypted documents, I have the documents in memory only.
I would like to use the send_fb/send_fb_length call in a similar fashion.

I haven't done any XS/guts type programming, so I'm hoping this will be a
relatively simple task.
it's relatively simple to create a subclass Apache that adds whatever ap_ method you want to $r. there are a few examples in the cookbook, or you can see some materials in the presentation I just gave at ApacheCon

http://www.modperlcookbook.org/~geoff/slides/ApacheCon/oo-mod_perl-printable.ppt.gz

most of the examples can be found someplace under

http://www.modperlcookbook.org/~geoff/modules/

HTH

--Geoff

Reply via email to