mirror of
https://opendev.org/x/pyghmi
synced 2025-08-26 04:50:23 +00:00
Restore cloned webclient TLS validation behavior
In supporting the standard validation, custom validation was broken when a webclient was cloned. Change-Id: Ib2e2b8ca9c1582c778539b35ff7ee456f3118f82
This commit is contained in:
@@ -130,10 +130,6 @@ class SecureHTTPConnection(httplib.HTTPConnection, object):
|
||||
**kwargs)
|
||||
except TypeError:
|
||||
httplib.HTTPConnection.__init__(self, host, port, **kwargs)
|
||||
if verifycallback:
|
||||
self.cert_reqs = ssl.CERT_NONE # use custom validation
|
||||
else:
|
||||
self.cert_reqs = ssl.CERT_REQUIRED # use standard validation
|
||||
if clone:
|
||||
self._certverify = clone._certverify
|
||||
self.cookies = clone.cookies
|
||||
@@ -142,6 +138,10 @@ class SecureHTTPConnection(httplib.HTTPConnection, object):
|
||||
self._certverify = verifycallback
|
||||
self.cookies = {}
|
||||
self.stdheaders = {}
|
||||
if self._certverify:
|
||||
self.cert_reqs = ssl.CERT_NONE # use custom validation
|
||||
else:
|
||||
self.cert_reqs = ssl.CERT_REQUIRED # use standard validation
|
||||
if '[' not in host and '%' in host:
|
||||
self.stdheaders['Host'] = '[' + host[:host.find('%')] + ']'
|
||||
|
||||
|
Reference in New Issue
Block a user