mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
This contains a number of things:
1) Improve the documentation of the SSL module, with a fuller explanation of certificate usage, another reference, proper formatting of this and that. 2) Fix Windows bug in ssl.py, and general bug in sslsocket.close(). Remove some unused code from ssl.py. Allow accept() to be called on sslsocket sockets. 3) Use try-except-else in import of ssl in socket.py. Deprecate use of socket.ssl(). 4) Remove use of socket.ssl() in every library module, except for test_socket_ssl.py and test_ssl.py.
This commit is contained in:
parent
492e5920bc
commit
426ea0a864
9 changed files with 486 additions and 608 deletions
|
@ -91,6 +91,14 @@ def urlcleanup():
|
|||
if _urlopener:
|
||||
_urlopener.cleanup()
|
||||
|
||||
# check for SSL
|
||||
try:
|
||||
import ssl
|
||||
except:
|
||||
_have_ssl = False
|
||||
else:
|
||||
_have_ssl = True
|
||||
|
||||
# exception raised when downloaded size does not match content-length
|
||||
class ContentTooShortError(IOError):
|
||||
def __init__(self, message, content):
|
||||
|
@ -361,9 +369,10 @@ class URLopener:
|
|||
fp.close()
|
||||
raise IOError, ('http error', errcode, errmsg, headers)
|
||||
|
||||
if hasattr(socket, "ssl"):
|
||||
if _have_ssl:
|
||||
def open_https(self, url, data=None):
|
||||
"""Use HTTPS protocol."""
|
||||
|
||||
import httplib
|
||||
user_passwd = None
|
||||
proxy_passwd = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue