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

Setting a timeout to read a request's data #209

Open
jedisct1 opened this issue Mar 6, 2019 · 2 comments
Open

Setting a timeout to read a request's data #209

jedisct1 opened this issue Mar 6, 2019 · 2 comments

Comments

@jedisct1
Copy link

jedisct1 commented Mar 6, 2019

Hi!

Right now, a client can lock a server thread indefinitely by simply sending a Content-Length header larger than the data it is actually going to send.

Being able to set a timeout on reading a RequestBody may mitigate this. Unfortunately, this structure only implements the Read trait due to tiny-http also just returning a Read + Send value. There is no RawFd we could use for polling.

So how can such a timeout be implemented in Rouille?

Thanks in advance.

@dpc
Copy link

dpc commented Jun 3, 2022

This (timeouts on read/writes + timeouts/deadlines on whole request handling) and dynamically allocated thread-pool size is pretty much everything required to bring a gap between async and threaded http servers for most practical applications.

@bradfier
Copy link
Collaborator

bradfier commented Jun 3, 2022

To what extent should the above (timeouts + deadlines) be the responsibility of the underlying HTTP server tiny-http and what parts should be handled by the web framework itself? tiny-http runs an 'acceptor' thread that just dispatches onto whatever it is provided, it would probably need to at least pass something up to handle timeouts / cancellations if it doesn't do it itself.

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

No branches or pull requests

3 participants