For path to directory which does not end with slash ("/"), SimpleHTTPRequestHandler returns status MOVED_PERMANENTLY with redirection to new path that ends with slash. Slashes can be percent-encoded, although this is not necessary. But the code that checks for the trailing slash does not take this into account (in two place).
Activity
serhiy-storchaka commented on May 16, 2025
Other effect of this bug -- a percent-encoded trailing slash is ignored after non-directory path (should return status NOT_FOUND).
pythongh-134098: Fix handling %-encoded trailing slash in SimpleHTTPR…
donbarbos commented on May 17, 2025
since you mentioned request handling, what do you think about making http.server accept "absolute form" as "request target"?
issue #132741
gh-134098: Fix handling %-encoded trailing slash in SimpleHTTPRequest…
pythongh-134098: Fix handling %-encoded trailing slash in SimpleHTTPR…
pythongh-134098: Fix handling %-encoded trailing slash in SimpleHTTPR…
[3.13] gh-134098: Fix handling %-encoded trailing slash in SimpleHTTP…
[3.14] gh-134098: Fix handling %-encoded trailing slash in SimpleHTTP…
pythongh-134098: Fix handling %-encoded trailing slash in SimpleHTTPR…
pythongh-134098: Fix handling %-encoded trailing slash in SimpleHTTPR…