Fix overwritten Accept header when proxy is used (#916725)
This commit is contained in:
parent
e2c2602a24
commit
23a06f9568
2 changed files with 46 additions and 5 deletions
28
python-urllib3-accept-header-for-proxy.patch
Normal file
28
python-urllib3-accept-header-for-proxy.patch
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
From ea36acfc8a997a19ba1ead58de0d1f01e9eb540f Mon Sep 17 00:00:00 2001
|
||||
From: kevin <kevinbjiang@gmail.com>
|
||||
Date: Thu, 30 Aug 2012 00:14:12 -0400
|
||||
Subject: [PATCH 1/4] Fix overwritten Accept header when proxy is used
|
||||
|
||||
When a request specifies both an Accept header and a proxy server, the
|
||||
Accept header value is overwritten.
|
||||
---
|
||||
urllib3/poolmanager.py | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/urllib3/poolmanager.py b/urllib3/poolmanager.py
|
||||
index 8f5b54c..7d7d6e4 100644
|
||||
--- a/urllib3/poolmanager.py
|
||||
+++ b/urllib3/poolmanager.py
|
||||
@@ -141,7 +141,8 @@ def _set_proxy_headers(self, headers=None):
|
||||
headers = headers or {}
|
||||
|
||||
# Same headers are curl passes for --proxy1.0
|
||||
- headers['Accept'] = '*/*'
|
||||
+ if 'Accept' not in headers:
|
||||
+ headers['Accept'] = '*/*'
|
||||
headers['Proxy-Connection'] = 'Keep-Alive'
|
||||
|
||||
return headers
|
||||
--
|
||||
1.7.10
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue