-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-42766 Fix 2 bugs in urllib.request.HTTPPasswordMgr.is_suburi #24181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ca5be21
506b8f6
d72dde4
8442459
4bf0a44
cd68970
207c014
769b213
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -881,15 +881,15 @@ def reduce_uri(self, uri, default_port=True): | |
return authority, path | ||
|
||
def is_suburi(self, base, test): | ||
"""Check if test is below base in a URI tree | ||
"""Check if test is equal or below base in a URI tree | ||
|
||
Both args must be URIs in reduced form. | ||
""" | ||
if base == test: | ||
return True | ||
if base[0] != test[0]: | ||
if base[0] != test[0] or len(test[1]) < len(base[1]): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test cases pass even if this change is not included. Are you sure it's needed? |
||
return False | ||
common = posixpath.commonprefix((base[1], test[1])) | ||
common = posixpath.commonpath((base[1], test[1])) | ||
if len(common) == len(base[1]): | ||
return True | ||
return False | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Fixed 2 bugs in urllib.request.HTTPPasswordMgr.is_suburi, added some tests | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be useful to shortly describe the 2 bugs being fixed. One or two sentences should be enough. |
||
for it. :func:`urllib.request.HTTPPasswordMgr.is_suburi`. Patch by Yair | ||
Frid.` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be easier to understand the logic tested if there was a blank line between each subtest.