diff Lib/http/client.py @ 65079:32c32b70aa33 3.1

Merged revisions 85205 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r85205 | senthil.kumaran | 2010-10-03 23:52:42 +0530 (Sun, 03 Oct 2010) | 3 lines Fix Issue10012 - httplib headers, which are (sometimes mistakenly) int are explicitly cast to str (bytes - in py3k). ........
author Senthil Kumaran <orsenthil@gmail.com>
date Sun, 03 Oct 2010 18:25:01 +0000
parents bebe5e35661e
children 0f398188c7f6
line wrap: on
line diff
--- a/Lib/http/client.py	Sun Oct 03 18:04:52 2010 +0000
+++ b/Lib/http/client.py	Sun Oct 03 18:25:01 2010 +0000
@@ -916,6 +916,8 @@
         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)