You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
http.server directories named index.html break directory listings #100474
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
Activity
gh-100474: Fix handling of dirs named index.html in http.server (GH-1…
pythongh-100474: Fix handling of dirs named index.html in http.server (…
pythongh-100474: Fix handling of dirs named index.html in http.server (…
[3.11] gh-100474: Fix handling of dirs named index.html in http.server (
[3.10] gh-100474: Fix handling of dirs named index.html in http.server (
merwok commentedon Dec 24, 2022
That was a great bug report and PR. Thanks and cheers!
Fraetor commentedon Dec 24, 2022
Thank you too. Merry Christmas! 🎄
Merged main into regmachine branch (#50)