Skip to content

Conversation

AlanZhang2002
Copy link

Tied with https://github.com/urllib3/urllib3-ghsa-653g-f933-mc5q/pull/1 for testing urllib3 with hypercorn 0.16.0

pgjones and others added 21 commits December 26, 2023 10:25
Otherwise the task will persist and attempt to close an already closed
connection.
This will cause HTTP/1 and HTTP/2 requests to close when the limit has
been reached. This matches nginx's mitigation against the rapid reset
HTTP/2 attack.
This reverts commit 4854ffd.

It doesn't fix the issue and creates additional reported issues.
This properly punches through 431 status codes
The response body is closed if it has a close method as per PEP
3333. In addition the response headers are only sent when the first
response body byte is available to send. Finally, an error is raised
if start_response has not been called by the app.
This allows for Hypercorn to be used behind a proxy with the headers
being "fixed" such that the proxy is not present as far as the app is
concerned. This makes it easier to write applications that run behind
proxies.

Note I've defaulted to legacy mode as AWS's load balancers don't
support the modern Forwarded header and I assume that makes up a large
percentage of real world usage.
This matches other examples and the WSGI specification.
This is useful as a "solution" to memory leaks in apps as it ensures
that after the max requests have been handled the worker will restart
hence freeing any memory leak.

The options match those used by Gunicorn.

This also ensures that the workers self-heal such that if a worker
crashes it will be restored.
There is a race condition being hit in the autobahn compliance tests
whereby the client closes the stream and the server responds with an
acknowledgement. Whilst the server responds the app sends a message,
which now errors as the WSConnection state is closed.

As the state is managed by the WSStream, rather than the WSConnection
it makes sense to ignore these errors.
The ssl name clashes with the ssl module name and I intend to reuse this
variable to carry information about the ASGI TLS extension.
The dictionary will carry information for the TLS ASGI extension.
It makes the underlying transport available, and depends on the actual
backend. urllib3 needs it to implement CONNECT.
This makes debugging much easier than the current silent behavior.
@AlanZhang2002 AlanZhang2002 changed the base branch from main to urllib3-changes October 6, 2025 23:38
@AlanZhang2002
Copy link
Author

not sure if i did this part right tbh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants