[mod_python] How check permissions to GET JPG image

Enot enotus at tut.by
Tue Dec 6 10:26:43 EST 2005


Hello Mike,

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

ML> The Range header is sent by the client, so it will be in headers_in (not
ML> in headers-out, which is what the client will receive from you).
I know this basics. Thanks.

ML> You must read the RFC2616 documentation and implement what is described
ML> there. I'm sorry, there's no free lunch.
Not a problem.

ML> But before doing so, verify that your "download manager" is actually
ML> using that header. One way to do so is to abort a download, attempt a
ML> resume and see what gets sent to the server (have your python script
ML> dump the headers_in to a text file or so). If there's no "Range" in the
ML> headers, implementing it will not help you solve your problem.
I tryed that befor posting my problem.

ML> The range header normally specifies what the client wants, so you can
ML> set up a correct response (read the RFC!) open the file, seek to the
ML> requested position (using file.seek(..)) and start sending from there.
The problem is in mod_python. When i use "req.sendfile()"
my "req.headers_out" probably are rewrited by Apache.
Is any way to use "req.sendfile()" with resume? Where i must search?

Using "req.write()" for lage files is very bad.
Can i use successive "req.write(); req.flush()" with small pieces of
lage file?

-- 
Best regards,
 Enot                            mailto:enotus at tut.by



More information about the Mod_python mailing list