Jump to solution
Verify

The Fix

pip install urllib3==1.25

Based on closed urllib3/urllib3 issue #859 · PR/commit linked

Jump to Verify Open PR/Commit
@@ -4,7 +4,9 @@ Changes ------------ -* Implemented a more efficient ``HTTPResponse.__iter__()`` method (Issue #1483) +* Implemented a more efficient ``HTTPResponse.__iter__()`` method. (Issue #1483) +
repro.py
re_slash = re.compile(r'^(https?://)/*(.+)$') def hook(r, *args, **kwargs): s = r.headers.get('Location', '') m = re_slash.match(s) if m: r.headers['Location'] = ''.join(m.groups()) return r r = requests.get(url_to_retrieve, hooks={'response': hook})
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install urllib3==1.25\nWhen NOT to use: This fix is not suitable if strict adherence to RFC 3986 is required.\n\n

Why This Fix Works in Production

  • Trigger: That said, I do think we can revisit error messaging around possibly-invalid/noncompliant URLs.
  • Mechanism: The existing URL parser does not comply with the WHATWG's generous URL specification
  • Why the fix works: Adds the `rfc3986` module into `urllib3.packages` and replaces the current URL parser with the one from `rfc3986`, making it compliant with RFC 3986. (first fixed release: 1.25).
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • The existing URL parser does not comply with the WHATWG's generous URL specification
  • Production symptom (often without a traceback): That said, I do think we can revisit error messaging around possibly-invalid/noncompliant URLs.

Proof / Evidence

  • GitHub issue: #859
  • Fix PR: https://github.com/urllib3/urllib3/pull/1487
  • First fixed release: 1.25
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.95
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.67

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Some relevant issues are whatwg/url#118, whatwg/url#119, and curl/curl#791.”
@Lukasa · 2016-05-11 · source
“> it's a library that can and should expect validated input. That's not entirely true. In particular, urllib3 receives unvalidated input from servers which may…”
@Lukasa · 2016-05-11 · source
“> We can decide not to do that, but I want to make sure that we do that in full knowledge that this expectation exists.…”
@haikuginger · 2016-05-11 · source
“Are you opposed to modifying our internal parse_url to handle these cases?”
@shazow · 2016-05-11 · source

Failure Signature (Search String)

  • That said, I do think we can revisit error messaging around possibly-invalid/noncompliant URLs.
Copy-friendly signature
signature.txt
Failure Signature ----------------- That said, I do think we can revisit error messaging around possibly-invalid/noncompliant URLs.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- That said, I do think we can revisit error messaging around possibly-invalid/noncompliant URLs.

Minimal Reproduction

repro.py
re_slash = re.compile(r'^(https?://)/*(.+)$') def hook(r, *args, **kwargs): s = r.headers.get('Location', '') m = re_slash.match(s) if m: r.headers['Location'] = ''.join(m.groups()) return r r = requests.get(url_to_retrieve, hooks={'response': hook})

What Broke

Users experienced issues with URLs containing excessive slashes in redirects.

Why It Broke

The existing URL parser does not comply with the WHATWG's generous URL specification

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install urllib3==1.25

When NOT to use: This fix is not suitable if strict adherence to RFC 3986 is required.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/urllib3/urllib3/pull/1487

First fixed release: 1.25

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix is not suitable if strict adherence to RFC 3986 is required.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.

Version Compatibility Table

VersionStatus
1.25 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.