Skip to content

Commit

Permalink
Support both http 0.2 and 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemo157 committed Nov 22, 2023
1 parent 260213b commit e718f1c
Show file tree
Hide file tree
Showing 7 changed files with 491 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ jobs:
- native-certs
- gzip
- brotli
- http
- http-interop
- http http-interop
env:
RUST_BACKTRACE: "1"
RUSTFLAGS: "-D dead_code -D unused-variables -D unused"
Expand Down
14 changes: 13 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ cookies = ["dep:cookie", "dep:cookie_store"]
socks-proxy = ["dep:socks"]
gzip = ["dep:flate2"]
brotli = ["dep:brotli-decompressor"]
http-interop = ["dep:http"]
http-interop = ["dep:http-02"]
http = ["dep:http"]

[dependencies]
base64 = "0.21"
Expand All @@ -45,6 +46,7 @@ rustls-native-certs = { version = "0.6", optional = true }
native-tls = { version = "0.2", optional = true }
flate2 = { version = "1.0.22", optional = true }
brotli-decompressor = { version = "2.3.2", optional = true }
http-02 = { package = "http", version = "0.2", optional = true }
http = { version = "1.0", optional = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub fn get_header<'h>(headers: &'h [Header], name: &str) -> Option<&'h str> {
.and_then(|h| h.value())
}

#[cfg(any(doc, all(test, feature = "http-interop")))]
#[cfg(any(doc, all(test, any(feature = "http-interop", feature = "http"))))]
pub fn get_header_raw<'h>(headers: &'h [Header], name: &str) -> Option<&'h [u8]> {
headers
.iter()
Expand Down
Loading

0 comments on commit e718f1c

Please sign in to comment.