-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A URL with excess leading / (path-separator)s would cause urllib3 to attempt to reparse the request-uri as a full URI with a host and port. This bypasses that logic in ConnectionPool.urlopen by replacing these leading /s with just a single /. Closes #6643
- Loading branch information
1 parent
7a13c04
commit 57e8c3b
Showing
2 changed files
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import requests.adapters | ||
|
||
|
||
def test_request_url_trims_leading_path_separators(): | ||
"""See also https://github.com/psf/requests/issues/6643.""" | ||
a = requests.adapters.HTTPAdapter() | ||
p = requests.Request(method="GET", url="http://127.0.0.1:10000//v:h").prepare() | ||
assert "/v:h" == a.request_url(p, {}) |