diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 19179fdc9508ca..e3fc9446bbe09c 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -303,7 +303,7 @@ def getheaders(self, name): class MockResponse(io.StringIO): def __init__(self, code, msg, headers, data, url=None): io.StringIO.__init__(self, data) - self.code, self.msg, self.headers, self.url = code, msg, headers, url + self.status, self.msg, self.headers, self.url = code, msg, headers, url def info(self): return self.headers diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index bc35d8a80e5d03..2f1ce396e4e51d 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -212,7 +212,7 @@ def urlretrieve(url, filename=None, reporthook=None, data=None): url_type, path = _splittype(url) with contextlib.closing(urlopen(url, data)) as fp: - headers = fp.info() + headers = fp.headers # Just return the local path and the "headers" for file:// # URLs. No sense in performing a copy unless requested. @@ -596,7 +596,7 @@ class HTTPErrorProcessor(BaseHandler): handler_order = 1000 # after all other processing def http_response(self, request, response): - code, msg, hdrs = response.code, response.msg, response.info() + code, msg, hdrs = response.status, response.msg, response.headers # According to RFC 2616, "2xx" code indicates that the client's # request was successfully received, understood, and accepted. @@ -1007,7 +1007,7 @@ def http_request(self, req): def http_response(self, req, response): if hasattr(self.passwd, 'is_authenticated'): - if 200 <= response.code < 300: + if 200 <= response.status < 300: self.passwd.update_authenticated(req.full_url, True) else: self.passwd.update_authenticated(req.full_url, False) @@ -1336,8 +1336,7 @@ def do_open(self, http_class, req, **http_conn_args): # This line replaces the .msg attribute of the HTTPResponse # with .headers, because urllib clients expect the response to # have the reason in .msg. It would be good to mark this - # attribute is deprecated and get then to use info() or - # .headers. + # attribute is deprecated and get then to use .headers. r.msg = r.reason return r @@ -1789,14 +1788,14 @@ def retrieve(self, url, filename=None, reporthook=None, data=None): if filename is None and (not type or type == 'file'): try: fp = self.open_local_file(url1) - hdrs = fp.info() + hdrs = fp.headers fp.close() return url2pathname(_splithost(url1)[1]), hdrs except OSError: pass fp = self.open(url, data) try: - headers = fp.info() + headers = fp.headers if filename: tfp = open(filename, 'wb') else: diff --git a/Misc/ACKS b/Misc/ACKS index b031eb7c11f73f..129f952de6b580 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1252,6 +1252,7 @@ Dustin J. Mitchell Gideon Mitchell Tim Mitchell Zubin Mithra +Alexandr Mitin Florian Mladitsch Kevin Modzelewski Doug Moen