2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-13 11:17:47 +00:00

Fix modification of input headers.

When given custom headers, webclient was persistently leaving
the Content-Length modified.  Fix by making a private
copy before potentially modifying it.

Change-Id: I2de5268ffc35a725e7b9d360214eab498d2ac788
This commit is contained in:
Jarrod Johnson 2019-12-10 11:44:14 -05:00
parent dec668cc21
commit 2bf19d3128

View File

@ -292,6 +292,8 @@ class SecureHTTPConnection(httplib.HTTPConnection, object):
def request(self, method, url, body=None, headers=None, referer=None):
if headers is None:
headers = self.stdheaders.copy()
else:
headers = headers.copy()
if method == 'GET' and 'Content-Type' in headers:
del headers['Content-Type']
if method == 'POST' and body and 'Content-Type' not in headers: