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

module-cgi: handling GET and POST together #46142

Closed
alef13 mannequin opened this issue Jan 13, 2008 · 9 comments
Closed

module-cgi: handling GET and POST together #46142

alef13 mannequin opened this issue Jan 13, 2008 · 9 comments
Labels
easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@alef13
Copy link
Mannequin

alef13 mannequin commented Jan 13, 2008

BPO 1817
Nosy @gvanrossum, @facundobatista
Files
  • cgi.py.patch: Patch for handling QUERY_STRING within POST
  • cgy.py.patch-1: added suport for reading QUERY_STRING within POST
  • cgitest.py: Unit test for patched cgi module.
  • post_qs.patch: Corrects handling of querystring in POST requests
  • post_qs_final.patch: all of it is in this 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 2008-06-21.18:59:06.772>
    created_at = <Date 2008-01-13.01:58:54.713>
    labels = ['easy', 'type-feature', 'library']
    title = 'module-cgi: handling GET and POST together'
    updated_at = <Date 2008-06-21.18:59:06.765>
    user = 'https://bugs.python.org/alef13'

    bugs.python.org fields:

    activity = <Date 2008-06-21.18:59:06.765>
    actor = 'facundobatista'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-06-21.18:59:06.772>
    closer = 'facundobatista'
    components = ['Library (Lib)']
    creation = <Date 2008-01-13.01:58:54.713>
    creator = 'alef13'
    dependencies = []
    files = ['9148', '9180', '9507', '10683', '10689']
    hgrepos = []
    issue_num = 1817
    keywords = ['patch', 'easy']
    message_count = 9.0
    messages = ['59848', '59849', '59850', '59985', '62772', '68505', '68513', '68529', '68534']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'facundobatista', 'alef13', 'Nubis']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1817'
    versions = ['Python 2.6', 'Python 2.5']

    @alef13
    Copy link
    Mannequin Author

    alef13 mannequin commented Jan 13, 2008

    It looks like module-cgi cannot handle GET and POST together when using
    FieldStorage. For instance, a <form action="script.py?key=value"
    action="post"> is available through cgi.FormContent but not
    cgi.FieldStorage when there are other <input> in the html form.
    Very strange.

    @gvanrossum
    Copy link
    Member

    Well, what are you waiting for? Submit a patch!

    @alef13
    Copy link
    Mannequin Author

    alef13 mannequin commented Jan 13, 2008

    Here it is, babe. I've made appropriate changes to make it read
    QUERY_STRING when it's available within POST method. It's currently
    being parsed by parse_qsl() in read_urlencoded() as it should be in
    regular GET or POST. I didn't touch CONTENT_LENGTH since it has the size
    of the POST data without QUERY_STRING's size. That would affect read()
    of such POST data. It's working. Thanks for the incentive, it's my first
    patch for python.

    @alef13
    Copy link
    Mannequin Author

    alef13 mannequin commented Jan 15, 2008

    Now I added support for parsing query string within multipart/*. The
    only issue now is that it mixes FieldStorage with MiniFieldStorage.
    However, I don't think it's a problem.

    @tiran tiran added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jan 20, 2008
    @alef13
    Copy link
    Mannequin Author

    alef13 mannequin commented Feb 23, 2008

    Here's the unit test for patched cgi module.
    There are three tests: one for HTML POST forms that are urlencoded, and
    two for multipart/form-data - with and without file upload.

    @Nubis
    Copy link
    Mannequin

    Nubis mannequin commented Jun 21, 2008

    This was pretty much done when I got here. It broked the other cgi_test
    (which tests some other corner cases).
    Patch includes modifications to Lib/cgi.py and adds
    Lib/test/test_cgi_post_qs.py to test the new features.

    This should be closed by now, but since this is my first patch, just let
    me know what else should I do to get it closed.

    thanks!

    @gvanrossum
    Copy link
    Member

    Thanks for your contribution!

    To get this commmitted, please draw the attention of someone else on
    python-dev (or if you're an IRC person try #python-dev at freenote,
    IIRC). I'd recommend moving the tests into the existing test_cgi.py.

    @Nubis
    Copy link
    Mannequin

    Nubis mannequin commented Jun 21, 2008

    I moved the test into the current test_cgi.py, and also added the docs
    and NEWS.
    This patch also includes all the previous changes and is the only one
    that needs to be merged.

    Now I think it def should be closed :)

    @facundobatista
    Copy link
    Member

    Commited the final Nubis' version in r64447. Fixed, :). Thank you all!

    @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
    easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants