File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 29
29
import urllib
30
30
import urllib2
31
31
32
+ from lib .core .settings import PYVERSION
33
+
34
+
35
+ if PYVERSION >= "2.6" :
36
+ import ssl
37
+
32
38
33
39
class ProxyHTTPConnection (httplib .HTTPConnection ):
34
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
104
114
105
115
class ProxyHTTPHandler (urllib2 .HTTPHandler ):
You can’t perform that action at this time.
0 commit comments