[mod_python] (servlet) download files with req.sendfile

Sharky at Code Zone sharky at codezone.ath.cx
Wed Jul 14 14:19:01 EDT 2004


So imagine that i don't append any HTML to the end of ths files, only
send file or show some HTML. When i do a req.sendfile(), he overwrite my
content_type...

You can see it in actions on: http://pytsts2.codezone.ath.cx/dwn69a

Thanks for help me
Sharky


A Qua, 2004-07-14 às 08:40, Nicolas Lehuen escreveu:

> Hi,
>  
> You should make sure that you send a proper Content-Type header before
> calling sendfile. A curl -i on
> http://pytsts2.codezone.ath.cx/dwn69?dwn=teste.tgz shows that you
> return a text/plain MIME type, which is not correct. Plus, the HTML
> page is appended to the end of the TGZ file.
>  
> As for the filename problem, I'm not sure, but I think the problem can
> be solved with a Content-Disposition header, though it is a bit
> unreliable. See :
>  
> http://ppewww.ph.gla.ac.uk/~flavell/www/content-type.html
>  
> and
>  
> http://www.mozilla.org/docs/web-developer/mimetypes.html
>  
> Regards,
>  
> Nicolas Lehuen
> 
> ______________________________________________________________________
> De : mod_python-bounces at modpython.org
> [mailto:mod_python-bounces at modpython.org] De la part de Sharky @ Code
> Zone
> Envoyé : mercredi 14 juillet 2004 03:44
> À : mod_python mailing list
> Objet : [mod_python] (servlet) download files with req.sendfile
> 
> 
> Hi,
> 
>     I have a test mod_python.servlet in
> http://pytsts2.codezone.ath.cx/dwn69 and don't know how to explain
> because my pour english but i will go try  8-)
> 
>     When i use req.sendfile('filename') my browser (Mozila) don't know
> the file type and name for download the file. It uses script filename.
> But if i download the file directly, my browser download fine and know
> the download filename and type.
> 
>     What are missing from my code? What i'm doing wrong?
> 
> Thanks,
> Sharky
> 
> PS.: Sorry my n00b questions 8-)  
> 
> ______________________________________________________________________
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://modpython.org/pipermail/mod_python/attachments/20040714/d2a43de2/attachment.html


More information about the Mod_python mailing list