[mod_python] Implementing Range Retrieval Requests

Samuele Kaplun Samuele.Kaplun at cern.ch
Tue Aug 12 05:10:30 EDT 2008

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 
In particular I'm now trying to implement support for "Range Retrieval 

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:

My implementation is currently sending to the user the common HTTP headers and 
then manually writing each "part" with each corresponding HTTP headers and 
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 

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?

Best regards,

More information about the Mod_python mailing list