torrust / torrust-tracker

A modern and feature-rich (private) BitTorrent tracker.
https://torrust.com
GNU Affero General Public License v3.0
357 stars 40 forks source link

HTTP Tracker: Add a timeout to the TLS handshake, waiting for headers, and waiting for receiving headers #613

Open josecelano opened 8 months ago

josecelano commented 8 months ago

Parent issue: https://github.com/torrust/torrust-tracker/issues/603

Related to:

Adds a timeout to:

Recently we moved to axum-server and it allows setting TLS handshake timeout.

josecelano commented 5 months ago

I've opened a new issue on the axum-server repo: https://github.com/programatik29/axum-server/issues/116. It seems that feature was removed.

josecelano commented 4 months ago

I guess we can implement what I did here. That patch adds the timeout, but it does not send a 408 response to the client. Anyway, I think there is no other choice in this case.

josecelano commented 4 months ago

The TimeoutAcceptor I used to fix this issue does not work with TSL. See https://github.com/torrust/torrust-index/pull/584#issuecomment-2115499282. We have to remove it from the Axum server bootstrapping code for TSL, which means there is no timeout for TSL again until we find another solution, which makes it insecure again to use your own TSL configuration.

josecelano commented 4 months ago

I've converted the discussion in the Axun repo into a issue: https://github.com/tokio-rs/axum/issues/2741

josecelano commented 3 months ago

A PR has been merged in the hyper repo. It changes the http1_header_read_timeout timeout.

image

This could fix this issue. We can try when this change is published in a new release.

josecelano commented 2 months ago

A PR has been merged in the hyper repo. It changes the http1_header_read_timeout timeout.

image

This could fix this issue. We can try when this change is published in a new release.

hyper 1.4.0 has been released with server starting header read timeout immediately (#3185) (0eb1b6cf)

josecelano commented 2 months ago

I've reopened the issue https://github.com/torrust/torrust-tracker/issues/324 to avoid duplicated comments on: