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

Make CGIHTTPServer capable of redirects (and status other than 200) #58101

Closed
GiovanniFunchal mannequin opened this issue Jan 27, 2012 · 8 comments
Closed

Make CGIHTTPServer capable of redirects (and status other than 200) #58101

GiovanniFunchal mannequin opened this issue Jan 27, 2012 · 8 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@GiovanniFunchal
Copy link
Mannequin

GiovanniFunchal mannequin commented Jan 27, 2012

BPO 13893
Nosy @orsenthil, @merwok
Superseder
  • bpo-10487: http.server doesn't process Status header from CGI scripts
  • Files
  • CGIHTTPServer.patch: Patch against 2.7
  • server.py
  • CGIHTTPServer.py
  • 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 2012-02-05.11:08:50.761>
    created_at = <Date 2012-01-27.23:12:15.808>
    labels = ['type-feature', 'library']
    title = 'Make CGIHTTPServer capable of redirects (and status other than 200)'
    updated_at = <Date 2012-02-05.11:08:50.760>
    user = 'https://bugs.python.org/GiovanniFunchal'

    bugs.python.org fields:

    activity = <Date 2012-02-05.11:08:50.760>
    actor = 'eric.araujo'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-02-05.11:08:50.761>
    closer = 'eric.araujo'
    components = ['Library (Lib)']
    creation = <Date 2012-01-27.23:12:15.808>
    creator = 'Giovanni.Funchal'
    dependencies = []
    files = ['24342', '24425', '24426']
    hgrepos = []
    issue_num = 13893
    keywords = ['patch', 'needs review']
    message_count = 8.0
    messages = ['152137', '152578', '152597', '152615', '152616', '152654', '152655', '152656']
    nosy_count = 5.0
    nosy_names = ['orsenthil', 'eric.araujo', 'v+python', 'rosslagerwall', 'Giovanni.Funchal']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '10487'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue13893'
    versions = []

    @GiovanniFunchal
    Copy link
    Mannequin Author

    GiovanniFunchal mannequin commented Jan 27, 2012

    GIHTTPServer.py is a very handy module for quickly setting up a full HTTP server with CGI support. However, I noticed that it doesn't support responses other than "200 OK". So, for instance if the page wants to do a redirect (response 303), it just isn't supported. It's documented as so, but still I think this is a major drawback that can be easily overcome.

    I have attached a patch against 2.7. I'd be happy to port it to dev branch if help provided as I'm new to Python. Reviews/suggestions more than welcome.

    @GiovanniFunchal GiovanniFunchal mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jan 27, 2012
    @vpython
    Copy link
    Mannequin

    vpython mannequin commented Feb 4, 2012

    This seems related to bpo-10487. Some of the code is different in Python 3. Since this is an enhancement, it seems unlikely to ever be accepted for 2.x, which is in bugfix-only mode.

    Sadly, most hosting companies are still running Python 2.x, with many as old as 2.4.

    Happily, you can patch your own copy to work; I did that, for both 2.x and 3.x, and described the issues in a set of bug issues, but haven't had the time to figure out how to go through the development process and submit individual patches: my code is kind of a bundled solution to all the issues I submitted, and it doesn't seem likely that a single patch to solve all the issues would be acceptable. I'm happy to share my code, if it would help someone generate patches.

    @merwok
    Copy link
    Member

    merwok commented Feb 4, 2012

    Can someone assess if this is actually a duplicate of bpo-10487 or something else? Thanks

    @GiovanniFunchal
    Copy link
    Mannequin Author

    GiovanniFunchal mannequin commented Feb 4, 2012

    @Glenn Linderman, can you please share your changes? You can upload a patch.

    @GiovanniFunchal
    Copy link
    Mannequin Author

    GiovanniFunchal mannequin commented Feb 4, 2012

    @Éric Araujo, yes this is a duplicate of bpo-10487. I now think this should be marked as bug instead of enhancement. The documentation warns about this behavior but it is documenting a bug.

    @vpython
    Copy link
    Mannequin

    vpython mannequin commented Feb 5, 2012

    Add version of server.py source. This was originally revised from Python 3.1, I just now merged the Python 3.2 changes. I've been running it for months in 3.2, but without the 3.2 changes. Will be running it now in this form, so if something goes wrong in my environment, I'll be back to correct it.

    This code includes fixes for a number of open issues that I opened, including bpo-10487.

    Giovanni -- if you have time to work on this, and separate out the patches for the individual issues address, and cause progress, that would be great. Maybe use this issue as a staging area, tease apart the patches and submit them to the other bugs, and then just close this one down as a dup of the others? I'm not sure of the best process.

    @vpython
    Copy link
    Mannequin

    vpython mannequin commented Feb 5, 2012

    Uploaded version of CGIHTTPServer.py that is based on Python 2.6 runs well there on Windows, but which also works under Python 2.4 on Linux.

    I should mention that the server.py I upload moments ago has mostly run on Windows, and I might not have fixed all the problems in the Linux/Unix path, because I don't have a test environment for that path.

    @vpython
    Copy link
    Mannequin

    vpython mannequin commented Feb 5, 2012

    Oh, and I submit all my changes to the public domain to be re-licensed as needed by anyone that works with it. Not sure if these few changes need a contributor agreement, I'd be glad to sign one if it is.

    @merwok merwok closed this as completed Feb 5, 2012
    @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

    1 participant