From 052ddb01b37287c43ef595f6c8381a5eeb1dcb79 Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Mon, 18 Mar 2013 14:11:41 -0700 Subject: [PATCH] #17460: Remove the strict argument of HTTPConnection and removing the DeprecationWarning being issued from 3.2 onwards. --- Doc/library/http.client.rst | 18 +++--------------- Lib/http/client.py | 23 +++++++---------------- Misc/NEWS | 5 ++++- 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 2d93aa47c3..c4c76172b4 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -27,7 +27,7 @@ HTTPS protocols. It is normally not used directly --- the module The module provides the following classes: -.. class:: HTTPConnection(host, port=None[, strict][, timeout], \ +.. class:: HTTPConnection(host, port=None[, timeout], \ source_address=None) An :class:`HTTPConnection` instance represents one transaction with an HTTP @@ -51,13 +51,9 @@ The module provides the following classes: .. versionchanged:: 3.2 *source_address* was added. - .. versionchanged:: 3.2 - The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" - are not supported anymore. - .. class:: HTTPSConnection(host, port=None, key_file=None, \ - cert_file=None[, strict][, timeout], \ + cert_file=None[, timeout], \ source_address=None, *, context=None, \ check_hostname=None) @@ -89,20 +85,12 @@ The module provides the following classes: This class now supports HTTPS virtual hosts if possible (that is, if :data:`ssl.HAS_SNI` is true). - .. versionchanged:: 3.2 - The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" - are not supported anymore. - -.. class:: HTTPResponse(sock, debuglevel=0[, strict], method=None, url=None) +.. class:: HTTPResponse(sock, debuglevel=0, method=None, url=None) Class whose instances are returned upon successful connection. Not instantiated directly by user. - .. versionchanged:: 3.2 - The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" - are not supported anymore. - The following exceptions are raised as appropriate: diff --git a/Lib/http/client.py b/Lib/http/client.py index ba7d6fc38c..08311d7bb8 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -267,8 +267,6 @@ def parse_headers(fp, _class=HTTPMessage): return email.parser.Parser(_class=_class).parsestr(hstring) -_strict_sentinel = object() - class HTTPResponse(io.RawIOBase): # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. @@ -278,7 +276,7 @@ class HTTPResponse(io.RawIOBase): # text following RFC 2047. The basic status line parsing only # accepts iso-8859-1. - def __init__(self, sock, debuglevel=0, strict=_strict_sentinel, method=None, url=None): + def __init__(self, sock, debuglevel=0, method=None, url=None): # If the response includes a content-length header, we need to # make sure that the client doesn't read more than the # specified number of bytes. If it does, it will block until @@ -288,10 +286,6 @@ class HTTPResponse(io.RawIOBase): # clients unless they know what they are doing. self.fp = sock.makefile("rb") self.debuglevel = debuglevel - if strict is not _strict_sentinel: - warnings.warn("the 'strict' argument isn't supported anymore; " - "http.client now always assumes HTTP/1.x compliant servers.", - DeprecationWarning, 2) self._method = method # The HTTPResponse object is returned via urllib. The clients @@ -737,12 +731,8 @@ class HTTPConnection: # as a reasonable estimate of the maximum MSS. mss = 16384 - def __init__(self, host, port=None, strict=_strict_sentinel, - timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None): - if strict is not _strict_sentinel: - warnings.warn("the 'strict' argument isn't supported anymore; " - "http.client now always assumes HTTP/1.x compliant servers.", - DeprecationWarning, 2) + def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, + source_address=None): self.timeout = timeout self.source_address = source_address self.sock = None @@ -1177,9 +1167,10 @@ else: # XXX Should key_file and cert_file be deprecated in favour of context? def __init__(self, host, port=None, key_file=None, cert_file=None, - strict=_strict_sentinel, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, - source_address=None, *, context=None, check_hostname=None): - super(HTTPSConnection, self).__init__(host, port, strict, timeout, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT, + source_address=None, *, context=None, + check_hostname=None): + super(HTTPSConnection, self).__init__(host, port, timeout, source_address) self.key_file = key_file self.cert_file = cert_file diff --git a/Misc/NEWS b/Misc/NEWS index ad321f593f..1f3c68a646 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -287,7 +287,10 @@ Core and Builtins Library ------- -Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. +- Issue #17460: Remove the strict argument of HTTPConnection and removing the + DeprecationWarning being issued from 3.2 onwards. + +- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. - Issue #16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. -- 2.40.0