diff Lib/http/client.py @ 65078:ad41fbf33e3b

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:22:42 +0000
parents 7c0f1837e8cb
children d0ce3eb11b28
line wrap: on
line diff
--- a/Lib/http/client.py	Sun Oct 03 17:55:45 2010 +0000
+++ b/Lib/http/client.py	Sun Oct 03 18:22:42 2010 +0000
@@ -917,6 +917,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)