Skip to content

Commit 81e25fa

Browse files
noxseanmonstar
authored andcommittedOct 27, 2022
feat(client): allow ignoring HTTP/1 invalid header lines in requests
1 parent 274edad commit 81e25fa

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
 

‎Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ http = "0.2"
2828
http-body = "1.0.0-rc.1"
2929
http-body-util = { version = "0.1.0-rc.1", optional = true }
3030
httpdate = "1.0"
31-
httparse = "1.6"
31+
httparse = "1.8"
3232
h2 = { version = "0.3.9", optional = true }
3333
itoa = "1"
3434
tracing = { version = "0.1", default-features = false, features = ["std"] }

‎src/client/conn/http1.rs

+18
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,24 @@ impl Builder {
390390
self
391391
}
392392

393+
/// Set whether HTTP/1 connections will silently ignored malformed header lines.
394+
///
395+
/// If this is enabled and and a header line does not start with a valid header
396+
/// name, or does not include a colon at all, the line will be silently ignored
397+
/// and no error will be reported.
398+
///
399+
/// Note that this setting does not affect HTTP/2.
400+
///
401+
/// Default is false.
402+
pub fn http1_ignore_invalid_headers_in_responses(
403+
&mut self,
404+
enabled: bool,
405+
) -> &mut Builder {
406+
self.h1_parser_config
407+
.ignore_invalid_headers_in_responses(enabled);
408+
self
409+
}
410+
393411
/// Set whether HTTP/1 connections should try to use vectored writes,
394412
/// or always flatten into a single buffer.
395413
///

0 commit comments

Comments
 (0)
Please sign in to comment.