@@ -1063,6 +1063,39 @@ impl Builder {
10631063 self
10641064 }
10651065
1066+ /// Sets whether invalid header lines should be silently ignored in HTTP/1 responses.
1067+ ///
1068+ /// This mimicks the behaviour of major browsers. You probably don't want this.
1069+ /// You should only want this if you are implementing a proxy whose main
1070+ /// purpose is to sit in front of browsers whose users access arbitrary content
1071+ /// which may be malformed, and they expect everything that works without
1072+ /// the proxy to keep working with the proxy.
1073+ ///
1074+ /// This option will prevent Hyper's client from returning an error encountered
1075+ /// when parsing a header, except if the error was caused by the character NUL
1076+ /// (ASCII code 0), as Chrome specifically always reject those.
1077+ ///
1078+ /// The ignorable errors are:
1079+ /// * empty header names;
1080+ /// * characters that are not allowed in header names, except for `\0` and `\r`;
1081+ /// * when `allow_spaces_after_header_name_in_responses` is not enabled,
1082+ /// spaces and tabs between the header name and the colon;
1083+ /// * missing colon between header name and colon;
1084+ /// * characters that are not allowed in header values except for `\0` and `\r`.
1085+ ///
1086+ /// If an ignorable error is encountered, the parser tries to find the next
1087+ /// line in the input to resume parsing the rest of the headers. An error
1088+ /// will be emitted nonetheless if it finds `\0` or a lone `\r` while
1089+ /// looking for the next line.
1090+ pub fn http1_ignore_invalid_headers_in_responses (
1091+ & mut self ,
1092+ val : bool ,
1093+ ) -> & mut Builder {
1094+ self . conn_builder
1095+ . http1_ignore_invalid_headers_in_responses ( val) ;
1096+ self
1097+ }
1098+
10661099 /// Set whether HTTP/1 connections should try to use vectored writes,
10671100 /// or always flatten into a single buffer.
10681101 ///
0 commit comments