From 2281fcdb5bc2c2e35cfe2c68aedc3a001d463c56 Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 14 Apr 2024 20:54:01 -0500 Subject: [PATCH] Start upgrading to http1 --- Cargo.lock | 341 +++++++++++++++++++++++++++++++++----------- Cargo.toml | 12 +- src/admin/client.rs | 11 +- src/extractors.rs | 4 + src/http1.rs | 18 +++ src/main.rs | 1 + src/requests.rs | 6 +- src/routes/media.rs | 7 +- 8 files changed, 303 insertions(+), 97 deletions(-) create mode 100644 src/http1.rs diff --git a/Cargo.lock b/Cargo.lock index c470bab..e59d8f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,8 +75,8 @@ dependencies = [ "encoding_rs", "flate2", "futures-core", - "h2", - "http", + "h2 0.3.26", + "http 0.2.12", "httparse", "httpdate", "itoa", @@ -100,7 +100,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -110,7 +110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" dependencies = [ "bytestring", - "http", + "http 0.2.12", "regex", "serde", "tracing", @@ -413,7 +413,7 @@ dependencies = [ "pin-project-lite", "quanta", "rand", - "reqwest", + "reqwest 0.12.3", "reqwest-middleware", "reqwest-tracing", "ring", @@ -489,7 +489,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -500,7 +500,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -526,11 +526,11 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "itoa", - "matchit", + "matchit 0.7.3", "memchr", "mime", "percent-encoding", @@ -552,8 +552,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -854,7 +854,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -1096,7 +1096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -1408,7 +1408,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -1496,7 +1496,26 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.1.0", "indexmap 2.2.6", "slab", "tokio", @@ -1575,7 +1594,7 @@ dependencies = [ "markup5ever", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -1589,6 +1608,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -1596,7 +1626,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -1611,14 +1664,14 @@ dependencies = [ [[package]] name = "http-signature-normalization-actix" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0fb2730dc2a3a91b3386b6f7bd2b0414a707f33f5617cf7e1cba8562b1ea557" +checksum = "44ea11b9048dc1400f0579c48e50caf4424089d6cf978180705370ec3fe78f10" dependencies = [ "actix-http", "actix-rt", "actix-web", - "base64 0.21.7", + "base64 0.22.0", "futures-core", "http-signature-normalization", "ring", @@ -1632,15 +1685,15 @@ dependencies = [ [[package]] name = "http-signature-normalization-reqwest" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86048ef6b1d59bcb2cdde0100bb16b1a29ce78ab6dd4a90706ba0791a2831b5a" +checksum = "b8822f7eab343cae1ce3bd3b6d0b9b58c72adaf3463627cfe150f8f5406f27aa" dependencies = [ "async-trait", - "base64 0.21.7", + "base64 0.22.0", "http-signature-normalization", "httpdate", - "reqwest", + "reqwest 0.12.3", "reqwest-middleware", "ring", "thiserror", @@ -1674,9 +1727,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -1688,6 +1741,27 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -1695,25 +1769,62 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "rustls 0.21.10", "tokio", "tokio-rustls 0.24.1", ] +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.2.0", + "hyper-util", + "rustls 0.22.3", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.25.0", + "tower-service", +] + [[package]] name = "hyper-timeout" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.28", "pin-project-lite", "tokio", "tokio-io-timeout", ] +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.2.0", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1994,6 +2105,12 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "matchit" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e8fcd7bd6025a951597d6ba2f8e48a121af7e262f2b52a006a09c8d61f9304" + [[package]] name = "md5" version = "0.7.0" @@ -2018,12 +2135,14 @@ dependencies = [ [[package]] name = "metrics-exporter-prometheus" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bf4e7146e30ad172c42c39b3246864bd2d3c6396780711a1baf749cfe423e21" +checksum = "5d58e362dc7206e9456ddbcdbd53c71ba441020e62104703075a69151e38d85f" dependencies = [ - "base64 0.21.7", - "hyper", + "base64 0.22.0", + "http-body-util", + "hyper 1.2.0", + "hyper-util", "indexmap 2.2.6", "ipnet", "metrics", @@ -2031,6 +2150,7 @@ dependencies = [ "quanta", "thiserror", "tokio", + "tracing", ] [[package]] @@ -2314,7 +2434,7 @@ checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" dependencies = [ "async-trait", "futures-core", - "http", + "http 0.2.12", "opentelemetry", "opentelemetry-proto", "opentelemetry-semantic-conventions", @@ -2585,7 +2705,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2623,7 +2743,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2736,7 +2856,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2958,11 +3078,11 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-rustls 0.24.2", "ipnet", "js-sys", "log", @@ -2987,38 +3107,81 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots", - "winreg", + "webpki-roots 0.25.4", + "winreg 0.50.0", +] + +[[package]] +name = "reqwest" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e6cc1e89e689536eb5aeede61520e874df5a4707df811cd5da4aa5fbb2aae19" +dependencies = [ + "base64 0.22.0", + "bytes", + "futures-core", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.2.0", + "hyper-rustls 0.26.0", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.22.3", + "rustls-pemfile 2.1.2", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls 0.25.0", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots 0.26.1", + "winreg 0.52.0", ] [[package]] name = "reqwest-middleware" -version = "0.2.5" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a735987236a8e238bf0296c7e351b999c188ccc11477f311b82b55c93984216" +checksum = "0209efb52486ad88136190094ee214759ef7507068b27992256ed6610eb71a01" dependencies = [ "anyhow", "async-trait", - "http", - "reqwest", + "http 1.1.0", + "reqwest 0.12.3", "serde", - "task-local-extensions", "thiserror", + "tower-service", ] [[package]] name = "reqwest-tracing" -version = "0.4.8" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190838e54153d7a7e2ea98851304b3ce92daeabf14c54d32b01b84a3e636f683" +checksum = "b253954a1979e02eabccd7e9c3d61d8f86576108baa160775e7f160bb4e800a3" dependencies = [ "anyhow", "async-trait", "getrandom", - "matchit", - "reqwest", + "http 1.1.0", + "matchit 0.8.0", + "reqwest 0.12.3", "reqwest-middleware", - "task-local-extensions", "tracing", ] @@ -3290,7 +3453,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3533,9 +3696,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ "proc-macro2", "quote", @@ -3587,15 +3750,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" -[[package]] -name = "task-local-extensions" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba323866e5d033818e3240feeb9f7db2c4296674e4d9e16b97b7bf8f490434e8" -dependencies = [ - "pin-utils", -] - [[package]] name = "teloxide" version = "0.12.2" @@ -3640,7 +3794,7 @@ dependencies = [ "once_cell", "pin-project", "rc-box", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "serde_with_macros", @@ -3693,7 +3847,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3790,7 +3944,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3884,10 +4038,10 @@ dependencies = [ "axum", "base64 0.21.7", "bytes", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", @@ -3911,10 +4065,10 @@ dependencies = [ "axum", "base64 0.21.7", "bytes", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", @@ -3992,7 +4146,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -4215,7 +4369,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", "wasm-bindgen-shared", ] @@ -4249,7 +4403,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4299,6 +4453,15 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[package]] +name = "webpki-roots" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi" version = "0.3.9" @@ -4479,6 +4642,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "wyz" version = "0.5.1" @@ -4514,7 +4687,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 35e35db..362f893 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ dashmap = "5.1.0" dotenv = "0.15.0" lru = "0.12.0" metrics = "0.22.0" -metrics-exporter-prometheus = { version = "0.13.0", default-features = false, features = [ +metrics-exporter-prometheus = { version = "0.14.0", default-features = false, features = [ "http-listener", ] } metrics-util = "0.16.0" @@ -53,9 +53,9 @@ pin-project-lite = "0.2.9" # pinned to metrics-util quanta = "0.12.0" rand = "0.8" -reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "stream"]} -reqwest-middleware = "0.2" -reqwest-tracing = "0.4.5" +reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "stream"]} +reqwest-middleware = { version = "0.3", default-features = false, features = ["json"] } +reqwest-tracing = "0.5.0" ring = "0.17.5" rsa = "0.9" rsa-magic-public-key = "0.8.0" @@ -91,12 +91,12 @@ default-features = false features = ["error-logging", "metrics", "tokio"] [dependencies.http-signature-normalization-actix] -version = "0.11.0" +version = "0.11.1" default-features = false features = ["server", "ring"] [dependencies.http-signature-normalization-reqwest] -version = "0.11.0" +version = "0.12.0" default-features = false features = ["middleware", "ring"] diff --git a/src/admin/client.rs b/src/admin/client.rs index 88151e1..af61e1e 100644 --- a/src/admin/client.rs +++ b/src/admin/client.rs @@ -5,7 +5,6 @@ use crate::{ error::{Error, ErrorKind}, extractors::XApiToken, }; -use actix_web::http::header::Header; use reqwest_middleware::ClientWithMiddleware; use serde::de::DeserializeOwned; @@ -87,13 +86,17 @@ async fn get_results( let res = client .get(iri.as_str()) - .header(XApiToken::name(), x_api_token.to_string()) + .header(XApiToken::http1_name(), x_api_token.to_string()) .send() .await .map_err(|e| ErrorKind::SendRequest(iri.to_string(), e.to_string()))?; if !res.status().is_success() { - return Err(ErrorKind::Status(iri.to_string(), res.status()).into()); + return Err(ErrorKind::Status( + iri.to_string(), + crate::http1::status_to_http02(res.status()), + ) + .into()); } let t = res @@ -116,7 +119,7 @@ async fn post_domains( let res = client .post(iri.as_str()) - .header(XApiToken::name(), x_api_token.to_string()) + .header(XApiToken::http1_name(), x_api_token.to_string()) .json(&Domains { domains }) .send() .await diff --git a/src/extractors.rs b/src/extractors.rs index d179906..4545199 100644 --- a/src/extractors.rs +++ b/src/extractors.rs @@ -163,6 +163,10 @@ impl XApiToken { pub(crate) fn new(token: String) -> Self { Self(token) } + + pub(crate) const fn http1_name() -> reqwest::header::HeaderName { + reqwest::header::HeaderName::from_static("x-api-token") + } } impl Header for XApiToken { diff --git a/src/http1.rs b/src/http1.rs new file mode 100644 index 0000000..510c830 --- /dev/null +++ b/src/http1.rs @@ -0,0 +1,18 @@ +pub(crate) fn name_to_http02( + name: &reqwest::header::HeaderName, +) -> actix_web::http::header::HeaderName { + actix_web::http::header::HeaderName::from_bytes(name.as_ref()) + .expect("headername conversions always work") +} + +pub(crate) fn value_to_http02( + value: &reqwest::header::HeaderValue, +) -> actix_web::http::header::HeaderValue { + actix_web::http::header::HeaderValue::from_bytes(value.as_bytes()) + .expect("headervalue conversions always work") +} + +pub(crate) fn status_to_http02(status: reqwest::StatusCode) -> actix_web::http::StatusCode { + actix_web::http::StatusCode::from_u16(status.as_u16()) + .expect("statuscode conversions always work") +} diff --git a/src/main.rs b/src/main.rs index 67c4379..a7c71f3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,6 +33,7 @@ mod db; mod error; mod extractors; mod future; +mod http1; mod jobs; mod middleware; mod requests; diff --git a/src/requests.rs b/src/requests.rs index 60cc9af..36760c2 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -229,7 +229,11 @@ impl Requests { } } - return Err(ErrorKind::Status(parsed_url.to_string(), status).into()); + return Err(ErrorKind::Status( + parsed_url.to_string(), + crate::http1::status_to_http02(status), + ) + .into()); } // only actually succeed a breaker on 2xx response diff --git a/src/routes/media.rs b/src/routes/media.rs index 4c9b260..1a38882 100644 --- a/src/routes/media.rs +++ b/src/routes/media.rs @@ -19,10 +19,13 @@ pub(crate) async fn route( .fetch_response(&url, BreakerStrategy::Allow404AndBelow) .await?; - let mut response = HttpResponse::build(res.status()); + let mut response = HttpResponse::build(crate::http1::status_to_http02(res.status())); for (name, value) in res.headers().iter().filter(|(h, _)| *h != "connection") { - response.insert_header((name.clone(), value.clone())); + response.insert_header(( + crate::http1::name_to_http02(name), + crate::http1::value_to_http02(value), + )); } return Ok(response.body(BodyStream::new(res.bytes_stream()))); -- 2.43.0