diff --git a/src/requests/utils.py b/src/requests/utils.py index fff6edf4be..4439dfe989 100644 --- a/src/requests/utils.py +++ b/src/requests/utils.py @@ -988,7 +988,7 @@ def parse_header_links(value: str) -> list[dict[str, str]]: for param in params.split(";"): try: - key, value = param.split("=") + key, value = param.split("=", 1) except ValueError: break diff --git a/tests/test_utils.py b/tests/test_utils.py index 091a9fd6f3..9bc5843f02 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -690,6 +690,12 @@ def test_iter_slices(value, length): {"url": "http://.../back.jpeg"}, ], ), + ( + # A quoted parameter value may itself contain "=" (RFC 8288); + # it must be kept and must not drop the parameters after it. + '; title="a=b"; rel="next"', + [{"url": "http:/.../front.jpeg", "title": "a=b", "rel": "next"}], + ), ("", []), ), )