Jump to solution
Details

The Fix

pip install requests==2.27.0

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

Open PR/Commit
@@ -567,7 +567,7 @@ def parse_header_links(value): replace_chars = " '\"" - for val in value.split(","): + for val in re.split(", *<", value): try:
fix.md
Option A — Upgrade to fixed release\npip install requests==2.27.0\nWhen NOT to use: This fix should not be applied if the link headers do not conform to RFC 5988.\n\n

Why This Fix Works in Production

  • Trigger: Link header parsing breaks if attribute value has commas
  • Mechanism: The parse_header_links function fails to correctly handle commas in attribute values of link headers
  • Why the fix works: Fixes the link header parsing issue by modifying the split logic to correctly handle commas in attribute values. (first fixed release: 2.27.0).
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 parse_header_links function fails to correctly handle commas in attribute values of link headers
  • Production symptom (often without a traceback): Link header parsing breaks if attribute value has commas

Proof / Evidence

  • GitHub issue: #2250
  • Fix PR: https://github.com/psf/requests/pull/2271
  • First fixed release: 2.27.0
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-07
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.74

Discussion

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

“Yeah, we're aware of this and have had an open issue in the past for it. It's not high-priority work for us, so I'm tagging…”
@Lukasa · 2014-09-25 · source
“@hariharshankar if you can solve the sole issue here without also addressing #1980 that will be fine”
@sigmavirus24 · 2014-09-26 · source
“Simple fix: change the line: for val in value.split(","): to: for val in re.split(",\ *<",value): I have tested this on the given cases with success”
@mikecool1000 · 2014-10-09 · source
“Actually your bug report is inaccurate and a bit misleading”
@sigmavirus24 · 2014-09-26 · source

Failure Signature (Search String)

  • Link header parsing breaks if attribute value has commas
  • The function parse_header_links does not parse link headers correctly if the attribute value for a link has commas or semi-colons in them.
Copy-friendly signature
signature.txt
Failure Signature ----------------- Link header parsing breaks if attribute value has commas The function parse_header_links does not parse link headers correctly if the attribute value for a link has commas or semi-colons in them.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Link header parsing breaks if attribute value has commas The function parse_header_links does not parse link headers correctly if the attribute value for a link has commas or semi-colons in them.

What Broke

Link headers with commas lead to incorrect parsing and missing links in responses.

Why It Broke

The parse_header_links function fails to correctly handle commas in attribute values of link headers

Fix Options (Details)

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

pip install requests==2.27.0

When NOT to use: This fix should not be applied if the link headers do not conform to RFC 5988.

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/2271

First fixed release: 2.27.0

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

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be applied if the link headers do not conform to RFC 5988.

Did This Fix Work in Your Case?

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

Prevention

  • Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
  • Pin production dependencies and upgrade only with a reproducible test that hits the failing path.

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.