Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL timeouts should raise socket.timeout, not a generic SSLError #54481

Closed
pitrou opened this issue Oct 31, 2010 · 3 comments
Closed

SSL timeouts should raise socket.timeout, not a generic SSLError #54481

pitrou opened this issue Oct 31, 2010 · 3 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Oct 31, 2010

BPO 10272
Nosy @pitrou

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2010-12-03.20:00:10.681>
created_at = <Date 2010-10-31.21:43:51.887>
labels = ['type-bug', 'tests']
title = 'SSL timeouts should raise socket.timeout, not a generic SSLError'
updated_at = <Date 2010-12-03.20:00:10.679>
user = 'https://github.com/pitrou'

bugs.python.org fields:

activity = <Date 2010-12-03.20:00:10.679>
actor = 'pitrou'
assignee = 'none'
closed = True
closed_date = <Date 2010-12-03.20:00:10.681>
closer = 'pitrou'
components = ['Tests']
creation = <Date 2010-10-31.21:43:51.887>
creator = 'pitrou'
dependencies = []
files = []
hgrepos = []
issue_num = 10272
keywords = []
message_count = 3.0
messages = ['120090', '123287', '123288']
nosy_count = 1.0
nosy_names = ['pitrou']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue10272'
versions = ['Python 3.2']

@pitrou
Copy link
Member Author

pitrou commented Oct 31, 2010

The issue here is that ssl is using its own exception class rather than the socket module's "timeout" class:

test test_httplib failed -- Traceback (most recent call last):
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/test/test_httplib.py", line 408, in test_networked
    h.request('GET', '/')
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 943, in request
    self._send_request(method, url, body, headers)
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 981, in _send_request
    self.endheaders(body)
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 939, in endheaders
    self._send_output(message_body)
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 791, in _send_output
    self.send(msg)
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 737, in send
    self.connect()
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/http/client.py", line 1086, in connect
    server_hostname=server_hostname)
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/ssl.py", line 168, in wrap_socket
    _context=self)
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/ssl.py", line 254, in __init__
    raise x
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/ssl.py", line 250, in __init__
    self.do_handshake()
  File "/Users/pythonbuildbot/buildarea/3.x.hansen-osx-x86-2/build/Lib/ssl.py", line 429, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: _ssl.c:374: The handshake operation timed out

@pitrou pitrou added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Oct 31, 2010
@pitrou
Copy link
Member Author

pitrou commented Dec 3, 2010

Requalifying this issue so that the ssl module is fixed to raise socket.timeout on socket timeouts, which is not only more logical but much more useful (since you can then specifically handle this error).

@pitrou pitrou changed the title SSL handshake timeouts not caught by transient_internet SSL timeouts should raise socket.timeout, not a generic SSLError Dec 3, 2010
@pitrou
Copy link
Member Author

pitrou commented Dec 3, 2010

Committed in r86997. I won't backport it to bugfix branches since it is a small compatibility breach.

@pitrou pitrou closed this as completed Dec 3, 2010
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant