mirror of
https://github.com/python/cpython.git
synced 2025-11-11 22:55:08 +00:00
#17460: Remove the strict argument of HTTPConnection and removing the
DeprecationWarning being issued from 3.2 onwards.
This commit is contained in:
parent
aad1d87339
commit
052ddb01b3
3 changed files with 14 additions and 32 deletions
|
|
@ -27,7 +27,7 @@ HTTPS protocols. It is normally not used directly --- the module
|
||||||
The module provides the following classes:
|
The module provides the following classes:
|
||||||
|
|
||||||
|
|
||||||
.. class:: HTTPConnection(host, port=None[, strict][, timeout], \
|
.. class:: HTTPConnection(host, port=None[, timeout], \
|
||||||
source_address=None)
|
source_address=None)
|
||||||
|
|
||||||
An :class:`HTTPConnection` instance represents one transaction with an HTTP
|
An :class:`HTTPConnection` instance represents one transaction with an HTTP
|
||||||
|
|
@ -51,13 +51,9 @@ The module provides the following classes:
|
||||||
.. versionchanged:: 3.2
|
.. versionchanged:: 3.2
|
||||||
*source_address* was added.
|
*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, \
|
.. class:: HTTPSConnection(host, port=None, key_file=None, \
|
||||||
cert_file=None[, strict][, timeout], \
|
cert_file=None[, timeout], \
|
||||||
source_address=None, *, context=None, \
|
source_address=None, *, context=None, \
|
||||||
check_hostname=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,
|
This class now supports HTTPS virtual hosts if possible (that is,
|
||||||
if :data:`ssl.HAS_SNI` is true).
|
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, method=None, url=None)
|
||||||
.. class:: HTTPResponse(sock, debuglevel=0[, strict], method=None, url=None)
|
|
||||||
|
|
||||||
Class whose instances are returned upon successful connection. Not
|
Class whose instances are returned upon successful connection. Not
|
||||||
instantiated directly by user.
|
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:
|
The following exceptions are raised as appropriate:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -267,8 +267,6 @@ def parse_headers(fp, _class=HTTPMessage):
|
||||||
return email.parser.Parser(_class=_class).parsestr(hstring)
|
return email.parser.Parser(_class=_class).parsestr(hstring)
|
||||||
|
|
||||||
|
|
||||||
_strict_sentinel = object()
|
|
||||||
|
|
||||||
class HTTPResponse(io.RawIOBase):
|
class HTTPResponse(io.RawIOBase):
|
||||||
|
|
||||||
# See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details.
|
# 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
|
# text following RFC 2047. The basic status line parsing only
|
||||||
# accepts iso-8859-1.
|
# 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
|
# If the response includes a content-length header, we need to
|
||||||
# make sure that the client doesn't read more than the
|
# make sure that the client doesn't read more than the
|
||||||
# specified number of bytes. If it does, it will block until
|
# 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.
|
# clients unless they know what they are doing.
|
||||||
self.fp = sock.makefile("rb")
|
self.fp = sock.makefile("rb")
|
||||||
self.debuglevel = debuglevel
|
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
|
self._method = method
|
||||||
|
|
||||||
# The HTTPResponse object is returned via urllib. The clients
|
# The HTTPResponse object is returned via urllib. The clients
|
||||||
|
|
@ -737,12 +731,8 @@ class HTTPConnection:
|
||||||
# as a reasonable estimate of the maximum MSS.
|
# as a reasonable estimate of the maximum MSS.
|
||||||
mss = 16384
|
mss = 16384
|
||||||
|
|
||||||
def __init__(self, host, port=None, strict=_strict_sentinel,
|
def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
|
||||||
timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None):
|
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)
|
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.source_address = source_address
|
self.source_address = source_address
|
||||||
self.sock = None
|
self.sock = None
|
||||||
|
|
@ -1177,9 +1167,10 @@ else:
|
||||||
# XXX Should key_file and cert_file be deprecated in favour of context?
|
# 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,
|
def __init__(self, host, port=None, key_file=None, cert_file=None,
|
||||||
strict=_strict_sentinel, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
|
timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
|
||||||
source_address=None, *, context=None, check_hostname=None):
|
source_address=None, *, context=None,
|
||||||
super(HTTPSConnection, self).__init__(host, port, strict, timeout,
|
check_hostname=None):
|
||||||
|
super(HTTPSConnection, self).__init__(host, port, timeout,
|
||||||
source_address)
|
source_address)
|
||||||
self.key_file = key_file
|
self.key_file = key_file
|
||||||
self.cert_file = cert_file
|
self.cert_file = cert_file
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,10 @@ Core and Builtins
|
||||||
Library
|
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
|
- Issue #16389: Fixed a performance regression relative to Python 3.1 in the
|
||||||
caching of compiled regular expressions.
|
caching of compiled regular expressions.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue