Title: http.server directories named index.html break directory listings · Issue #100474 · python/cpython · GitHub
Open Graph Title: http.server directories named index.html break directory listings · Issue #100474 · python/cpython
X Title: http.server directories named index.html break directory listings · Issue #100474 · python/cpython
Description: 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 a...
Open Graph Description: 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 instea...
X Description: 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 instea...
Opengraph URL: https://github.com/python/cpython/issues/100474
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"http.server directories named index.html break directory listings","articleBody":"\u003c!--\r\n If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not\r\n the right place to seek help. Consider the following options instead:\r\n\r\n - reading the Python tutorial: https://docs.python.org/3/tutorial/\r\n - posting in the \"Users\" category on discuss.python.org: https://discuss.python.org/c/users/7\r\n - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list\r\n - searching our issue tracker (https://github.com/python/cpython/issues) to see if\r\n your problem has already been reported\r\n--\u003e\r\n\r\n# Bug report\r\n\r\nIf 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.\r\n\r\nTo 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.\r\n```\r\nfoo/\r\nfoo/\r\n├── bar\r\n└── index.html/\r\n └── baz\r\n```\r\n\r\n# Your environment\r\n\r\n\u003c!-- Include as many relevant details as possible about the environment you experienced the bug in --\u003e\r\n\r\n- CPython versions tested on: 3.11.0, Python 3.12.0a3 (c3c7848a)\r\n- Operating system and architecture: Fedora Linux 37 (Workstation Edition) x86_64\r\n\u003c!--\r\nYou can freely edit this text. Remove any lines you believe are unnecessary.\r\n--\u003e\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-100475\n* gh-100504\n* gh-100505\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/Fraetor","@type":"Person","name":"Fraetor"},"datePublished":"2022-12-23T20:59:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/100474/cpython/issues/100474"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:079c835c-e684-5f52-45b1-7f8db8b6900b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C06E:5E239:B53485:FB6D93:6968DBD8 |
| html-safe-nonce | dd7a589cbac4d89b8014d900477b709a08af79e53dae20efbafb9214ba60b7b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDZFOjVFMjM5OkI1MzQ4NTpGQjZEOTM6Njk2OERCRDgiLCJ2aXNpdG9yX2lkIjoiMzUxMzgxNjEwNTAxNDA1Nzk0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2702420e19876c5a46416a55c98c2307fb74c7531d35d92fcfe414bdce5f0f74 |
| hovercard-subject-tag | issue:1509772752 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/100474/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a84326dabd04a66d1152f93fdaa6b9622dc0f26ecf3b8e08ae8fde43be6511ec/python/cpython/issues/100474 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a84326dabd04a66d1152f93fdaa6b9622dc0f26ecf3b8e08ae8fde43be6511ec/python/cpython/issues/100474 |
| og:image:alt | 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 instea... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Fraetor |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3c4e9f2fc1db52c609205138be6a397cfde4574cb54d53015014de30dd49f27e |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1fb1ea11f8c37dd4dd50347cca70d89824e93788 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width