Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client-builder): Add http2_max_header_list_size to the client builder #2465

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added method to config
  • Loading branch information
DSharifi committed Oct 29, 2024
commit 4962722869fa5640234386cdfbd851163628b0d5
17 changes: 17 additions & 0 deletions src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ struct Config {
#[cfg(feature = "http2")]
http2_max_frame_size: Option<u32>,
#[cfg(feature = "http2")]
http2_max_header_list_size: Option<u32>,
#[cfg(feature = "http2")]
http2_keep_alive_interval: Option<Duration>,
#[cfg(feature = "http2")]
http2_keep_alive_timeout: Option<Duration>,
Expand Down Expand Up @@ -246,6 +248,8 @@ impl ClientBuilder {
#[cfg(feature = "http2")]
http2_max_frame_size: None,
#[cfg(feature = "http2")]
http2_max_header_list_size: None,
#[cfg(feature = "http2")]
http2_keep_alive_interval: None,
#[cfg(feature = "http2")]
http2_keep_alive_timeout: None,
Expand Down Expand Up @@ -741,6 +745,9 @@ impl ClientBuilder {
if let Some(http2_max_frame_size) = config.http2_max_frame_size {
builder.http2_max_frame_size(http2_max_frame_size);
}
if let Some(http2_max_header_list_size_kib) = config.http2_max_header_list_size {
builder.http2_max_header_list_size(http2_max_header_list_size_kib);
}
if let Some(http2_keep_alive_interval) = config.http2_keep_alive_interval {
builder.http2_keep_alive_interval(http2_keep_alive_interval);
}
Expand Down Expand Up @@ -1308,6 +1315,16 @@ impl ClientBuilder {
self
}

/// Sets the maximum size of received header frames for HTTP2.
///
/// Default is currently 16KB, but can change.
#[cfg(feature = "http2")]
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
pub fn http2_max_header_list_size(mut self, max_header_size_bytes: u32) -> ClientBuilder {
self.config.http2_max_header_list_size = Some(max_header_size_bytes);
self
}

/// Sets an interval for HTTP2 Ping frames should be sent to keep a connection alive.
///
/// Pass `None` to disable HTTP2 keep-alive.
Expand Down