feat(client): add conn::Builder::max_buf_size()

This allows users to configure a limit to client connections' read and
write buffers.

Closes #1748
This commit is contained in:
Alexander Mielczarek
2019-01-19 20:52:17 -06:00
committed by Sean McArthur
parent 4dd9437560
commit 078ed82dd5
2 changed files with 35 additions and 0 deletions

View File

@@ -901,6 +901,8 @@ impl Builder {
/// Sets the exact size of the read buffer to *always* use.
///
/// Note that setting this option unsets the `http1_max_buf_size` option.
///
/// Default is an adaptive read buffer.
#[inline]
pub fn http1_read_buf_exact_size(&mut self, sz: usize) -> &mut Self {
@@ -908,6 +910,21 @@ impl Builder {
self
}
/// Set the maximum buffer size for the connection.
///
/// Default is ~400kb.
///
/// Note that setting this option unsets the `http1_read_exact_buf_size` option.
///
/// # Panics
///
/// The minimum value allowed is 8192. This method panics if the passed `max` is less than the minimum.
#[inline]
pub fn http1_max_buf_size(&mut self, max: usize) -> &mut Self {
self.conn_builder.h1_max_buf_size(max);
self
}
/// Set whether HTTP/1 connections will write header names as title case at
/// the socket level.
///