[Python-checkins] r88144 - in python/branches/py3k: Lib/http/client.py Misc/NEWS

georg.brandl python-checkins at python.org
Sat Jan 22 23:06:24 CET 2011


Author: georg.brandl
Date: Sat Jan 22 23:06:24 2011
New Revision: 88144

Log:
#10983: fix several bugs in the _tunnel implementation that seem to have missed while porting between branches.  A unittest is needed!

Modified:
   python/branches/py3k/Lib/http/client.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/http/client.py
==============================================================================
--- python/branches/py3k/Lib/http/client.py	(original)
+++ python/branches/py3k/Lib/http/client.py	Sat Jan 22 23:06:24 2011
@@ -653,6 +653,7 @@
         self._method = None
         self._tunnel_host = None
         self._tunnel_port = None
+        self._tunnel_headers = {}
 
         self._set_hostport(host, port)
 
@@ -691,15 +692,16 @@
 
     def _tunnel(self):
         self._set_hostport(self._tunnel_host, self._tunnel_port)
-        connect_str = "CONNECT %s:%d HTTP/1.0\r\n" %(self.host, self.port)
+        connect_str = "CONNECT %s:%d HTTP/1.0\r\n" % (self.host, self.port)
         connect_bytes = connect_str.encode("ascii")
         self.send(connect_bytes)
-        for header, value in self._tunnel_headers.iteritems():
+        for header, value in self._tunnel_headers.items():
             header_str = "%s: %s\r\n" % (header, value)
             header_bytes = header_str.encode("latin1")
             self.send(header_bytes)
+        self.send(b'\r\n')
 
-        response = self.response_class(self.sock, method = self._method)
+        response = self.response_class(self.sock, method=self._method)
         (version, code, message) = response._read_status()
 
         if code != 200:

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat Jan 22 23:06:24 2011
@@ -16,6 +16,8 @@
 Library
 -------
 
+- Issue #10983: Fix several bugs making tunnel requests in http.client.
+
 - Issue #10955: zipimport uses ASCII encoding instead of cp497 to decode
   filenames, at bootstrap, if the codec registry is not ready yet. It is still
   possible to have non-ASCII filenames using the Unicode flag (UTF-8 encoding)


More information about the Python-checkins mailing list