Fix Issue10012 - httplib headers, which are (sometimes mistakenly) int are explicitly cast to str (bytes - in py3k).

This commit is contained in:
Senthil Kumaran 2010-10-03 18:22:42 +00:00
parent 4271372a71
commit 58d5dbf80b
2 changed files with 11 additions and 0 deletions

View file

@ -917,6 +917,8 @@ class HTTPConnection:
for i, one_value in enumerate(values):
if hasattr(one_value, 'encode'):
values[i] = one_value.encode('ascii')
elif isinstance(one_value, int):
values[i] = str(one_value).encode('ascii')
value = b'\r\n\t'.join(values)
header = header + b': ' + value
self._output(header)