Skip to content
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

Fixes HTTP1 client reads to properly timeout #539

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matthewbjones
Copy link

The initial read(s) for reading in the HTTP request headers from the client did not make use of the read_timeout, and a client could cause a connection to hang forever. This could allow to resource exhaustion attacks, as malicious actors could use up all available socket connections, or memory (since a buffer is allocated for each request)

Also, there was no way to set the read_timeout for an HttpSession prior to this initial read, despite there being a set_read_timeout, so this commit also sets a "sensible default" of 60 seconds, which matches NGINX's default value for client_header_timeout and client_body_timeout.

See discussion at #447

The initial read(s) for reading in the HTTP request headers
from the client did not make use of the `read_timeout`, and
a client could cause a connection to hang forever.

Also, there was no way to set the `read_timeout` for an
`HttpSession` prior to this initial read, despite there
being a `set_read_timeout`, so this commit also sets a
"sensible default" of 60 seconds, which matches NGINX's
default value for `client_header_timeout` and `client_body_timeout`.
@matthewbjones
Copy link
Author

Note: All tests pass, when running after fixing broken GitHub Actions (see #538 )

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.

1 participant