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
标题: Fix HTML produced by http.server
类型: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: ezio.melotti 抄送列表: eric.araujo, ezio.melotti, karlcow, loewis, orsenthil, python-dev
优先级: normal 关键字: patch

Created on 2011-10-30 15:07 by karlcow, last changed 2022-04-11 14:57 by admin. This issue is now closed.

文件
文件名 上传时间 Description 编辑
server-html5.patch karlcow, 2011-10-30 15:07
issue13295.diff ezio.melotti, 2011-10-30 16:25 review
issue13295-2.diff ezio.melotti, 2011-10-31 18:53 review
Messages (14)
msg146641 - (view) Author: karl (karlcow) * 日期: 2011-10-30 15:07
The code has a set of old HTML templates. Here is a patch to change it to very simple html5 templates.
msg146643 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) 日期: 2011-10-30 16:12
I think HTML 4.01 strict is still fine -- no need to move to HTML 5 yet.
The template that uses HTML 3.2 can probably be updated though.
msg146644 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) 日期: 2011-10-30 16:25
Here's a patch to replace 3.2 with 4.01.
The output of the page should be checked and validated before committing this.
I'm not sure if this should go in 2.7/3.2 too, on one hand it's not a bug fix so it shouldn't, on the other hand I don't think it will break anything and it's consistent with the doctype used for the error page.
msg146658 - (view) Author: Martin v. Löwis (loewis) * (Python committer) 日期: 2011-10-30 20:41
Ezio: your patch is fine for 3.3. I agree it's not a bug fix.
I propose the following additional changes, though:
- the name of the root element should be lower-case in the DOCTYPE declaration.
- DEFAULT_ERROR_MESSAGE should get an opening html tag.

karl: HTML 3.2 may be old, but it's not outdated.
msg146697 - (view) Author: karl (karlcow) * 日期: 2011-10-31 15:05
Ezio, Martin, 

HTML 3.2, HTML 4.01 are not outdated. They have stable specifications. That said their doctypes have not influence at all in browsers. The html5 doctype <!DOCTYPE html> has been chosen because it was the minimal string of characters that put the browsers into strict mode rendering (See Quirks Mode in CSS). The W3C validator is the only tool implementing an SGML parser able to understand HTML 3.2 and HTML 4.01. Note also that the W3C validtor includes an html5 validator if the concern is the validity of the output.
msg146701 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) 日期: 2011-10-31 15:13
My point is that the HTML5 doctype doesn't bring us anything (except maybe a shorter string), so I don't see the point of changing it.
When the HTML5 spec is stable we can switch to it, but even then the update won't change anything.
msg146703 - (view) Author: karl (karlcow) * 日期: 2011-10-31 15:35
Yup. I doesn't bring anything except putting the output in line with the reality of browsers implementations. You may close it. I don't mind.
msg146704 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) 日期: 2011-10-31 16:08
I’d rather fix the page (look at the diff to find one violation: the first heading is an h2 instead of h1) and use an HTML5 doctype, as it’s just HTML 4.01 + pragmatism.
msg146715 - (view) Author: Martin v. Löwis (loewis) * (Python committer) 日期: 2011-10-31 17:05
I declare the original issue closed - there is no reason to switch to HTML 5 in this code.

There are side issues, such as the HTML 3.2 perhaps being incorrect; people who want to commit patches in that respect can just go ahead.
msg146718 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) 日期: 2011-10-31 17:15
Okay.
msg146729 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) 日期: 2011-10-31 18:53
Attached patch updates the pages to pass the validation, use HTML 4.01 and specify the encoding of the page in the <meta> tag.
msg146850 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) 日期: 2011-11-02 16:58
Thanks.  +0.
msg146855 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2011-11-02 17:33
New changeset 10823e7be085 by Ezio Melotti in branch 'default':
#13295: http.server now produces valid HTML 4.01 strict.
http://hg.python.org/cpython/rev/10823e7be085
msg146856 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) 日期: 2011-11-02 17:35
Fixed, thanks for the report and the reviews!
历史
日期 用户 动作 参数
2022-04-11 14:57:23admin修改github: 57504
2011-11-02 17:35:26ezio.melotti修改状态: open -> closed
resolution: fixed
消息: + msg146856

stage: commit review -> resolved
2011-11-02 17:33:56python-dev修改抄送: + python-dev
消息: + msg146855
2011-11-02 16:58:45eric.araujo修改消息: + msg146850
2011-10-31 18:53:40ezio.melotti修改文件: + issue13295-2.diff

stage: patch review -> commit review
消息: + msg146729
versions: - Python 2.7, Python 3.2
2011-10-31 17:15:29eric.araujo修改标题: html5 template for Lib/http/server.py -> Fix HTML produced by http.server
消息: + msg146718
versions: + Python 2.7, Python 3.2
2011-10-31 17:05:25loewis修改消息: + msg146715
2011-10-31 16:08:23eric.araujo修改消息: + msg146704
2011-10-31 15:51:37ezio.melotti修改assignee: ezio.melotti
stage: patch review
2011-10-31 15:35:53karlcow修改消息: + msg146703
2011-10-31 15:13:28ezio.melotti修改消息: + msg146701
2011-10-31 15:05:15karlcow修改消息: + msg146697
2011-10-30 20:41:14loewis修改抄送: + loewis
消息: + msg146658
2011-10-30 16:25:08ezio.melotti修改文件: + issue13295.diff

消息: + msg146644
2011-10-30 16:12:51ezio.melotti修改抄送: + eric.araujo, ezio.melotti

消息: + msg146643
versions: + Python 3.3, - Python 3.1, Python 3.2
2011-10-30 15:07:24karlcow创建