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

Fix HTTPSConnection/HTTPConnection reuse unapplied socket timeout bug #2645 #2646

Closed

Conversation

Ryangwaite
Copy link

Fixes #2645

When making an HTTP(s) request to a host for which a connection has
already been established, this connection is reused however the timeout
provided is only applied to the HTTPSConnection/HTTPConnection object
but not it's underlying socket (the original requests timeout remains).
Therefore, if the initial request has a short timeout and a subsequent
request is initiated that happens to take more time than the initial,
the following error will be raised in accordance with the original
requests timeout:

     urllib3.exceptions.ProtocolError: ('Connection aborted.', TimeoutError('The write operation timed out'))

This commit fixes this be applying the timeout to the underlying socket.

Note this bug applied to HTTPConnections and HTTPSConnections using the
stdlib SSLContext backend but not HTTPSConnections using the PyOpenSSLContext
backend.
@Ryangwaite Ryangwaite force-pushed the fix-initial-conn-timeout-persists branch from 67252fd to 7417026 Compare June 20, 2022 06:26
@sethmlarson
Copy link
Member

Thank you for submitting this bug, I've created #2792 which I'm closing this as a duplicate of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connect timeout does not apply to underlying socket when reusing a connection from the pool
2 participants