GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http.server directories named index.html break directory listings · Issue #100474 · python/cpython

http.server directories named index.html break directory listings #100474

New issue
Copy link
New issue
Copy link
Closed
Closed
http.server directories named index.html break directory listings#100474
Copy link
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@Fraetor
Fraetor
opened on Dec 23, 2022
Issue body actions

Bug report

If you have a directory called index.html or index.htm within a directory (any name in SimpleHTTPRequestHandler.index_pages), it causes http.server to return a 404 Not Found error instead of the directory listing. This comes about due to not checking that the index is a regular file when it checks for its presence. The 404 error comes from the call to open() the directory raising an OSError.

To reproduce create a folder structure like below and run python3 -m http.server -d foo. You will get a 404 error rather than a directory listing.

foo/
foo/
├── bar
└── index.html/
    └── baz

Your environment

  • CPython versions tested on: 3.11.0, Python 3.12.0a3 (c3c7848)
  • Operating system and architecture: Fedora Linux 37 (Workstation Edition) x86_64

Linked PRs

  • gh-100474: Fix handling of dirs named index.html in http.server #100475
  • [3.10] gh-100474: Fix handling of dirs named index.html in http.server (GH-100504) #100504
  • [3.11] gh-100474: Fix handling of dirs named index.html in http.server (GH-100475) #100505

Activity

  1. Fraetor
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Dec 23, 2022
  2. merwok
    added
    3.11only security fixesonly security fixes
    3.10 (EOL)end of lifeend of life
    3.12only security fixesonly security fixes
    on Dec 24, 2022
  3. miss-islington
    added 3 commits that reference this issue on Dec 24, 2022

    gh-100474: Fix handling of dirs named index.html in http.server (GH-1…

    46e6a28

    pythongh-100474: Fix handling of dirs named index.html in http.server (…

    1e07f77

    pythongh-100474: Fix handling of dirs named index.html in http.server (…

    b2eea68
  4. merwok
    added 2 commits that reference this issue on Dec 24, 2022

    [3.11] gh-100474: Fix handling of dirs named index.html in http.server (

    714a93f

    [3.10] gh-100474: Fix handling of dirs named index.html in http.server (

    ecbf136
  5. merwok commented on Dec 24, 2022

    @merwok
    merwok
    on Dec 24, 2022
    Member
    More actions

    That was a great bug report and PR. Thanks and cheers!

  6. merwok
    closed this as completedon Dec 24, 2022
  7. Fraetor commented on Dec 24, 2022

    @Fraetor
    Fraetor
    on Dec 24, 2022
    ContributorAuthor
    More actions

    Thank you too. Merry Christmas! 🎄

  8. iritkatriel
    added a commit that references this issue on Dec 28, 2022

    Merged main into regmachine branch (#50)

    fdc73cb
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

    3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.