1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-26 15:07:42 +02:00

fix request head timeout (#2611)

This commit is contained in:
Rob Ede
2022-01-31 17:30:34 +00:00
committed by GitHub
parent b3e84b5c4b
commit 3200de3f34
38 changed files with 1303 additions and 767 deletions

View File

@ -1,4 +1,4 @@
use std::io;
use std::{io, time::Duration};
use actix_http::{error::Error, HttpService, Response};
use actix_server::Server;
@ -19,7 +19,7 @@ async fn h2_ping_pong() -> io::Result<()> {
.workers(1)
.listen("h2_ping_pong", lst, || {
HttpService::build()
.keep_alive(3)
.keep_alive(Duration::from_secs(3))
.h2(|_| async { Ok::<_, Error>(Response::ok()) })
.tcp()
})?
@ -92,10 +92,10 @@ async fn h2_handshake_timeout() -> io::Result<()> {
.workers(1)
.listen("h2_ping_pong", lst, || {
HttpService::build()
.keep_alive(30)
.keep_alive(Duration::from_secs(30))
// set first request timeout to 5 seconds.
// this is the timeout used for http2 handshake.
.client_timeout(5000)
.client_request_timeout(Duration::from_secs(5))
.h2(|_| async { Ok::<_, Error>(Response::ok()) })
.tcp()
})?