Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use pathsplit() in translate_path().
This avoids "manual parsing" of the Request-URI part of the request and
matches what _get_redirect_url() does.
  • Loading branch information
nascheme committed Jun 16, 2022
commit 899f512ee3c6618e881c17f4ef8b6173528d1403
5 changes: 2 additions & 3 deletions Lib/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,8 @@ def translate_path(self, path):
probably be diagnosed.)

"""
# abandon query parameters
path = path.split('?',1)[0]
path = path.split('#',1)[0]
# extract only path, abandon query parameters and fragment
path = urllib.parse.pathsplit(path).path
# Don't forget explicit trailing slash when normalizing. Issue17324
trailing_slash = path.rstrip().endswith('/')
try:
Expand Down