@@ -120,6 +120,7 @@ struct Config {
120
120
http09_responses : bool ,
121
121
http1_title_case_headers : bool ,
122
122
http1_allow_obsolete_multiline_headers_in_responses : bool ,
123
+ http1_ignore_invalid_headers_in_responses : bool ,
123
124
http2_initial_stream_window_size : Option < u32 > ,
124
125
http2_initial_connection_window_size : Option < u32 > ,
125
126
http2_adaptive_window : bool ,
@@ -201,6 +202,7 @@ impl ClientBuilder {
201
202
http09_responses : false ,
202
203
http1_title_case_headers : false ,
203
204
http1_allow_obsolete_multiline_headers_in_responses : false ,
205
+ http1_ignore_invalid_headers_in_responses : false ,
204
206
http2_initial_stream_window_size : None ,
205
207
http2_initial_connection_window_size : None ,
206
208
http2_adaptive_window : false ,
@@ -620,6 +622,10 @@ impl ClientBuilder {
620
622
builder. http1_allow_obsolete_multiline_headers_in_responses ( true ) ;
621
623
}
622
624
625
+ if config. http1_ignore_invalid_headers_in_responses {
626
+ builder. http1_ignore_invalid_headers_in_responses ( true ) ;
627
+ }
628
+
623
629
let proxies_maybe_http_auth = proxies. iter ( ) . any ( |p| p. maybe_has_http_auth ( ) ) ;
624
630
625
631
Ok ( Client {
@@ -1015,6 +1021,12 @@ impl ClientBuilder {
1015
1021
self
1016
1022
}
1017
1023
1024
+ /// Sets whether invalid header lines should be silently ignored in HTTP/1 responses.
1025
+ pub fn http1_ignore_invalid_headers_in_responses ( mut self , value : bool ) -> ClientBuilder {
1026
+ self . config . http1_ignore_invalid_headers_in_responses = value;
1027
+ self
1028
+ }
1029
+
1018
1030
/// Only use HTTP/1.
1019
1031
pub fn http1_only ( mut self ) -> ClientBuilder {
1020
1032
self . config . http_version_pref = HttpVersionPref :: Http1 ;
@@ -1873,6 +1885,10 @@ impl Config {
1873
1885
f. field ( "http1_allow_obsolete_multiline_headers_in_responses" , & true ) ;
1874
1886
}
1875
1887
1888
+ if self . http1_ignore_invalid_headers_in_responses {
1889
+ f. field ( "http1_ignore_invalid_headers_in_responses" , & true ) ;
1890
+ }
1891
+
1876
1892
if matches ! ( self . http_version_pref, HttpVersionPref :: Http1 ) {
1877
1893
f. field ( "http1_only" , & true ) ;
1878
1894
}
0 commit comments