Skip to content
Myr

Merge pull request #6028 from nateprewitt/prox_auth_fix

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix auth parsing for proxies

authored by Ian Stapleton Cordasco · committed by GitHub · parents 0192aac, 38f3f8e · Browse files · 2 files+12 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−0 removed

  • tests:+8 added−0 removed
  • other:+4 added−0 removed

2 files+12 added−0 removed

modified:requests/utils.py+4 added
972 unmodified lines
973 netloc = parsed.netloc974 if not netloc:975 netloc, path = path, netloc976977 if auth:978 # parse_url doesn't provide the netloc with auth979 # so we'll add it ourselves.980 netloc = '@'.join([auth, netloc])981 if scheme is None:982 scheme = new_scheme983 if path is None:984 path = ''
76 unmodified lines
modified:tests/test_utils.py+8 added
600 unmodified lines
601 'value, expected', (602 ('example.com/path', 'http://example.com/path'),603 ('//example.com/path', 'http://example.com/path'),604 ('example.com:80', 'http://example.com:80'),605 (606 'http://user:pass@example.com/path?query',607 'http://user:pass@example.com/path?query'608 ),609 (610 'http://user@example.com/path?query',611 'http://user@example.com/path?query'612 )613 ))614def test_prepend_scheme_if_needed(value, expected):615 assert prepend_scheme_if_needed(value, 'http') == expected616
193 unmodified lines