Skip to content

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

Closed
wants to merge 8 commits into from

Conversation

yairfrid
Copy link
Contributor

@yairfrid yairfrid commented Jan 9, 2021

Change code in two places, noted in two issues, to match docstring, so
is_suburi(reduce_uri('http://example.com/sub_dir/sub_dir'), reduce_uri('http://example.com/sub_dir')) is false.

https://bugs.python.org/issue42766

https://bugs.python.org/issue42878

@github-actions
Copy link

github-actions bot commented Feb 9, 2021

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Feb 9, 2021
@taleinat
Copy link
Contributor

taleinat commented Jul 6, 2021

Closing and re-opening to restart a stuck CI check.

@taleinat taleinat closed this Jul 6, 2021
@taleinat taleinat reopened this Jul 6, 2021
@terryjreedy
Copy link
Member

The Pipelines failure is a single repeated test_asyncio failure in one of the 5 sets of tests. It can be ignored.

@terryjreedy terryjreedy changed the title bpo-42766 Fixed 2 bugs in urllib.request.HTTPPasswordMgr.is_suburi and added some tests for it bpo-42766 Fix 2 bugs in urllib.request.HTTPPasswordMgr.is_suburi Jul 6, 2021
@terryjreedy terryjreedy requested a review from orsenthil July 6, 2021 21:34
Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A failing example should have been added to each of the two PRs and a clear determination made if the second is a duplicate of the first or not.

Please say when you think the PR is ready to merge.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@yairfrid
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@terryjreedy: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from terryjreedy July 12, 2021 06:46

true = self.assertTrue
false = self.assertFalse
true(is_suburi(reduce_uri('http://example.com'),
Copy link
Contributor

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.


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]):
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

@@ -0,0 +1,3 @@
Fixed 2 bugs in urllib.request.HTTPPasswordMgr.is_suburi, added some tests
Copy link
Contributor

@akulakov akulakov Feb 21, 2022

Choose a reason for hiding this comment

The 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.

@akulakov
Copy link
Contributor

It looks like this is being fixed in #31353

@serhiy-storchaka
Copy link
Member

This PR was good in general, but this issue has been solved in #31353.

Few minor issues with this PR:

  1. Using posixpath.commonpath() may look more general, supporting patches with duplicated slashes, but actually it is not, because they'll do not pass test len(common) == len(base[1]).
  2. Private function is_suburi() is used in tests. bpo-46756: Fix authorization check in urllib.request #31353 tests use only public API.

It would be easy to address these comments, but an alternate PR was already written. In any case thank you. See for your future PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting change review stale Stale PR or inactive for long period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants