fix(server): panic on max_buf_size too small

This commit is contained in:
Evan Simmons
2018-04-17 15:26:58 -07:00
parent 4ea5472f90
commit aac250f29d
4 changed files with 28 additions and 0 deletions

View File

@@ -148,7 +148,15 @@ impl Http {
/// Set the maximum buffer size for the connection.
///
/// Default is ~400kb.
///
/// # Panics
///
/// The minimum value allowed is 8192. This method panics if the passed `max` is less than the minimum.
pub fn max_buf_size(&mut self, max: usize) -> &mut Self {
assert!(
max >= proto::h1::MINIMUM_MAX_BUFFER_SIZE,
"the max_buf_size cannot be smaller than the minimum that h1 specifies."
);
self.max_buf_size = Some(max);
self
}