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.
This commit is contained in:
Jay 2016-09-13 15:15:48 -05:00 committed by Adrian Likins
parent 7ea342d8ec
commit d86b2ec225

View file

@ -631,6 +631,13 @@ class SSLValidationHandler(urllib2.BaseHandler):
use_proxy = self.detect_no_proxy(req.get_full_url())
if not use_proxy:
try:
# cleanup the temp file created, don't worry
# if it fails for some reason
os.remove(tmp_ca_cert_path)
except:
pass
# ignore proxy settings for this host request
return req