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

SimpleHTTPServer doesn't understand // at beginning of path anymore #45565

Closed
philfr mannequin opened this issue Oct 1, 2007 · 4 comments
Closed

SimpleHTTPServer doesn't understand // at beginning of path anymore #45565

philfr mannequin opened this issue Oct 1, 2007 · 4 comments
Assignees
Labels
easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@philfr
Copy link
Mannequin

philfr mannequin commented Oct 1, 2007

BPO 1224
Nosy @facundobatista
Files
  • 1224.diff
  • 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/facundobatista'
    closed_at = <Date 2008-02-18.12:49:23.083>
    created_at = <Date 2007-10-01.11:20:26.323>
    labels = ['easy', 'type-bug', 'library']
    title = "SimpleHTTPServer doesn't understand // at beginning of path anymore"
    updated_at = <Date 2008-02-18.12:49:23.081>
    user = 'https://bugs.python.org/philfr'

    bugs.python.org fields:

    activity = <Date 2008-02-18.12:49:23.081>
    actor = 'facundobatista'
    assignee = 'facundobatista'
    closed = True
    closed_date = <Date 2008-02-18.12:49:23.083>
    closer = 'facundobatista'
    components = ['Library (Lib)']
    creation = <Date 2007-10-01.11:20:26.323>
    creator = 'philfr'
    dependencies = []
    files = ['9451']
    hgrepos = []
    issue_num = 1224
    keywords = ['easy']
    message_count = 4.0
    messages = ['56205', '56207', '62504', '62525']
    nosy_count = 3.0
    nosy_names = ['facundobatista', 'philfr', 'elachuni']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue1224'
    versions = ['Python 2.6', 'Python 2.5']

    @philfr
    Copy link
    Mannequin Author

    philfr mannequin commented Oct 1, 2007

    The fix to bpo-1394565 introduces a nasty side-effect:
    "GET http://server//file" (with two /s) does not work anymore. It
    returns the directory index instead.

    This is because urlparse is not applied to an URL, but to its right-hand
    part starting at the path.

    urlparse.urlparse("http://server//foo")[2] correctly returns //foo, but
    urlparse.urlparse("//foo")[2] (as used in this library) returns an empty
    string.

    @philfr philfr mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 1, 2007
    @philfr
    Copy link
    Mannequin Author

    philfr mannequin commented Oct 1, 2007

    May I suggest replacing the

         path = urlparse.urlparse(path)[2]

    line with the following two:

         path = path.split('?',1)[0]
         path = path.split('#',1)[0]

    thereby handling parameters as well as fragments.

    @tiran tiran added the easy label Jan 20, 2008
    @elachuni
    Copy link
    Mannequin

    elachuni mannequin commented Feb 17, 2008

    Attached is an diff against trunk that adds philfr's suggesitions. I've
    also added a test file for testing url parsing, so's these things stay
    fixed. Updated Misc/NEWS. No doc or functionallity modified.

    @facundobatista facundobatista self-assigned this Feb 18, 2008
    @facundobatista
    Copy link
    Member

    Fixed in r60885. Thanks everybody!

    @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
    easy 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