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 // at beginning of path anymore
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: facundobatista Nosy List: elachuni, facundobatista, philfr
Priority: normal Keywords: easy

Created on 2007-10-01 11:20 by philfr, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
1224.diff elachuni, 2008-02-17 20:24
Messages (4)
msg56205 - (view) Author: (philfr) Date: 2007-10-01 11:20
The fix to issue 1394565 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.
msg56207 - (view) Author: (philfr) Date: 2007-10-01 12:15
May I suggest replacing the 

     path = urlparse.urlparse(path)[2]

line with the following two:

     path = path.split('?',1)[0]
     path = path.split('#',1)[0]

thereby handling parameters as well as fragments.
msg62504 - (view) Author: Anthony Lenton (elachuni) * Date: 2008-02-17 20:24
Attached is an diff against trunk that adds philfr's suggesitions.  I've
also added a test file for testing url parsing, so's these things stay
fixed.  Updated Misc/NEWS.  No doc or functionallity modified.
msg62525 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-02-18 12:49
Fixed in r60885. Thanks everybody!
History
Date User Action Args
2022-04-11 14:56:27adminsetgithub: 45565
2008-02-18 12:49:23facundobatistasetstatus: open -> closed
resolution: fixed
messages: + msg62525
2008-02-18 03:55:06facundobatistasetassignee: facundobatista
2008-02-17 20:24:59elachunisetfiles: + 1224.diff
nosy: + elachuni, facundobatista
messages: + msg62504
2008-01-20 19:50:33christian.heimessetpriority: normal
keywords: + easy
versions: + Python 2.6, - Python 2.4
2007-10-01 12:15:23philfrsetmessages: + msg56207
2007-10-01 11:20:26philfrcreate