@@ -89,6 +89,7 @@ pub struct Http<E = Exec> {
89
89
h1_half_close : bool ,
90
90
h1_keep_alive : bool ,
91
91
h1_title_case_headers : bool ,
92
+ h1_preserve_header_case : bool ,
92
93
#[ cfg( feature = "http2" ) ]
93
94
h2_builder : proto:: h2:: server:: Config ,
94
95
mode : ConnectionMode ,
@@ -236,6 +237,7 @@ impl Http {
236
237
h1_half_close : false ,
237
238
h1_keep_alive : true ,
238
239
h1_title_case_headers : false ,
240
+ h1_preserve_header_case : false ,
239
241
#[ cfg( feature = "http2" ) ]
240
242
h2_builder : Default :: default ( ) ,
241
243
mode : ConnectionMode :: default ( ) ,
@@ -301,6 +303,19 @@ impl<E> Http<E> {
301
303
self
302
304
}
303
305
306
+ /// Set whether HTTP/1 connections will write header names as provided
307
+ /// at the socket level.
308
+ ///
309
+ /// Note that this setting does not affect HTTP/2.
310
+ ///
311
+ /// Default is false.
312
+ #[ cfg( feature = "http1" ) ]
313
+ #[ cfg_attr( docsrs, doc( cfg( feature = "http1" ) ) ) ]
314
+ pub fn http1_preserve_header_case ( & mut self , enabled : bool ) -> & mut Self {
315
+ self . h1_preserve_header_case = enabled;
316
+ self
317
+ }
318
+
304
319
/// Sets whether HTTP2 is required.
305
320
///
306
321
/// Default is false
@@ -475,6 +490,7 @@ impl<E> Http<E> {
475
490
h1_half_close : self . h1_half_close ,
476
491
h1_keep_alive : self . h1_keep_alive ,
477
492
h1_title_case_headers : self . h1_title_case_headers ,
493
+ h1_preserve_header_case : self . h1_preserve_header_case ,
478
494
#[ cfg( feature = "http2" ) ]
479
495
h2_builder : self . h2_builder ,
480
496
mode : self . mode ,
@@ -533,6 +549,9 @@ impl<E> Http<E> {
533
549
if self . h1_title_case_headers {
534
550
conn. set_title_case_headers( ) ;
535
551
}
552
+ if self . h1_preserve_header_case {
553
+ conn. set_preserve_header_case( ) ;
554
+ }
536
555
conn. set_flush_pipeline( self . pipeline_flush) ;
537
556
if let Some ( max) = self . max_buf_size {
538
557
conn. set_max_buf_size( max) ;
0 commit comments