File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ futures-channel = { version = "0.3", optional = true }
31
31
futures-util = { version = " 0.3" , default-features = false , optional = true }
32
32
h2 = { version = " 0.4.2" , optional = true }
33
33
http-body-util = { version = " 0.1" , optional = true }
34
- httparse = { version = " 1.8 " , optional = true }
34
+ httparse = { version = " 1.9 " , optional = true }
35
35
httpdate = { version = " 1.0" , optional = true }
36
36
itoa = { version = " 1" , optional = true }
37
37
pin-project-lite = { version = " 0.2.4" , optional = true }
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ pin_project_lite::pin_project! {
69
69
/// to bind the built connection to a service.
70
70
#[ derive( Clone , Debug ) ]
71
71
pub struct Builder {
72
+ h1_parser_config : httparse:: ParserConfig ,
72
73
timer : Time ,
73
74
h1_half_close : bool ,
74
75
h1_keep_alive : bool ,
@@ -274,6 +275,19 @@ impl Builder {
274
275
self
275
276
}
276
277
278
+ /// Set whether HTTP/1 connections will silently ignored malformed header lines.
279
+ ///
280
+ /// If this is enabled and a header line does not start with a valid header
281
+ /// name, or does not include a colon at all, the line will be silently ignored
282
+ /// and no error will be reported.
283
+ ///
284
+ /// Default is false.
285
+ pub fn ignore_invalid_headers ( & mut self , enabled : bool ) -> & mut Builder {
286
+ self . h1_parser_config
287
+ . ignore_invalid_headers_in_requests ( enabled) ;
288
+ self
289
+ }
290
+
277
291
/// Set whether to support preserving original header cases.
278
292
///
279
293
/// Currently, this will record the original cases received, and store them
@@ -426,6 +440,7 @@ impl Builder {
426
440
I : Read + Write + Unpin ,
427
441
{
428
442
let mut conn = proto:: Conn :: new ( io) ;
443
+ conn. set_h1_parser_config ( self . h1_parser_config . clone ( ) ) ;
429
444
conn. set_timer ( self . timer . clone ( ) ) ;
430
445
if !self . h1_keep_alive {
431
446
conn. disable_keep_alive ( ) ;
You can’t perform that action at this time.
0 commit comments