[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

R. David Murray report at bugs.python.org
Sun Mar 3 16:42:42 CET 2013


R. David Murray added the comment:

Here is a modified patch with the tests moved to test_urllib2.  I'll give people some time to comment on whether this should be applied at all, and if so if it should be backported.  I'm leaning toward doing both, at the moment.

Karl, thanks for the report and patch.  The urllib tests could use a bit of reorganization to make them more discoverable, but I don't know that that is very likely to happen :)

The case of doing an add_header with newlines in it is probably worth a separate issue.  We fixed a similar issue in the email package a while back, but that one was much more likely to be an issue since it is much more likely for a program to be adding headers to an email message based on user input than it is to be adding headers to a Request based on user input.  But I'm sure it does happen, so it is probably worth fixing.

----------
Added file: http://bugs.python.org/file29297/request_header_space_removal.patch

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


More information about the Python-bugs-list mailing list