Skip to content
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

urllib: no_proxy variable values with leading dot not properly handled #73328

Closed
tloetzer mannequin opened this issue Jan 3, 2017 · 10 comments
Closed

urllib: no_proxy variable values with leading dot not properly handled #73328

tloetzer mannequin opened this issue Jan 3, 2017 · 10 comments
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@tloetzer
Copy link
Mannequin

tloetzer mannequin commented Jan 3, 2017

BPO 29142
Nosy @berkerpeksag, @vadmium, @zvyn, @zhangyangyu
PRs
  • curses: use tempfile.TemporaryFile for get/putwin #53
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • ignore_dots-v1.patch
  • ignore_dots-v2.patch: removed unitended refactoring
  • ignore_dots-v3.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/zhangyangyu'
    closed_at = <Date 2017-01-09.05:37:34.866>
    created_at = <Date 2017-01-03.14:09:49.099>
    labels = ['3.7', 'type-bug', 'library']
    title = 'urllib: no_proxy variable values with leading dot not properly handled'
    updated_at = <Date 2017-03-31.16:36:22.740>
    user = 'https://bugs.python.org/tloetzer'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:22.740>
    actor = 'dstufft'
    assignee = 'xiang.zhang'
    closed = True
    closed_date = <Date 2017-01-09.05:37:34.866>
    closer = 'xiang.zhang'
    components = ['Library (Lib)']
    creation = <Date 2017-01-03.14:09:49.099>
    creator = 'tloetzer'
    dependencies = []
    files = ['46154', '46168', '46207']
    hgrepos = []
    issue_num = 29142
    keywords = ['patch']
    message_count = 10.0
    messages = ['284565', '284702', '284705', '284714', '284717', '284811', '284967', '285016', '285019', '285023']
    nosy_count = 6.0
    nosy_names = ['python-dev', 'berker.peksag', 'martin.panter', 'zvyn', 'xiang.zhang', 'tloetzer']
    pr_nums = ['53', '552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue29142'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7']

    @tloetzer
    Copy link
    Mannequin Author

    tloetzer mannequin commented Jan 3, 2017

    Hi,

    the fix for bpo-26864 changed the behavior of urllib for no_proxy values with a leading dot to no longer match anything. This seems to be caused by always adding an additional dot between the hostname being checked and the entry.

    Example:
    no_proxy = '.company.internal'

    I would expect 'somehost.company.internal' to be accessed without proxy, but this is not actually the case. Changing no_proxy to company.internal changes this and the host is accessed without proxy.

    Python 2.7.11 and curl both handle this case fine and the proxy is not used.

    Regards,
    Thomas

    @tloetzer tloetzer mannequin added the stdlib Python modules in the Lib dir label Jan 3, 2017
    @zvyn
    Copy link
    Mannequin

    zvyn mannequin commented Jan 5, 2017

    I added a line stripping dots from name, I think it makes sense to strip at the end as well (example.com is the same domain as example.com.).

    @berkerpeksag
    Copy link
    Member

    Note: We don't officially use pull requests yet. Current way of contributing to Python is documented at https://docs.python.org/devguide/patch.html

    @zvyn
    Copy link
    Mannequin

    zvyn mannequin commented Jan 5, 2017

    Too bad, I was all exited when I saw that I can paste a PR link here :)

    I downloaded the patch from the commit using github, I hope that works?

    @berkerpeksag
    Copy link
    Member

    Yes, thanks!

    @berkerpeksag berkerpeksag added 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error labels Jan 5, 2017
    @zvyn zvyn mannequin removed 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error labels Jan 5, 2017
    @berkerpeksag berkerpeksag added 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error labels Jan 6, 2017
    @zhangyangyu
    Copy link
    Member

    I think it makes sense to strip at the end as well (example.com is the same domain as example.com.).

    Are your sure the host checked against the list is FQDN? With and without the trailing dot are different.

    @zvyn
    Copy link
    Mannequin

    zvyn mannequin commented Jan 8, 2017

    Thanks for the feedback!

    I changed the patch to use lstrip so that the FQDN "example.com." would match the NOPROXY entry "example.com.". I don't think we get FQDNs, but that's just my guess.

    I think ideally "example.com" would also match "example.com." but that's a different issue.

    @zhangyangyu
    Copy link
    Member

    LGTM.

    @zhangyangyu zhangyangyu self-assigned this Jan 9, 2017
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 9, 2017

    New changeset cb4f73be9486 by Xiang Zhang in branch '2.7':
    Issue bpo-29142: Fix suffixes in no_proxy handling in urllib.
    https://hg.python.org/cpython/rev/cb4f73be9486

    New changeset 350c5a1f9cfd by Xiang Zhang in branch '3.5':
    Issue bpo-29142: Fix suffixes in no_proxy handling in urllib.
    https://hg.python.org/cpython/rev/350c5a1f9cfd

    New changeset e90efd9f203e by Xiang Zhang in branch '3.6':
    Issue bpo-29142: Merge 3.5.
    https://hg.python.org/cpython/rev/e90efd9f203e

    New changeset 3954f8f6be3d by Xiang Zhang in branch 'default':
    Issue bpo-29142: Merge 3.6.
    https://hg.python.org/cpython/rev/3954f8f6be3d

    @zhangyangyu
    Copy link
    Member

    Thanks Milan and Thomas!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants