Issue #4631: Fix urlopen() result when an HTTP response uses chunked encoding.

This commit is contained in:
Antoine Pitrou 2009-02-11 00:39:14 +00:00
parent 651453ace0
commit b353c12a9c
9 changed files with 50 additions and 21 deletions

View file

@ -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(