-
Notifications
You must be signed in to change notification settings - Fork 68
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
How to set up a timeout for TLS hasdshake #116
Comments
It seems it was removed on the migration to Hyper 1.0.. |
I'm trying to determine how to set the timeout with the new version. It seems Hyper 1.0 supports adding the timeout. I have been able to make at least Hyper panic with; let mut server = axum_server::from_tcp(socket);
server.http_builder().http1().header_read_timeout(Duration::from_secs(5));
server.http_builder().http2().keep_alive_timeout(Duration::from_secs(5));
server
.handle(handle)
.serve(router.into_make_service_with_connect_info::<std::net::SocketAddr>())
.await
.expect("Axum server crashed.") The panic message:
I guess there is still something missing. I would appreciate an example of how you can set it up. In the meantime, I would keep trying. If I find the solution, I will open a PR with a new example. |
I've managed to remove the panic with the following: let mut server = axum_server::from_tcp(socket);
server.http_builder().http1().timer(TokioTimer::new());
server.http_builder().http1().header_read_timeout(Duration::from_secs(5));
server.http_builder().http2().keep_alive_timeout(Duration::from_secs(5));
server
.handle(handle)
.serve(router.into_make_service_with_connect_info::<std::net::SocketAddr>())
.await
.expect("Axum server crashed.") But it's not working. |
I have created an example here: https://github.com/josecelano/axum-server-timeout I've only been able to set a timeout for sending the headers with |
Related to: torrust/torrust-tracker#324 (comment) |
I've updated the example with the @programatik29's patch. It works partially because it closes the connection, but it does not return a |
Relates to: tokio-rs/axum#2741 (comment) |
There is a new hyper version 1.4.0 which changes the |
The TLS handshake timeout for axum-server/src/tls_rustls/mod.rs Lines 101 to 102 in f657a97
|
Hi @finnbear thank your feedback. In the end, it was not precisely the handshake timeout that I was trying to find. I want to set a timeout for the time the server waits after opening a connection for the first request to come. I implemented this example to reproduce what I wan to achieve: |
Relates to:
I'm using
axum-server
ina couple of projects and I would like to add a timeout for the TLS handshake.I've seen that that feature was added here: #39. However, It seems the
AddrIncomingConfig
was removed. I don't see any example or documentation to set the tcp_keepalive duration in the latest version. Was that feature removed @programatik29?Originally posted by @josecelano in #29 (comment)
The text was updated successfully, but these errors were encountered: