[issue12319] [http.client] HTTPConnection.request not support "chunked" Transfer-Encoding to send data
Rolf Krahl
report at bugs.python.org
Wed Jun 29 10:14:31 EDT 2016
Rolf Krahl added the comment:
Here comes a new version of the patch. I believe, I addressed all review comments made on issue12319_7.patch, with the exception of the EncodingError mentioned in the last post.
Most relevant changes compared to last patch:
* Do not try to dertermine the content length for text files.
* Change priority of object types for the body: try file like before byte like.
* Convert byte like to bytes before feeding the body into the socket. This fixes Issue 27340, at least as far as http.client is concerned.
* Split test_http() in one separate test for each body type in test_urllib2.py.
* Review documentation.
Another question is: what is the best method to test whether a file like is text or binary? For the moment, I kept the original code that essentially does:
try:
isText = "b" not in readable.mode
except AttributeError:
isText = False
This logic fails for StringIO and possibly others. Alternatives could be:
isText = isinstance(readable, io.TextIOBase)
isText = hasattr(readable, 'encoding')
or
isText = isinstance(readable.read(0), str)
What do you guys suggest?
----------
Added file: http://bugs.python.org/file43579/issue12319_8.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12319>
_______________________________________
More information about the Python-bugs-list
mailing list