Skip to content

urllib2/urllib.parse.splitport does not handle IPv6 correctly #62391

Closed as not planned

Description

@jd
mannequin
BPO 18191
Nosy @vstinner, @dhellmann, @jd, @berkerpeksag, @serhiy-storchaka
Dependencies
  • bpo-20270: urllib.parse doesn't work with empty port
  • bpo-20271: urllib.parse.urlparse() accepts wrong URLs
  • Files
  • 0001-Make-urllib.parse.splitport-handle-IPv6-correctly.patch: Patch fixing urllib.parse.splitport
  • test_urlparse.diff: Revised test for urlparse
  • urllib.diff: Revised urllib
  • 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 = None
    closed_at = None
    created_at = <Date 2013-06-11.14:44:39.479>
    labels = ['type-bug', 'library']
    title = 'urllib2/urllib.parse.splitport does not handle IPv6 correctly'
    updated_at = <Date 2014-03-07.16:23:13.722>
    user = 'https://github.com/jd'

    bugs.python.org fields:

    activity = <Date 2014-03-07.16:23:13.722>
    actor = 'vstinner'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2013-06-11.14:44:39.479>
    creator = 'jd'
    dependencies = ['20270', '20271']
    files = ['30558', '31013', '31015']
    hgrepos = []
    issue_num = 18191
    keywords = ['patch']
    message_count = 9.0
    messages = ['190968', '191027', '191040', '191041', '191042', '193546', '193548', '208157', '212891']
    nosy_count = 6.0
    nosy_names = ['vstinner', 'samwyse', 'doughellmann', 'jd', 'berker.peksag', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue18191'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

    Activity

    1. jd commented on Jun 11, 2013

      jdmannequin
      MannequinAuthor
      >>> import urllib.parse
      >>> urllib.parse.splitport("::1")
      (':', '1')

      This is obviously invalid.

    2. added
      stdlib
      on Jun 11, 2013
    3. jd commented on Jun 12, 2013

      jdmannequin
      MannequinAuthor

      Attached is a patch inspired by a function written for OpenStack Oslo library.

    4. dhellmann commented on Jun 12, 2013

      @dhellmann
      Member

      LGTM

    5. serhiy-storchaka commented on Jun 12, 2013

      @serhiy-storchaka
      Member

      I see only tests.

      It is more common to use arguments for assertEqual() in the reverse order, first actual value, and than expected value.

    6. berkerpeksag commented on Jun 12, 2013

      @berkerpeksag
      Member

      FTR, urllib.parse.splitport is undocumented and it is only used by urllib.request in the stdlib.

    7. samwyse commented on Jul 22, 2013

      samwysemannequin
      Mannequin

      Fixes Serhiy Storchaka's complaints, removes duplicate test.

    8. samwyse commented on Jul 22, 2013

      samwysemannequin
      Mannequin

      Handles "raw" IPv6 URLs

    9. serhiy-storchaka commented on Jan 15, 2014

      @serhiy-storchaka
      Member

      Julien's patch is subject to bugs described in bpo-20270 and bpo-20271. As far as OpenStack Oslo library.

    10. added
      type-bug
      on Jan 15, 2014
    11. vstinner commented on Mar 7, 2014

      @vstinner
      Member

      I posted a patch to bpo-20271 which should fix the issue. I wrote the patch for Python 3.5, but it can be adapted to be tolerant (don't make extensive tests on port number, host and IPv6) for older versions.

    12. transferred this issue fromon Apr 10, 2022
    13. serhiy-storchaka commented on Aug 20, 2024

      @serhiy-storchaka
      Member

      splitport() was deprecated in 3.8.

    14. added
      pending
      on Aug 20, 2024
    15. removed
      pending
      on Dec 2, 2024
    16. picnixz commented on Dec 2, 2024

      @picnixz
      Member

      Closing as not planned since the function is now private-only and deprecated.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions