Message149075
| Author |
benjamin.peterson |
| Recipients |
benjamin.peterson, giampaolo.rodola, orsenthil |
| Date |
2011年12月09日.06:08:50 |
| SpamBayes Score |
0.00036348507 |
| Marked as misclassified |
No |
| Message-id |
<CAPZV6o-SiEQhM1yK0BKg2dvNJ10i-d=1+8KkJzXQUWaV3D=_nA@mail.gmail.com> |
| In-reply-to |
<1323406351.42.0.655415580211.issue13559@psf.upfronthosting.co.za> |
| Content |
2011年12月8日 Giampaolo Rodola' <report@bugs.python.org>:
>
> Giampaolo Rodola' <g.rodola@gmail.com> added the comment:
>
> This is not possible for two reasons:
>
> - on most POSIX systems, sendfile() works with mmap-like ("regular") files only, while HTTPConnection.send() accepts any file-like object as long as it provides a read() method
>
> - after read()ing a chunk of data from the file and before send()ing it over the socket, the data can be subject to an intermediate conversion (datablock.encode("iso-8859-1")):
> http://hg.python.org/cpython/file/87c6be1e393a/Lib/http/client.py#l839
> ...whereas sendfile() can only be used to send a binary file "as-is"
I presume you could check for a binary mode, though? Also, you can
catch EINVAl on invalid fds. |
|