Skip to content
This repository
Browse code

Use the flag is_ssl to determine if we're using an ssl proxy, not the…

… ssl module (which is always true)
  • Loading branch information...
commit 0cfc0ff677731c15d1eb15073178e4a94db1ea4b 1 parent b0579c9
Andrew Wilkinson authored September 26, 2011

Showing 1 changed file with 7 additions and 7 deletions. Show diff stats Hide diff stats

  1. 14  couchapp/restkit/client.py
14  couchapp/restkit/client.py
@@ -210,7 +210,7 @@ def get_connection(self, request):
210 210
         extra_headers = []
211 211
         sck = None
212 212
         if self.use_proxy:
213  
-            sck, addr, extra_headers = self.proxy_connection(request, addr, ssl)
  213
+            sck, addr, extra_headers = self.proxy_connection(request, addr, is_ssl)
214 214
         if not sck:
215 215
             sck = self._manager.find_socket(addr, is_ssl)
216 216
             if sck is None:
@@ -224,7 +224,7 @@ def get_connection(self, request):
224 224
                 ssl=is_ssl, extra_headers=extra_headers)
225 225
         return connection 
226 226
 
227  
-    def proxy_connection(self, request, req_addr, ssl):
  227
+    def proxy_connection(self, request, req_addr, is_ssl):
228 228
         """ do the proxy connection """
229 229
         proxy_settings = os.environ.get('%s_proxy' %
230 230
                 request.parsed_url.scheme)
@@ -233,7 +233,7 @@ def proxy_connection(self, request, req_addr, ssl):
233 233
             proxy_settings, proxy_auth =  _get_proxy_auth(proxy_settings)
234 234
             addr = parse_netloc(urlparse.urlparse(proxy_settings))
235 235
 
236  
-            if ssl:
  236
+            if is_ssl:
237 237
                 if proxy_auth:
238 238
                     proxy_auth = 'Proxy-authorization: %s' % proxy_auth
239 239
                 proxy_connect = 'CONNECT %s:%s HTTP/1.0\r\n' % req_addr
@@ -245,9 +245,9 @@ def proxy_connection(self, request, req_addr, ssl):
245 245
                 proxy_pieces = '%s%s%s\r\n' % (proxy_connect, proxy_auth, 
246 246
                         user_agent)
247 247
 
248  
-                sck = self._manager.find_socket(addr, ssl)
  248
+                sck = self._manager.find_socket(addr, is_ssl)
249 249
                 if sck is None:
250  
-                    self = self.connect(addr, ssl)
  250
+                    sck = self.connect(addr, is_ssl)
251 251
 
252 252
                 send(sck, proxy_pieces)
253 253
                 unreader = http.Unreader(sck)
@@ -263,9 +263,9 @@ def proxy_connection(self, request, req_addr, ssl):
263 263
                 if proxy_auth:
264 264
                     headers = [('Proxy-authorization', proxy_auth)]
265 265
 
266  
-                sck = self._manager.find_socket(addr, ssl)
  266
+                sck = self._manager.find_socket(addr, is_ssl)
267 267
                 if sck is None:
268  
-                    sck = self.connect(addr, ssl)
  268
+                    sck = self.connect(addr, is_ssl)
269 269
                 return sck, addr, headers
270 270
         return None, req_addr, []
271 271
 

0 notes on commit 0cfc0ff

Please sign in to comment.
Something went wrong with that request. Please try again.