[issue23740] http.client request and send method have some datatype issues

R. David Murray report at bugs.python.org
Sun Mar 22 20:28:44 CET 2015


New submission from R. David Murray:

While committing the patch for issue 23539 I decided to rewrite the 'request' docs for clarity.  I doing so I found that http.client isn't as consistent as it could be about how it handles bytes and strings.  Two points specifically:  it will only take the length of a bytes-like object (to supply a default Content-Length header) if isinstance(x, bytes) is true (that is, it doesn't take the length of eg array or memoryview objects), and (2) if an iterable is passed in, it must be an iterable of bytes-like objects.  Since it already automatically encodes string objects and text files, for consistency it should probably also encode strings if they are passed in via an iterator.

----------
keywords: easy
messages: 238928
nosy: r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: http.client request and send method have some datatype issues
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23740>
_______________________________________


More information about the Python-bugs-list mailing list