Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81d1a76 commit 93ee4a0Copy full SHA for 93ee4a0
1 file changed
lib/request/proxy.py
@@ -29,6 +29,12 @@
29
import urllib
30
import urllib2
31
32
+from lib.core.settings import PYVERSION
33
+
34
35
+if PYVERSION >= "2.6":
36
+ import ssl
37
38
39
class ProxyHTTPConnection(httplib.HTTPConnection):
40
_ports = {"http" : 80, "https" : 443}
@@ -98,8 +104,12 @@ def connect(self):
98
104
ProxyHTTPConnection.connect(self)
99
105
100
106
# Make the sock ssl-aware
101
- ssl = socket.ssl(self.sock, self.key_file, self.cert_file)
102
- self.sock = httplib.FakeSocket(self.sock, ssl)
107
+ if PYVERSION >= "2.6":
108
+ sslobj = ssl.wrap_socket(self.sock, self.key_file, self.cert_file)
109
+ self.sock = sslobj
110
+ else:
111
+ sslobj = socket.ssl(self.sock, self.key_file, self.cert_file)
112
+ self.sock = httplib.FakeSocket(self.sock, sslobj)
103
113
114
115
class ProxyHTTPHandler(urllib2.HTTPHandler):
0 commit comments