summaryrefslogtreecommitdiff
path: root/urllib3/contrib/appengine.py
diff options
context:
space:
mode:
authorAndrey Petrov <andrey.petrov@shazow.net>2015-12-29 12:28:22 -0800
committerAndrey Petrov <andrey.petrov@shazow.net>2015-12-29 12:28:22 -0800
commit27df29b1d94d6c50af1eb1bd85b4ee12adf8a3c2 (patch)
tree97731a22ac7f5344402f24ebf4f2a9039b339ef7 /urllib3/contrib/appengine.py
parent12d04b7cc8cefce176f5788485db7b0692b9adb2 (diff)
parentc3104c8c42dc8426d0ac17fdcb07d8b3126fe7b6 (diff)
downloadurllib3-1.14.tar.gz
Merging new release version: 1.141.14
Diffstat (limited to 'urllib3/contrib/appengine.py')
-rw-r--r--urllib3/contrib/appengine.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/urllib3/contrib/appengine.py b/urllib3/contrib/appengine.py
index 884cdb22..f4289c0f 100644
--- a/urllib3/contrib/appengine.py
+++ b/urllib3/contrib/appengine.py
@@ -144,7 +144,7 @@ class AppEngineManager(RequestMethods):
if retries.is_forced_retry(method, status_code=http_response.status):
retries = retries.increment(
method, url, response=http_response, _pool=self)
- log.info("Forced retry: %s" % url)
+ log.info("Forced retry: %s", url)
retries.sleep()
return self.urlopen(
method, url,
@@ -164,6 +164,14 @@ class AppEngineManager(RequestMethods):
if content_encoding == 'deflate':
del urlfetch_resp.headers['content-encoding']
+ transfer_encoding = urlfetch_resp.headers.get('transfer-encoding')
+ # We have a full response's content,
+ # so let's make sure we don't report ourselves as chunked data.
+ if transfer_encoding == 'chunked':
+ encodings = transfer_encoding.split(",")
+ encodings.remove('chunked')
+ urlfetch_resp.headers['transfer-encoding'] = ','.join(encodings)
+
return HTTPResponse(
# In order for decoding to work, we must present the content as
# a file-like object.
@@ -177,7 +185,7 @@ class AppEngineManager(RequestMethods):
if timeout is Timeout.DEFAULT_TIMEOUT:
return 5 # 5s is the default timeout for URLFetch.
if isinstance(timeout, Timeout):
- if timeout.read is not timeout.connect:
+ if timeout._read is not timeout._connect:
warnings.warn(
"URLFetch does not support granular timeout settings, "
"reverting to total timeout.", AppEnginePlatformWarning)