Expose http1_writev config option to user (#1040)
This commit is contained in:
		| @@ -92,6 +92,7 @@ struct Config { | ||||
|     #[cfg(feature = "__tls")] | ||||
|     tls: TlsBackend, | ||||
|     http2_only: bool, | ||||
|     http1_writev: Option<bool>, | ||||
|     http1_title_case_headers: bool, | ||||
|     http2_initial_stream_window_size: Option<u32>, | ||||
|     http2_initial_connection_window_size: Option<u32>, | ||||
| @@ -142,6 +143,7 @@ impl ClientBuilder { | ||||
|                 #[cfg(feature = "__tls")] | ||||
|                 tls: TlsBackend::default(), | ||||
|                 http2_only: false, | ||||
|                 http1_writev: None, | ||||
|                 http1_title_case_headers: false, | ||||
|                 http2_initial_stream_window_size: None, | ||||
|                 http2_initial_connection_window_size: None, | ||||
| @@ -299,6 +301,10 @@ impl ClientBuilder { | ||||
|             builder.http2_only(true); | ||||
|         } | ||||
|  | ||||
|         if let Some(http1_writev) = config.http1_writev { | ||||
|             builder.http1_writev(http1_writev); | ||||
|         } | ||||
|  | ||||
|         if let Some(http2_initial_stream_window_size) = config.http2_initial_stream_window_size { | ||||
|             builder.http2_initial_stream_window_size(http2_initial_stream_window_size); | ||||
|         } | ||||
| @@ -632,6 +638,14 @@ impl ClientBuilder { | ||||
|         self | ||||
|     } | ||||
|  | ||||
|     /// Force hyper to use either queued(if true), or flattened(if false) write strategy | ||||
|     /// This may eliminate unnecessary cloning of buffers for some TLS backends | ||||
|     /// By default hyper will try to guess which strategy to use | ||||
|     pub fn http1_writev(mut self, writev: bool) -> ClientBuilder { | ||||
|         self.config.http1_writev = Some(writev); | ||||
|         self | ||||
|     } | ||||
|  | ||||
|     /// Only use HTTP/2. | ||||
|     pub fn http2_prior_knowledge(mut self) -> ClientBuilder { | ||||
|         self.config.http2_only = true; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user