fix: prevent crash on non-requests exceptions in get_response - #3082
Open
Luka-codeur wants to merge 1 commit into
Open
Luka-codeur wants to merge 1 commit into
Luka-codeur wants to merge 1 commit into
Conversation
Usernames ending in a period (e.g. "alice.") combined with a subdomain-interpolated site URL can produce a malformed host such as "alice..example.com". urllib3 raises LocationParseError for this, which is not a requests.exceptions.RequestException subclass, so it was previously uncaught and crashed the entire run instead of just failing that one site. Add a catch-all Exception handler in get_response so any such error is reported as an Unknown status for that site, consistent with how other connection failures are already handled. Fixes sherlock-project#2970
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
alice.) combined with a subdomain-interpolated site URL (e.g.https://{}.empretienda.com.ar) can produce a malformed host such asalice..empretienda.com.ar.urllib3raisesLocationParseErrorfor this, which is not arequests.exceptions.RequestExceptionsubclass, so it was previously uncaught inget_responseand crashed the entire run instead of just failing that one site.Exceptionhandler inget_responseso any such error is reported as anUnknownstatus for that site only, consistent with how other connection failures (ConnectionError,Timeout, etc.) are already handled.Fixes #2970
Test plan
tests/test_get_response.py: unit tests forget_responsecovering a knownrequestsexception (existing behavior) and a non-requestsexception (LocationParseError, the regression case).Empretienda AR, which has noregexCheck) with usernamealice.— confirmed it now reportsUnknowninstead of crashing.pytest -m "not online").