[3.10] bpo-43972: Set content-length to 0 for http.server.SimpleHTTPRequestHandler 301s (GH-25705) #25953
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
When http.server.SimpleHTTPRequestHandler sends a 301 (Moved
Permanently) due to a missing file, it does not set a Content-Length
of 0. Unfortunately, certain clients can be left waiting for the
connection to be closed in this circumstance, even though no body
will be sent. At time of writing, both curl and Firefox demonstrate
this behavior.
When serving a redirect, the SimpleHTTPRequestHandler will now send
Content-Length: 0. Several tests for http.server already covervarious behaviors and checks including redirection. This change only
adds one check for the expected Content-Length on the simplest case
for a redirect.
Add news entry for SimpleHTTPRequestHandler fix
Clarify the specific kind of 301
Co-authored-by: Senthil Kumaran skumaran@gatech.edu
(cherry picked from commit fb42725)
Co-authored-by: Stephen Rosen sirosen@globus.org
https://bugs.python.org/issue43972
The text was updated successfully, but these errors were encountered: