[mod_python] Request.sendfile() and symlinks

Graham Dumpleton grahamd at dscpl.com.au
Sat Oct 15 09:16:33 EDT 2005

Can't look at it until tomorrow, but check code in src/ 
requestobject.c of mod_python
source code. The req_sendfile() may well have a bug in it as does a  
stat of  the
file to get the length and when it tells Apache to send the file it  
passes that length
to the underlying call as the number of bytes to send. If the stat  
call is being
performed on the symlink as it appears and not what it points at, the  
wrong length
would be used. The contents of the actual file will be sent though as  
the symlink
will be followed correctly at that point, just not enough is sent.

Maybe someone else can look at this while I get some sleep. ;-)


On 15/10/2005, at 10:37 PM, Wim Heirman wrote:

> Hello,
> When I call req.sendfile(filename) where filename is a symbolic  
> link, only part of the file is sent to the client (as many bytes as  
> there are characters in the symlink's file reference, so for a  
> symlink pointing to '../index.html' I get the first 13 bytes of the  
> correct file). Is this normal behaviour?
> Also, I would like to set the Content-Type correctly, based on the  
> file I'm sending. Using the standard mimetypes package works fine,  
> but is it possible to use Apache's mime-typing for this? Since the  
> code for that is already loaded it should be a bit more efficient.
> Regards,
> Wim
> -- 
> ir. Wim Heirman,
> ELIS Department, Ghent University, Belgium
> Phone: +32-9-264.95.27
> E-mail: wim.heirman at elis.UGent.be
> http://www.elis.UGent.be/~wheirman/
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list