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

Simple enhancement to BaseHTTPRequestHandler #70773

Closed
zhangyangyu opened this issue Mar 18, 2016 · 7 comments
Closed

Simple enhancement to BaseHTTPRequestHandler #70773

zhangyangyu opened this issue Mar 18, 2016 · 7 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@zhangyangyu
Copy link
Member

BPO 26586
Nosy @vadmium, @zhangyangyu
Files
  • simple_enhancement.patch: simple enhancement for BaseHTTPRequestHandler
  • simple_enhancement_v2.patch
  • 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 = None
    closed_at = <Date 2016-04-03.03:27:54.391>
    created_at = <Date 2016-03-18.04:06:16.830>
    labels = ['type-feature', 'library']
    title = 'Simple enhancement to BaseHTTPRequestHandler'
    updated_at = <Date 2016-04-03.03:27:54.389>
    user = 'https://github.com/zhangyangyu'

    bugs.python.org fields:

    activity = <Date 2016-04-03.03:27:54.389>
    actor = 'martin.panter'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-04-03.03:27:54.391>
    closer = 'martin.panter'
    components = ['Library (Lib)']
    creation = <Date 2016-03-18.04:06:16.830>
    creator = 'xiang.zhang'
    dependencies = []
    files = ['42196', '42200']
    hgrepos = []
    issue_num = 26586
    keywords = ['patch']
    message_count = 7.0
    messages = ['261946', '261957', '261968', '262063', '262802', '262809', '262811']
    nosy_count = 3.0
    nosy_names = ['python-dev', 'martin.panter', 'xiang.zhang']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue26586'
    versions = ['Python 3.5', 'Python 3.6']

    @zhangyangyu
    Copy link
    Member Author

    This patch propose several simple enhancement to BaseHTTPRequestHandler. It removes some redundant code and add handler for too many headers.

    @zhangyangyu zhangyangyu added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Mar 18, 2016
    @vadmium
    Copy link
    Member

    vadmium commented Mar 18, 2016

    Thanks for the patch, it looks good in general. I left some comments and suggestions.

    @zhangyangyu
    Copy link
    Member Author

    Thanks for your review. I have made some changes according to it.

    Status code 431 is returned when the header line is too long or there are too many headers. And I think the short message is OK and we can provide the exception message in the content message.

    As for the style, I don't know why I made that change. Quite sorry for make the noise.

    @zhangyangyu
    Copy link
    Member Author

    Ping.

    @vadmium
    Copy link
    Member

    vadmium commented Apr 2, 2016

    I propose to commit the “Too many headers” handler as a bug fix, and the other changes to only 3.6. Currently when more than 100 header fields are sent, the connection is killed and the server logs an unhandled exception.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 3, 2016

    New changeset f5247195238f by Martin Panter in branch '3.5':
    Issue bpo-26586: Handle excessive header fields in http.server, by Xiang Zhang
    https://hg.python.org/cpython/rev/f5247195238f

    New changeset e8edddb4f74b by Martin Panter in branch 'default':
    Issue bpo-26586: Merge excessive HTTP header handling from 3.5
    https://hg.python.org/cpython/rev/e8edddb4f74b

    New changeset 1b696c744559 by Martin Panter in branch 'default':
    Issue bpo-26586: Simple enhancements to BaseHTTPRequestHandler by Xiang Zhang
    https://hg.python.org/cpython/rev/1b696c744559

    @vadmium
    Copy link
    Member

    vadmium commented Apr 3, 2016

    I didn’t touch 2.7 because that doesn’t have the same header parsing code as Python 3.

    @vadmium vadmium closed this as completed Apr 3, 2016
    @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