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
Title: Make CGIHTTPServer capable of redirects (and status other than 200)
Type: enhancement Stage: resolved
Components: Library (Lib) Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: http.server doesn't process Status header from CGI scripts
View: 10487
Assigned To: Nosy List: Giovanni.Funchal, eric.araujo, orsenthil, rosslagerwall, v+python
Priority: normal Keywords: needs review, patch

Created on 2012-01-27 23:12 by Giovanni.Funchal, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
CGIHTTPServer.patch Giovanni.Funchal, 2012-01-27 23:12 Patch against 2.7
server.py v+python, 2012-02-05 01:26
CGIHTTPServer.py v+python, 2012-02-05 01:31
Messages (8)
msg152137 - (view) Author: Giovanni Funchal (Giovanni.Funchal) Date: 2012-01-27 23:12
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.
msg152578 - (view) Author: Glenn Linderman (v+python) * Date: 2012-02-04 02:11
This seems related to issue 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.
msg152597 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-04 07:24
Can someone assess if this is actually a duplicate of #10487 or something else?  Thanks
msg152615 - (view) Author: Giovanni Funchal (Giovanni.Funchal) Date: 2012-02-04 12:36
@Glenn Linderman, can you please share your changes? You can upload a patch.
msg152616 - (view) Author: Giovanni Funchal (Giovanni.Funchal) Date: 2012-02-04 12:39
@Éric Araujo, yes this is a duplicate of #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.
msg152654 - (view) Author: Glenn Linderman (v+python) * Date: 2012-02-05 01:26
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 issue 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.
msg152655 - (view) Author: Glenn Linderman (v+python) * Date: 2012-02-05 01:31
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.
msg152656 - (view) Author: Glenn Linderman (v+python) * Date: 2012-02-05 01:33
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.
History
Date User Action Args
2022-04-11 14:57:26adminsetgithub: 58101
2015-10-01 22:38:58martin.panterunlinkissue10487 superseder
2012-03-16 08:22:59orsenthillinkissue10487 superseder
2012-02-05 11:08:50eric.araujosetstatus: open -> closed
stage: test needed -> resolved
superseder: http.server doesn't process Status header from CGI scripts
versions: - Python 2.6, Python 3.1, Python 2.7, Python 3.2, Python 3.3, Python 3.4
2012-02-05 01:33:37v+pythonsetmessages: + msg152656
2012-02-05 01:31:32v+pythonsetfiles: + CGIHTTPServer.py

messages: + msg152655
2012-02-05 01:27:03v+pythonsetfiles: + server.py

messages: + msg152654
2012-02-04 12:39:41Giovanni.Funchalsetresolution: duplicate
messages: + msg152616
2012-02-04 12:36:24Giovanni.Funchalsetmessages: + msg152615
versions: + Python 2.6, Python 3.1, Python 2.7, Python 3.2, Python 3.4
2012-02-04 07:24:40eric.araujosetnosy: + eric.araujo
messages: + msg152597
2012-02-04 07:23:53eric.araujosetkeywords: + needs review
stage: test needed
versions: - Python 2.6, Python 3.1, Python 2.7, Python 3.2, Python 3.4
2012-02-04 02:11:28v+pythonsetnosy: + v+python
messages: + msg152578
2012-01-28 04:10:59rosslagerwallsetnosy: + rosslagerwall
2012-01-27 23:44:04pitrousetnosy: + orsenthil
2012-01-27 23:12:15Giovanni.Funchalcreate