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 directory-indexing "bug" fix #39437

Closed
solomoriah mannequin opened this issue Oct 21, 2003 · 5 comments
Closed

SimpleHTTPServer directory-indexing "bug" fix #39437

solomoriah mannequin opened this issue Oct 21, 2003 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@solomoriah
Copy link
Mannequin

solomoriah mannequin commented Oct 21, 2003

BPO 827559
Nosy @loewis, @akuchling
Files
  • SimpleHTTPServer.py.patch: See body.
  • 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/akuchling'
    closed_at = <Date 2006-12-22.19:09:06.000>
    created_at = <Date 2003-10-21.14:49:46.000>
    labels = ['library']
    title = 'SimpleHTTPServer directory-indexing "bug" fix'
    updated_at = <Date 2006-12-22.19:09:06.000>
    user = 'https://bugs.python.org/solomoriah'

    bugs.python.org fields:

    activity = <Date 2006-12-22.19:09:06.000>
    actor = 'akuchling'
    assignee = 'akuchling'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2003-10-21.14:49:46.000>
    creator = 'solomoriah'
    dependencies = []
    files = ['5651']
    hgrepos = []
    issue_num = 827559
    keywords = ['patch']
    message_count = 5.0
    messages = ['44813', '44814', '44815', '44816', '44817']
    nosy_count = 4.0
    nosy_names = ['loewis', 'akuchling', 'solomoriah', 'titus']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue827559'
    versions = ['Python 2.5']

    @solomoriah
    Copy link
    Mannequin Author

    solomoriah mannequin commented Oct 21, 2003

    The SimpleHTTPServer.py module, when presented with a
    URL of the form:

      http://some.site.com/directory
    

    should redirect the browser to:

      http://some.site.com/directory/
    

    This is evidently a standard behavior of major
    webservers (Apache and IIS at least). SimpleHTTPServer
    does not do this, but fortunately it is simple to
    implement (patch attached, naturally).

    I am providing a fix for 2.2 but this problem appears
    to be in earlier versions, and is also in 2.3. This
    patch appears to work fine for 2.3.

    @solomoriah solomoriah mannequin closed this as completed Oct 21, 2003
    @solomoriah solomoriah mannequin assigned akuchling Oct 21, 2003
    @solomoriah solomoriah mannequin added stdlib Python modules in the Lib dir labels Oct 21, 2003
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Nov 13, 2003

    Logged In: YES
    user_id=21627

    Why is this a bug? SimpleHTTPServer already returns the
    directory content if only the directory name is given, with
    or without trailing slash. I believe Apache does that only
    as an implementation detail, and it is unfortunate that this
    detail is exposed to clients.

    So unless you can report a specific problem with the
    approach taken by SimpleHTTPServer, I'm tempted to reject
    this patch.

    @solomoriah
    Copy link
    Mannequin Author

    solomoriah mannequin commented Nov 14, 2003

    Logged In: YES
    user_id=321948

    Oops. Allow me to clarify. Directory names without a
    trailing slash need to be redirected to the same name with
    the trailing slash to avoid breaking relative links from the
    page.

    I use SimpleHTTPServer to test websites which will be
    deployed via Apache. Relative links on default directory
    pages (index.html) are broken using SimpleHTTPServer but
    work correctly on Apache.

    This is a de facto standard at least (I haven't read the
    RFC's but both IE and Mozilla expect this behavior).

    @titus
    Copy link
    Mannequin

    titus mannequin commented Dec 19, 2004

    Logged In: YES
    user_id=23486

    Clearly a bug, IMO: a reference to a directory name w/o a slash
    will return the directory listing, but relative links do not then work.
    (Does this need more explication or ???)

    Patch works against latest CVS & fixes behavior. Recommend
    application.

    @akuchling
    Copy link
    Member

    Committed to the trunk in rev. 53147 and to 25-maint in rev. 53148. Thanks for the fix!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant