Browse code

Fix issue with proxy setting leaving temp files (#17073)

When using the no_proxy option, the temp ca files that are created for
setting up an ssl context were not being deleted.

This small patch fixes that issue by removing the temp file.

Jay authored on 2016/09/14 05:15:48
Showing 1 changed files
... ...
@@ -631,6 +631,13 @@ class SSLValidationHandler(urllib2.BaseHandler):
631 631
         use_proxy = self.detect_no_proxy(req.get_full_url())
632 632
 
633 633
         if not use_proxy:
634
+            try:
635
+                # cleanup the temp file created, don't worry
636
+                # if it fails for some reason
637
+                os.remove(tmp_ca_cert_path)
638
+            except:
639
+                pass
640
+            
634 641
             # ignore proxy settings for this host request
635 642
             return req
636 643