This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Generate HTML 5 with SimpleHTTPRequestHandler.list_directory
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, corona10, dom1310df, eric.araujo
Priority: normal Keywords: patch

Created on 2022-02-13 08:33 by dom1310df, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 31533 merged corona10, 2022-02-23 16:52
Messages (3)
msg413173 - (view) Author: Dominic Davis-Foster (dom1310df) Date: 2022-02-13 08:33
Currently SimpleHTTPRequestHandler.list_directory (which is used with `python3 -m http.server` amongst other things) generates HTML with the doctype:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

i.e. HTML 4.01.


I propose making the generated page HTML 5 instead. The only necessary change is in the doctype; the rest of the page is valid already. HTML 5 has been supported by Chrome, Firefox, Safari and Opera since 2013, and Edge since 2015 so there shouldn't be any issues with browser compatibility.

The generated page has been HTML 4.01 since https://bugs.python.org/issue13295 in 2011, where it was originally proposed to switch to HTML 5.


Switching to HTML 5 would also allow http.server to be used to serve a simple index for pip that's compliant with PEP 503.

There's some discussion in https://github.com/pypa/pip/issues/10825
msg413500 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2022-02-18 18:21
Would you like to make a pull request?
msg413834 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2022-02-23 17:59
New changeset 0bb40a42d71873ea267aace8c92a02d66fe36dc2 by Dong-hee Na in branch 'main':
closes bpo-46736: SimpleHTTPRequestHandler now uses HTML5. (GH-31533)
https://github.com/python/cpython/commit/0bb40a42d71873ea267aace8c92a02d66fe36dc2
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 90892
2022-02-23 17:59:36benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg413834

resolution: fixed
stage: patch review -> resolved
2022-02-23 16:52:45corona10setkeywords: + patch
stage: patch review
pull_requests: + pull_request29657
2022-02-23 16:17:23corona10setnosy: + corona10
2022-02-18 18:21:28eric.araujosetnosy: + eric.araujo
messages: + msg413500
2022-02-16 02:51:23martin.panterlinkissue46738 superseder
2022-02-13 08:33:08dom1310dfcreate