Skip to content

fix: prevent crash on non-requests exceptions in get_response - #3082

Open
Luka-codeur wants to merge 1 commit into
sherlock-project:masterfrom
Luka-codeur:fix/2970-crash-trailing-period-username
Open

Luka-codeur wants to merge 1 commit into
sherlock-project:masterfrom
Luka-codeur:fix/2970-crash-trailing-period-username

Conversation

@Luka-codeur

Copy link
Copy Markdown

Summary

  • Usernames ending in a period (e.g. alice.) combined with a subdomain-interpolated site URL (e.g. https://{}.empretienda.com.ar) can produce a malformed host such as alice..empretienda.com.ar.
  • urllib3 raises LocationParseError for this, which is not a requests.exceptions.RequestException subclass, so it was previously uncaught in get_response and crashed the entire run instead of just failing that one site.
  • Added a catch-all Exception handler in get_response so any such error is reported as an Unknown status for that site only, consistent with how other connection failures (ConnectionError, Timeout, etc.) are already handled.

Fixes #2970

Test plan

  • Added tests/test_get_response.py: unit tests for get_response covering a known requests exception (existing behavior) and a non-requests exception (LocationParseError, the regression case).
  • Reproduced the original crash end-to-end using the actual site from the reported traceback (Empretienda AR, which has no regexCheck) with username alice. — confirmed it now reports Unknown instead of crashing.
  • Full offline test suite passes (pytest -m "not online").

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
@Luka-codeur
Luka-codeur requested a review from ppfeister as a code owner August 20, 2026 20:40
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.

Crashes when handling usernames ending in period (.)

1 participant