requests
requests copied to clipboard
Normalized double slashes in digest auth URI to match request path
Fixes #6784
Summary
- Normalizes double slashes in digest auth URI to match the request path normalization done in
HTTPAdapter.request_url().
Changes
- Added path normalization in
build_digest_header()insrc/requests/auth.py - Added regression test
test_DIGEST_AUTH_NORMALIZES_DOUBLE_SLASH_PATH
Problem
- When a URL contains double slashes (e.g.,
http://example.com//path), the actual HTTP request path gets normalized to/path, but the digest auth header was using//path. This mismatch caused authentication failures (400 Bad Request).
Solution
- Apply the same normalization to the path used in digest auth headers.