diff --git a/pingora-core/src/protocols/http/server.rs b/pingora-core/src/protocols/http/server.rs index 49423e93..f246f308 100644 --- a/pingora-core/src/protocols/http/server.rs +++ b/pingora-core/src/protocols/http/server.rs @@ -188,8 +188,19 @@ impl Session { } } + /// Sets the downstream read timeout. This will trigger if we're unable + /// to read from the stream after `timeout`. + /// + /// This is a noop for h2. + pub fn set_read_timeout(&mut self, timeout: Duration) { + match self { + Self::H1(s) => s.set_read_timeout(timeout), + Self::H2(_) => {} + } + } + /// Sets the downstream write timeout. This will trigger if we're unable - /// to write to the stream after `duration`. If a `min_send_rate` is + /// to write to the stream after `timeout`. If a `min_send_rate` is /// configured then the `min_send_rate` calculated timeout has higher priority. /// /// This is a noop for h2. @@ -207,7 +218,7 @@ impl Session { /// rate must be greater than zero. /// /// Calculated write timeout is guaranteed to be at least 1s if `min_send_rate` - /// is greater than zero, a send rate of zero is a noop. + /// is greater than zero, a send rate of zero is a noop.x /// /// This is a noop for h2. pub fn set_min_send_rate(&mut self, rate: usize) { diff --git a/pingora-core/src/protocols/http/v1/server.rs b/pingora-core/src/protocols/http/v1/server.rs index 4d8a21f9..bfe486ab 100644 --- a/pingora-core/src/protocols/http/v1/server.rs +++ b/pingora-core/src/protocols/http/v1/server.rs @@ -823,8 +823,14 @@ impl HttpSession { } } + /// Sets the downstream read timeout. This will trigger if we're unable + /// to read from the stream after `timeout`. + pub fn set_read_timeout(&mut self, timeout: Duration) { + self.read_timeout = Some(timeout); + } + /// Sets the downstream write timeout. This will trigger if we're unable - /// to write to the stream after `duration`. If a `min_send_rate` is + /// to write to the stream after `timeout`. If a `min_send_rate` is /// configured then the `min_send_rate` calculated timeout has higher priority. pub fn set_write_timeout(&mut self, timeout: Duration) { self.write_timeout = Some(timeout);