Skip to content

Commit

Permalink
http1 expose ignore_invalid_headers_in_requests opt
Browse files Browse the repository at this point in the history
  • Loading branch information
GlenDC committed Jan 9, 2025
1 parent e981a91 commit 129a448
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 22 deletions.
49 changes: 27 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ repository = "https://github.com/hyperium/hyper"
license = "MIT"
authors = ["Sean McArthur <[email protected]>"]
keywords = ["http", "hyper", "hyperium"]
categories = ["network-programming", "web-programming::http-client", "web-programming::http-server"]
categories = [
"network-programming",
"web-programming::http-client",
"web-programming::http-server",
]
edition = "2021"
rust-version = "1.63" # keep in sync with MSRV.md dev doc

include = [
"Cargo.toml",
"LICENSE",
"src/**/*",
]
include = ["Cargo.toml", "LICENSE", "src/**/*"]

[dependencies]
bytes = "1.2"
Expand All @@ -31,18 +31,26 @@ futures-channel = { version = "0.3", optional = true }
futures-util = { version = "0.3", default-features = false, optional = true }
h2 = { version = "0.4.2", optional = true }
http-body-util = { version = "0.1", optional = true }
httparse = { version = "1.8", optional = true }
httparse = { version = "1.9", optional = true }
httpdate = { version = "1.0", optional = true }
itoa = { version = "1", optional = true }
pin-project-lite = { version = "0.2.4", optional = true }
smallvec = { version = "1.12", features = ["const_generics", "const_new"], optional = true }
tracing = { version = "0.1", default-features = false, features = ["std"], optional = true }
smallvec = { version = "1.12", features = [
"const_generics",
"const_new",
], optional = true }
tracing = { version = "0.1", default-features = false, features = [
"std",
], optional = true }
want = { version = "0.3", optional = true }

[dev-dependencies]
form_urlencoded = "1"
futures-channel = { version = "0.3", features = ["sink"] }
futures-util = { version = "0.3", default-features = false, features = ["alloc", "sink"] }
futures-util = { version = "0.3", default-features = false, features = [
"alloc",
"sink",
] }
http-body-util = "0.1"
pretty_env_logger = "0.5"
pin-project-lite = "0.2.4"
Expand All @@ -69,12 +77,7 @@ tokio-util = "0.7.10"
default = []

# Easily turn it all on
full = [
"client",
"http1",
"http2",
"server",
]
full = ["client", "http1", "http2", "server"]

# HTTP versions
http1 = ["dep:futures-channel", "dep:futures-util", "dep:httparse", "dep:itoa"]
Expand All @@ -96,14 +99,16 @@ nightly = []

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = [
'cfg(hyper_unstable_tracing)',
'cfg(hyper_unstable_ffi)'
]
check-cfg = ['cfg(hyper_unstable_tracing)', 'cfg(hyper_unstable_ffi)']

[package.metadata.docs.rs]
features = ["ffi", "full", "tracing"]
rustdoc-args = ["--cfg", "hyper_unstable_ffi", "--cfg", "hyper_unstable_tracing"]
rustdoc-args = [
"--cfg",
"hyper_unstable_ffi",
"--cfg",
"hyper_unstable_tracing",
]

[package.metadata.playground]
features = ["full"]
Expand All @@ -113,7 +118,7 @@ generation = false
subdirectory = false

[package.metadata.capi.install.include]
asset = [{ from="capi/include/hyper.h" }]
asset = [{ from = "capi/include/hyper.h" }]

[profile.release]
codegen-units = 1
Expand Down
13 changes: 13 additions & 0 deletions src/client/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,19 @@ impl Builder {
self
}

/// Set whether HTTP/1 connections will silently ignored malformed header lines.
///
/// If this is enabled and a header line does not start with a valid header
/// name, or does not include a colon at all, the line will be silently ignored
/// and no error will be reported.
///
/// Default is false.
pub fn ignore_invalid_headers_in_requests(&mut self, enabled: bool) -> &mut Builder {
self.h1_parser_config
.ignore_invalid_headers_in_requests(enabled);
self
}

/// Set whether HTTP/1 connections should try to use vectored writes,
/// or always flatten into a single buffer.
///
Expand Down

0 comments on commit 129a448

Please sign in to comment.