Respect SETTINGS_HEADER_TABLE_SIZE (#459)

This commit is contained in:
Sean McArthur
2020-03-30 11:53:22 -07:00
committed by GitHub
parent 20efc46597
commit e41a1f130c
7 changed files with 121 additions and 3 deletions

View File

@@ -271,6 +271,11 @@ impl<T, B> FramedWrite<T, B> {
self.max_frame_size = val as FrameSize;
}
/// Set the peer's header table size.
pub fn set_header_table_size(&mut self, val: usize) {
self.hpack.update_max_size(val);
}
/// Retrieve the last data frame that has been sent
pub fn take_last_data_frame(&mut self) -> Option<frame::Data<B>> {
self.last_data_frame.take()

View File

@@ -89,6 +89,11 @@ impl<T, B> Codec<T, B> {
self.framed_write().set_max_frame_size(val)
}
/// Set the peer's header table size size.
pub fn set_send_header_table_size(&mut self, val: usize) {
self.framed_write().set_header_table_size(val)
}
/// Set the max header list size that can be received.
pub fn set_max_recv_header_list_size(&mut self, val: usize) {
self.inner.set_max_header_list_size(val);

View File

@@ -107,6 +107,16 @@ impl Settings {
self.enable_push = Some(enable as u32);
}
pub fn header_table_size(&self) -> Option<u32> {
self.header_table_size
}
/*
pub fn set_header_table_size(&mut self, size: Option<u32>) {
self.header_table_size = size;
}
*/
pub fn load(head: Head, payload: &[u8]) -> Result<Settings, Error> {
use self::Setting::*;

View File

@@ -46,7 +46,6 @@ impl Encoder {
/// Queues a max size update.
///
/// The next call to `encode` will include a dynamic size update frame.
#[allow(dead_code)]
pub fn update_max_size(&mut self, val: usize) {
match self.size_update {
Some(SizeUpdate::One(old)) => {

View File

@@ -117,6 +117,10 @@ impl Settings {
log::trace!("ACK sent; applying settings");
if let Some(val) = settings.header_table_size() {
dst.set_send_header_table_size(val as usize);
}
if let Some(val) = settings.max_frame_size() {
dst.set_max_send_frame_size(val as usize);
}