python-urllib3/python-urllib3-accept-header-for-proxy.patch

29 lines
915 B
Diff

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