homepage

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: SimpleHTTPServer doesn't understand query arguments
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: aaronsw, georg.brandl, philfr, pterk
Priority: normal Keywords:

Created on 2005年12月31日 21:46 by aaronsw, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Messages (6)
msg27194 - (view) Author: Aaron Swartz (aaronsw) Date: 2005年12月31日 21:46
If you set the SimpleHTTPServer to serve files and visit /filename it works 
but if you visit /filename?f=1 it returns a 404. It should strip off the query 
argument and visit /filename
msg27195 - (view) Author: Aaron Swartz (aaronsw) Date: 2006年01月05日 15:45
Logged In: YES 
user_id=122141
The patch is to add this line to the top of SimpleHTTPServer.py's translate_path 
function:
 path = path.split('?')[0]
msg27196 - (view) Author: Peter van Kampen (pterk) Date: 2006年01月13日 01:01
Logged In: YES 
user_id=174455
See patch 1404374
http://sourceforge.net/tracker/index.php?func=detail&aid=1404374&group_id=5470&atid=305470
(uses urlparse to cover (i.e. ignore) params as well)
msg27197 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006年01月13日 17:08
Logged In: YES 
user_id=1188172
Committed patch in revisions 42030,42031.
msg56204 - (view) Author: (philfr) Date: 2007年10月01日 11:10
This fix introduces a nasty side-effect: "GET http://server//file" (with
two /s) does not work anymore. It returns the directory index instead.
This is because urlparse is not applied to an URL, but to its right-hand
part starting at the path.
urlparse.urlparse("http://server//foo")[2] correctly returns //foo, but 
urlparse.urlparse("//foo")[2] (as used in this library) returns an empty
string.
So the first proposed fix (msg27195) would be better. Or maybe this is
an urlparse issue, so that it should be able to process such a partial url.
msg56206 - (view) Author: (philfr) Date: 2007年10月01日 12:07
I created the new issue 1224 for this.
History
Date User Action Args
2022年04月11日 14:56:14adminsetgithub: 42744
2007年10月01日 12:07:23philfrsetmessages: + msg56206
2007年10月01日 11:10:48philfrsetnosy: + philfr
messages: + msg56204
2005年12月31日 21:46:44aaronswcreate

AltStyle によって変換されたページ (->オリジナル) /