From 2bf19d31289bc64dfcd794f4983e637bf9352d8c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 10 Dec 2019 11:44:14 -0500 Subject: [PATCH] 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 --- pyghmi/util/webclient.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyghmi/util/webclient.py b/pyghmi/util/webclient.py index d0122595..5b8a8bea 100644 --- a/pyghmi/util/webclient.py +++ b/pyghmi/util/webclient.py @@ -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: