summaryrefslogtreecommitdiff
path: root/python2
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2011-12-01 16:11:03 -0500
committerJason R. Coombs <jaraco@jaraco.com>2011-12-01 16:11:03 -0500
commit9804c422ad8763ecd8ce2d4d6c145f5f92c742bf (patch)
tree7c788a017bca692781e4f0369cbe3e9776688e1c /python2
parent4d031dde8cfa6249dc7b437ba5000686a0086c27 (diff)
downloadhttplib2-9804c422ad8763ecd8ce2d4d6c145f5f92c742bf.tar.gz
Now allow unicode to specify proxy hostname. Fixes #179
Diffstat (limited to 'python2')
-rw-r--r--python2/httplib2/socks.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/python2/httplib2/socks.py b/python2/httplib2/socks.py
index 84cb93b..0991f4c 100644
--- a/python2/httplib2/socks.py
+++ b/python2/httplib2/socks.py
@@ -13,7 +13,7 @@ are permitted provided that the following conditions are met:
3. Neither the name of Dan Haim nor the names of his contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -143,15 +143,15 @@ class socksocket(socket.socket):
return data
def sendall(self, content, *args):
- """ override socket.socket.sendall method to rewrite the header
- for non-tunneling proxies if needed
+ """ override socket.socket.sendall method to rewrite the header
+ for non-tunneling proxies if needed
"""
if not self.__httptunnel:
content = self.__rewriteproxy(content)
return super(socksocket, self).sendall(content, *args)
def __rewriteproxy(self, header):
- """ rewrite HTTP request headers to support non-tunneling proxies
+ """ rewrite HTTP request headers to support non-tunneling proxies
(i.e. those which do not support the CONNECT method).
This only works for HTTP (not HTTPS) since HTTPS requires tunneling.
"""
@@ -162,7 +162,7 @@ class socksocket(socket.socket):
host = hdr
elif hdr.lower().startswith("get") or hdr.lower().startswith("post"):
endpt = hdr
- if host and endpt:
+ if host and endpt:
hdrs.remove(host)
hdrs.remove(endpt)
host = host.split(" ")[1]
@@ -399,7 +399,7 @@ class socksocket(socket.socket):
To select the proxy server use setproxy().
"""
# Do a minimal input check first
- if (not type(destpair) in (list,tuple)) or (len(destpair) < 2) or (type(destpair[0]) != type('')) or (type(destpair[1]) != int):
+ if (not type(destpair) in (list,tuple)) or (len(destpair) < 2) or (not isinstance(destpair[0], basestring)) or (type(destpair[1]) != int):
raise GeneralProxyError((5, _generalerrors[5]))
if self.__proxy[0] == PROXY_TYPE_SOCKS5:
if self.__proxy[2] != None: