-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Document start_response
parameters in wsgiref
functions
#127522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
After looking into PEP 3333, this is expected behavior:
However it is not that clear in the documentation of the module itself. Instead of trying to fix this and contradict the PEP, I think a documentation update will be the best solution to this issue ("modify" word is not listed in the wsgiref documentation page). |
I'm not sure it requires a doc update. Well.. strictly speaking, it does not say that the |
start_response
parameters in wsgiref
functions
…low a specific protocol (GH-127525)
…ld follow a specific protocol (pythonGH-127525) (cherry picked from commit 39ba4b6) Co-authored-by: Bénédikt Tran <[email protected]>
…ld follow a specific protocol (pythonGH-127525) (cherry picked from commit 39ba4b6) Co-authored-by: Bénédikt Tran <[email protected]>
…uld follow a specific protocol (GH-127525) (GH-130504) (cherry picked from commit 39ba4b6) Co-authored-by: Bénédikt Tran <[email protected]>
…uld follow a specific protocol (GH-127525) (GH-130505) (cherry picked from commit 39ba4b6) Co-authored-by: Bénédikt Tran <[email protected]>
…ld follow a specific protocol (pythonGH-127525)
Bug report
Bug description:
The example WSGI server in the documentation sets the headers as a list in the simple_app function.
When moving the headers from the function to a global (as these headers might not change), this global array of tuples will be modified by the calls to
start_response
. This is because this function creates awsgiref.headers.Headers
with the passed reference of the global variable, instead of using a copy.This results the
Content-Length
value being set once but never updated, resulting in too-short or too-long answers as shown by curl:The solution for this problem would be to peform a shallow copy of the headers list, ideally in the
wsgi.headers.Headers
class so that it does not modify the passed reference but its own copy.CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
start_response
objects should follow a specific protocol #127525start_response
objects should follow a specific protocol (GH-127525) #130504start_response
objects should follow a specific protocol (GH-127525) #130505The text was updated successfully, but these errors were encountered: