This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: httplib shadows builtin, assumes strings
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: cwells, orsenthil
Priority: normal Keywords: patch

Created on 2010-10-01 23:44 by cwells, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue10012-release27-maint.patch orsenthil, 2010-10-03 06:34
issue10012-py3k.patch orsenthil, 2010-10-03 06:34
Messages (3)
msg117852 - (view) Author: Cliff Wells (cwells) Date: 2010-10-01 23:44
httplib.py ~Line 924

    def putheader(self, header, *values):
        str = '%s: %s' % (header, '\r\n\t'.join(values))
        self._output(str)


should be changed to something like:


    def putheader(self, header, *values):
        ...
        s = '%s: %s' % (header, '\r\n\t'.join([str(v) for v in values]))
        self._output(s)

The current version shadows str builtin with a local variable.  join method assumes strings so they should probably be explicitly cast (at least one 3rd party library appears to pass Content-length as an integer, causing this to fail.  Of course, this can't be done unless the str builtin is no longer shadowed.
msg117908 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-10-03 06:34
Here are patches with tests for py3k and release27-maint, for explicit conversion of header values to bytes/str.

If someone likes to review the patch, please provide your comments.
msg117922 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-10-03 18:26
Fixed in r85205 (py3k), r85206 (release31-maint) and r85207 (release27-maint).
History
Date User Action Args
2022-04-11 14:57:07adminsetgithub: 54221
2010-10-03 18:26:33orsenthilsetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg117922

stage: patch review -> resolved
2010-10-03 06:34:40orsenthilsetfiles: + issue10012-py3k.patch
2010-10-03 06:34:11orsenthilsetfiles: + issue10012-release27-maint.patch

versions: + Python 3.1, Python 3.2
keywords: + patch
messages: + msg117908
type: behavior
resolution: accepted
stage: patch review
2010-10-02 02:59:40orsenthilsetassignee: orsenthil

nosy: + orsenthil
2010-10-01 23:44:07cwellscreate