Jump to solution
Verify

The Fix

pip install requests==2.27.0

Based on closed psf/requests issue #6030 · PR/commit linked

Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.

Jump to Verify Open PR/Commit
@@ -21,6 +21,7 @@ from collections import OrderedDict from urllib3.util import make_headers +from urllib3.util import parse_url from .__version__ import __version__
repro.py
{ "chardet": { "version": null }, "charset_normalizer": { "version": "2.0.9" }, "cryptography": { "version": "36.0.1" }, "idna": { "version": "3.3" }, "implementation": { "name": "CPython", "version": "3.9.9" }, "platform": { "release": "5.14.21-2-MANJARO", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "101010df", "version": "21.0.0" }, "requests": { "version": "2.27.0" }, "system_ssl": { "version": "101010df" }, "urllib3": { "version": "1.26.7" }, "using_charset_normalizer": true, "using_pyopenssl": true }
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 requests==2.27.0\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n

Why This Fix Works in Production

  • Trigger: parsing of proxy url broken with requests 2.27.0
  • Mechanism: Fixes the proxy URL parsing issue introduced in version 2.27.0 by changing the parsing method used in the `prepend_scheme_if_needed` function.
  • Why the fix works: Fixes the proxy URL parsing issue introduced in version 2.27.0 by changing the parsing method used in the `prepend_scheme_if_needed` function. (first fixed release: 2.27.0).
Production impact:
  • If left unfixed, retries/timeouts can trigger duplicate external side-effects (double charges, duplicate emails, repeated writes).

Why This Breaks in Prod

  • Production symptom (often without a traceback): parsing of proxy url broken with requests 2.27.0

Proof / Evidence

  • GitHub issue: #6030
  • Fix PR: https://github.com/psf/requests/pull/5917
  • First fixed release: 2.27.0
  • 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.51

Discussion

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

“Hi, @anneFly. Thanks for the report! This is actually a duplicate of #6027 which has been patched in #6028 and will be released sometime today.…”
@nateprewitt · 2022-01-05 · confirmation · source

Failure Signature (Search String)

  • parsing of proxy url broken with requests 2.27.0
  • It seems like this change https://github.com/psf/requests/pull/5917 unfortunately broke production for us.
Copy-friendly signature
signature.txt
Failure Signature ----------------- parsing of proxy url broken with requests 2.27.0 It seems like this change https://github.com/psf/requests/pull/5917 unfortunately broke production for us.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- parsing of proxy url broken with requests 2.27.0 It seems like this change https://github.com/psf/requests/pull/5917 unfortunately broke production for us.

Minimal Reproduction

repro.py
{ "chardet": { "version": null }, "charset_normalizer": { "version": "2.0.9" }, "cryptography": { "version": "36.0.1" }, "idna": { "version": "3.3" }, "implementation": { "name": "CPython", "version": "3.9.9" }, "platform": { "release": "5.14.21-2-MANJARO", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "101010df", "version": "21.0.0" }, "requests": { "version": "2.27.0" }, "system_ssl": { "version": "101010df" }, "urllib3": { "version": "1.26.7" }, "using_charset_normalizer": true, "using_pyopenssl": true }

What Broke

This change caused ProxyError due to incorrect URL parsing, leading to connection failures.

Fix Options (Details)

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

pip install requests==2.27.0

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

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

Fix reference: https://github.com/psf/requests/pull/5917

First fixed release: 2.27.0

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

  • Do not use if it changes public behavior or if the failure cannot be reproduced.

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 TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
  • Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.

Version Compatibility Table

VersionStatus
2.27.0 Fixed

Related Issues

No related fixes found.

Sources

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