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

Wrap BaseSSLError into SSLError during response reads #1939

Merged
merged 2 commits into from Aug 31, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/urllib3/response.py
Expand Up @@ -22,6 +22,7 @@
InvalidChunkLength,
InvalidHeader,
HTTPError,
SSLError,
)
from .packages.six import string_types as basestring, PY3
from .connection import HTTPException, BaseSSLError
Expand Down Expand Up @@ -443,9 +444,8 @@ def _error_catcher(self):
except BaseSSLError as e:
# FIXME: Is there a better way to differentiate between SSLErrors?
if "read operation timed out" not in str(e): # Defensive:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove that Defensive pragma? Without that, I think we won't get coverage information for that condition.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I'll remove that :) Nice catch!

# This shouldn't happen but just in case we're missing an edge
# case, let's avoid swallowing SSL errors.
raise
# SSL errors related to framing/MAC get wrapped and reraised here
raise SSLError(e)

raise ReadTimeoutError(self._pool, None, "Read timed out.")

Expand Down