Anonymous avatar Anonymous committed 0b91b6d

When opening a socket for HTTP, httplib2 uses the IP and port that is returned from socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM). This breaks using an HTTP CONNECT proxy by preventing the socks module from ever seeing the original domain name. Using the orignal hostname and port seem to be the correct choice here as the socket library will resolve them and it would have already been cached.

Comments (0)

Files changed (1)

python2/httplib2/__init__.py

                 if self.debuglevel > 0:
                     print "connect: (%s, %s)" % (self.host, self.port)
 
-                self.sock.connect(sa)
+                self.sock.connect((self.host, self.port) + sa[2:])
             except socket.error, msg:
                 if self.debuglevel > 0:
                     print 'connect fail:', (self.host, self.port)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.