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.

Author martin.panter
Recipients martin.panter, vstinner
Date 2017-11-26.05:28:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Maybe a good fix would be to “escape” the double slash with “/.”:

if os.path.isdir(path):
    url = self.path
    if url.startswith('//'):  # E.g. "//"
        url = "/." + url  # Becomes "/.//"
    parts = urllib.parse.urlsplit(url)

When this “escaped” URL is resolved with the base URL, it should give the right result:

>>> base = "http://localhost:8000//"
>>> redirect = "/.//"
>>> urljoin(base, redirect)

A simpler idea is to strip off all but one of the leading slashes, so you end up with "/". That would technically be a different URL, but would access the same file through the default SimpleHTTPRequestHandler behaviour, so most people wouldn’t notice.
Date User Action Args
2017-11-26 05:28:23martin.pantersetrecipients: + martin.panter, vstinner
2017-11-26 05:28:23martin.pantersetmessageid: <>
2017-11-26 05:28:23martin.panterlinkissue32084 messages
2017-11-26 05:28:22martin.pantercreate