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:
@@ -292,6 +292,8 @@ class SecureHTTPConnection(httplib.HTTPConnection, object):
|
|||||||
def request(self, method, url, body=None, headers=None, referer=None):
|
def request(self, method, url, body=None, headers=None, referer=None):
|
||||||
if headers is None:
|
if headers is None:
|
||||||
headers = self.stdheaders.copy()
|
headers = self.stdheaders.copy()
|
||||||
|
else:
|
||||||
|
headers = headers.copy()
|
||||||
if method == 'GET' and 'Content-Type' in headers:
|
if method == 'GET' and 'Content-Type' in headers:
|
||||||
del headers['Content-Type']
|
del headers['Content-Type']
|
||||||
if method == 'POST' and body and 'Content-Type' not in headers:
|
if method == 'POST' and body and 'Content-Type' not in headers:
|
||||||
|
|||||||
Reference in New Issue
Block a user