Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HTML produced by http.server #57504

Closed
karlcow mannequin opened this issue Oct 30, 2011 · 14 comments
Closed

Fix HTML produced by http.server #57504

karlcow mannequin opened this issue Oct 30, 2011 · 14 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@karlcow
Copy link
Mannequin

karlcow mannequin commented Oct 30, 2011

BPO 13295
Nosy @loewis, @orsenthil, @ezio-melotti, @merwok, @karlcow
Files
  • server-html5.patch
  • issue13295.diff
  • issue13295-2.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ezio-melotti'
    closed_at = <Date 2011-11-02.17:35:26.310>
    created_at = <Date 2011-10-30.15:07:24.830>
    labels = ['type-feature', 'library']
    title = 'Fix HTML produced by http.server'
    updated_at = <Date 2011-11-02.17:35:26.308>
    user = 'https://github.com/karlcow'

    bugs.python.org fields:

    activity = <Date 2011-11-02.17:35:26.308>
    actor = 'ezio.melotti'
    assignee = 'ezio.melotti'
    closed = True
    closed_date = <Date 2011-11-02.17:35:26.310>
    closer = 'ezio.melotti'
    components = ['Library (Lib)']
    creation = <Date 2011-10-30.15:07:24.830>
    creator = 'karlcow'
    dependencies = []
    files = ['23554', '23556', '23573']
    hgrepos = []
    issue_num = 13295
    keywords = ['patch']
    message_count = 14.0
    messages = ['146641', '146643', '146644', '146658', '146697', '146701', '146703', '146704', '146715', '146718', '146729', '146850', '146855', '146856']
    nosy_count = 6.0
    nosy_names = ['loewis', 'orsenthil', 'ezio.melotti', 'eric.araujo', 'karlcow', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue13295'
    versions = ['Python 3.3']

    @karlcow
    Copy link
    Mannequin Author

    karlcow mannequin commented Oct 30, 2011

    The code has a set of old HTML templates. Here is a patch to change it to very simple html5 templates.

    @karlcow karlcow mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Oct 30, 2011
    @ezio-melotti
    Copy link
    Member

    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.

    @ezio-melotti
    Copy link
    Member

    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.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Oct 30, 2011

    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.

    @karlcow
    Copy link
    Mannequin Author

    karlcow mannequin commented Oct 31, 2011

    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.

    @ezio-melotti
    Copy link
    Member

    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.

    @karlcow
    Copy link
    Mannequin Author

    karlcow mannequin commented Oct 31, 2011

    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.

    @ezio-melotti ezio-melotti self-assigned this Oct 31, 2011
    @merwok
    Copy link
    Member

    merwok commented Oct 31, 2011

    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.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Oct 31, 2011

    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.

    @merwok
    Copy link
    Member

    merwok commented Oct 31, 2011

    Okay.

    @merwok merwok changed the title html5 template for Lib/http/server.py Fix HTML produced by http.server Oct 31, 2011
    @ezio-melotti
    Copy link
    Member

    Attached patch updates the pages to pass the validation, use HTML 4.01 and specify the encoding of the page in the <meta> tag.

    @merwok
    Copy link
    Member

    merwok commented Nov 2, 2011

    Thanks. +0.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 2, 2011

    New changeset 10823e7be085 by Ezio Melotti in branch 'default':
    bpo-13295: http.server now produces valid HTML 4.01 strict.
    http://hg.python.org/cpython/rev/10823e7be085

    @ezio-melotti
    Copy link
    Member

    Fixed, thanks for the report and the reviews!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants