[mod_python] Implementing Range Retrieval Requests

Graham Dumpleton graham.dumpleton at gmail.com
Tue Aug 12 06:17:37 EDT 2008


2008/8/12 Samuele Kaplun <Samuele.Kaplun at cern.ch>:
> Dear list,
> I'm trying to implement a wide support for the HTTP 1.1 protocol in mod_python
> for streaming files to clients supporting caching, checksumming, range
> request.
> In particular I'm now trying to implement support for "Range Retrieval
> Requests"
> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2>.
>
> Some range request come in the form of multiple ranges. The corresponding
> respose should be implemented, according to the rfc, by means of a
> multipart/byteranges output:
> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16>
>
> My implementation is currently sending to the user the common HTTP headers and
> then manually writing each "part" with each corresponding HTTP headers and
> boundaries.
> Obviously in the main HTTP header I can't specify the actual content-length,
> because this will depend on the sum of the parts I'm going to send (and if my
> interpretation is correct this should account also for each sub-headers and
> boundaries).
>
> In mod_python, not setting the content-length prior to sending the first byte
> to the client implies using (apparently) chunked-encoding.
>
> Since I'm already sending output to the client in a low-level way (by building
> each part of the multipart) is there a way to avoid chunked-encoding headers
> to be sent to the client?
>
> Should I precalculate the content-length in order to disable chunked-encoding?

You would need the following to be implemented:

  https://issues.apache.org/jira/browse/MODPYTHON-238

If it is your own application on your own server, you could perhaps
modify mod_python source code to address the issue.

Graham


More information about the Mod_python mailing list