summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-02-11 00:39:14 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-02-11 00:39:14 (GMT)
commitb353c12a9caa20e90466af6a8f17a227b72e4f23 (patch)
tree324c9dde570196bd47044f262e7387aef652919a /Lib/urllib
parent651453ace09e6677d8fea66d3cbbf8614b109f16 (diff)
downloadcpython-b353c12a9caa20e90466af6a8f17a227b72e4f23.zip
cpython-b353c12a9caa20e90466af6a8f17a227b72e4f23.tar.gz
cpython-b353c12a9caa20e90466af6a8f17a227b72e4f23.tar.bz2
Issue #4631: Fix urlopen() result when an HTTP response uses chunked encoding.
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/request.py6
-rw-r--r--Lib/urllib/response.py3
2 files changed, 5 insertions, 4 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 63ce6d4..b86d8f2 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -333,7 +333,6 @@ class OpenerDirector:
handlers = chain.get(kind, ())
for handler in handlers:
func = getattr(handler, meth_name)
-
result = func(*args)
if result is not None:
return result
@@ -1070,7 +1069,8 @@ class AbstractHTTPHandler(BaseHandler):
except socket.error as err: # XXX what error?
raise URLError(err)
- resp = addinfourl(r.fp, r.msg, req.get_full_url())
+## resp = addinfourl(r.fp, r.msg, req.get_full_url())
+ resp = addinfourl(r, r.msg, req.get_full_url())
resp.code = r.status
resp.msg = r.reason
return resp
@@ -1606,7 +1606,7 @@ class URLopener:
# According to RFC 2616, "2xx" code indicates that the client's
# request was successfully received, understood, and accepted.
if 200 <= response.status < 300:
- return addinfourl(response.fp, response.msg, "http:" + url,
+ return addinfourl(response, response.msg, "http:" + url,
response.status)
else:
return self.http_error(
diff --git a/Lib/urllib/response.py b/Lib/urllib/response.py
index 1352622..52eeed0 100644
--- a/Lib/urllib/response.py
+++ b/Lib/urllib/response.py
@@ -17,7 +17,8 @@ class addbase(object):
self.read = self.fp.read
self.readline = self.fp.readline
# TODO(jhylton): Make sure an object with readlines() is also iterable
- if hasattr(self.fp, "readlines"): self.readlines = self.fp.readlines
+ if hasattr(self.fp, "readlines"):
+ self.readlines = self.fp.readlines
if hasattr(self.fp, "fileno"):
self.fileno = self.fp.fileno
else: