@@ -92,6 +92,7 @@ struct Config {
92
92
#[ cfg( feature = "__tls" ) ]
93
93
tls : TlsBackend ,
94
94
http2_only : bool ,
95
+ http1_writev : Option < bool > ,
95
96
http1_title_case_headers : bool ,
96
97
http2_initial_stream_window_size : Option < u32 > ,
97
98
http2_initial_connection_window_size : Option < u32 > ,
@@ -142,6 +143,7 @@ impl ClientBuilder {
142
143
#[ cfg( feature = "__tls" ) ]
143
144
tls : TlsBackend :: default ( ) ,
144
145
http2_only : false ,
146
+ http1_writev : None ,
145
147
http1_title_case_headers : false ,
146
148
http2_initial_stream_window_size : None ,
147
149
http2_initial_connection_window_size : None ,
@@ -299,6 +301,10 @@ impl ClientBuilder {
299
301
builder. http2_only ( true ) ;
300
302
}
301
303
304
+ if let Some ( http1_writev) = config. http1_writev {
305
+ builder. http1_writev ( http1_writev) ;
306
+ }
307
+
302
308
if let Some ( http2_initial_stream_window_size) = config. http2_initial_stream_window_size {
303
309
builder. http2_initial_stream_window_size ( http2_initial_stream_window_size) ;
304
310
}
@@ -632,6 +638,14 @@ impl ClientBuilder {
632
638
self
633
639
}
634
640
641
+ /// Force hyper to use either queued(if true), or flattened(if false) write strategy
642
+ /// This may eliminate unnecessary cloning of buffers for some TLS backends
643
+ /// By default hyper will try to guess which strategy to use
644
+ pub fn http1_writev ( mut self , writev : bool ) -> ClientBuilder {
645
+ self . config . http1_writev = Some ( writev) ;
646
+ self
647
+ }
648
+
635
649
/// Only use HTTP/2.
636
650
pub fn http2_prior_knowledge ( mut self ) -> ClientBuilder {
637
651
self . config . http2_only = true ;
0 commit comments