[Python-checkins] cpython (2.7): Issue #22450: Use "Accept: */*" in the default headers for urllib
raymond.hettinger
python-checkins at python.org
Fri Sep 9 19:24:33 EDT 2016
https://hg.python.org/cpython/rev/e84105b48436
changeset: 103499:e84105b48436
branch: 2.7
parent: 103443:951f0de11a01
user: Raymond Hettinger <python at rcn.com>
date: Fri Sep 09 16:23:06 2016 -0700
summary:
Issue #22450: Use "Accept: */*" in the default headers for urllib
files:
Lib/urllib.py | 2 +-
Misc/NEWS | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Lib/urllib.py b/Lib/urllib.py
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -138,7 +138,7 @@
self.key_file = x509.get('key_file')
self.cert_file = x509.get('cert_file')
self.context = context
- self.addheaders = [('User-Agent', self.version)]
+ self.addheaders = [('User-Agent', self.version), ('Accept', '*/*')]
self.__tempfiles = []
self.__unlink = os.unlink # See cleanup()
self.tempcache = None
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -47,6 +47,10 @@
- Issue #27570: Avoid zero-length memcpy() etc calls with null source
pointers in the "ctypes" and "array" modules.
+- Issue #22450: urllib now includes an "Accept: */*" header among the
+ default headers. This makes the results of REST API requests more
+ consistent and predictable especially when proxy servers are involved.
+
- lib2to3.pgen3.driver.load_grammar() now creates a stable cache file
between runs given the same Grammar.txt input regardless of the hash
randomization setting.
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list