Mike Looijmans
nlv11281 at natlab.research.philips.com
Tue Dec 6 08:34:13 EST 2005
>>>When I use req.sendfile() all works exept for download resume. After >>>download stops at middle, resume is impossibe. Error in download >>>manager when trying resume. > > ML> You will probably have to implement the HTTP/1.1 "Range" header. Is not > ML> hard to program, but will take a little finger typing. Find the HTTP RFC > ML> 2616, and look for "Range". > > How i can access HTTP/1.1 "Range" header from mod_python? I found > nothing about "Range" header. "req.range" always "None", > "req.headers_out" do nothing at least when using with > "req.sendfile()". > As i understand, Apache or rewrite header when using "req.sendfile()". > And this is main problem. The Range header is sent by the client, so it will be in headers_in (not in headers-out, which is what the client will receive from you). You must read the RFC2616 documentation and implement what is described there. I'm sorry, there's no free lunch. But before doing so, verify that your "download manager" is actually using that header. One way to do so is to abort a download, attempt a resume and see what gets sent to the server (have your python script dump the headers_in to a text file or so). If there's no "Range" in the headers, implementing it will not help you solve your problem. The range header normally specifies what the client wants, so you can set up a correct response (read the RFC!) open the file, seek to the requested position (using file.seek(..)) and start sending from there.
|