diff --git a/Cargo.lock b/Cargo.lock index 9f77a1487..9362711cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -264,8 +264,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41603f7cdbf5ac4af60760f17253eb6adf6ec5b6f14a7ed830cf687d375f163" dependencies = [ "askama", - "axum-core 0.4.3", - "http 1.1.0", + "axum-core", + "http", ] [[package]] @@ -328,7 +328,7 @@ dependencies = [ "bytes", "fnv", "futures-util", - "http 1.1.0", + "http", "indexmap 2.2.6", "mime", "multer", @@ -356,7 +356,7 @@ checksum = "d94b2673899046dbbb803dff9c400330f7908727f5edb99979c3d841136ee754" dependencies = [ "async-graphql", "async-trait", - "axum 0.7.5", + "axum", "bytes", "futures-util", "serde_json", @@ -488,34 +488,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" -[[package]] -name = "axum" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" -dependencies = [ - "async-trait", - "axum-core 0.3.4", - "bitflags 1.3.2", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", - "itoa 1.0.11", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "sync_wrapper 0.1.2", - "tower", - "tower-layer", - "tower-service", -] - [[package]] name = "axum" version = "0.7.5" @@ -523,15 +495,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", - "axum-core 0.4.3", + "axum-core", "axum-macros", "base64 0.21.7", "bytes", "futures-util", - "http 1.1.0", - "http-body 1.0.0", + "http", + "http-body", "http-body-util", - "hyper 1.3.1", + "hyper", "hyper-util", "itoa 1.0.11", "matchit", @@ -555,23 +527,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "axum-core" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "mime", - "rustversion", - "tower-layer", - "tower-service", -] - [[package]] name = "axum-core" version = "0.4.3" @@ -581,8 +536,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.1.0", - "http-body 1.0.0", + "http", + "http-body", "http-body-util", "mime", "pin-project-lite", @@ -599,14 +554,14 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0be6ea09c9b96cb5076af0de2e383bd2bc0c18f827cf1967bdd353e0b910d733" dependencies = [ - "axum 0.7.5", - "axum-core 0.4.3", + "axum", + "axum-core", "bytes", "cookie", "futures-util", "headers", - "http 1.1.0", - "http-body 1.0.0", + "http", + "http-body", "http-body-util", "mime", "pin-project-lite", @@ -625,11 +580,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1353f895919cf98d30146a7bb8e2275a5f096d1f6252be9101dbd29e8fe22e2f" dependencies = [ "async-trait", - "axum-core 0.4.3", + "axum-core", "axum-extra", "base64 0.21.7", "cookie", - "http 1.1.0", + "http", "serde", "serde_json", "tower-layer", @@ -1523,12 +1478,12 @@ version = "0.0.1-pre.6" dependencies = [ "aliri_braid", "async-trait", - "axum-core 0.4.3", + "axum-core", "blake3", "cookie", "futures-test", "hex-simd", - "http 1.1.0", + "http", "pin-project-lite", "rand 0.8.5", "tower", @@ -2440,25 +2395,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap 2.2.6", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "h2" version = "0.4.4" @@ -2470,7 +2406,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 1.1.0", + "http", "indexmap 2.2.6", "slab", "tokio", @@ -2525,7 +2461,7 @@ dependencies = [ "base64 0.21.7", "bytes", "headers-core", - "http 1.1.0", + "http", "httpdate", "mime", "sha1", @@ -2537,7 +2473,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" dependencies = [ - "http 1.1.0", + "http", ] [[package]] @@ -2676,17 +2612,6 @@ dependencies = [ "syn 2.0.63", ] -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa 1.0.11", -] - [[package]] name = "http" version = "1.1.0" @@ -2698,17 +2623,6 @@ dependencies = [ "itoa 1.0.11", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.0" @@ -2716,7 +2630,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", - "http 1.1.0", + "http", ] [[package]] @@ -2727,19 +2641,11 @@ checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ "bytes", "futures-core", - "http 1.1.0", - "http-body 1.0.0", + "http", + "http-body", "pin-project-lite", ] -[[package]] -name = "http-compat" -version = "0.0.1-pre.6" -dependencies = [ - "http 0.2.12", - "http 1.1.0", -] - [[package]] name = "http-range-header" version = "0.4.1" @@ -2756,7 +2662,7 @@ dependencies = [ "const-oid", "derive_builder", "divan", - "http 1.1.0", + "http", "httpdate", "itertools 0.12.1", "logos 0.14.0", @@ -2800,30 +2706,6 @@ dependencies = [ "libm", ] -[[package]] -name = "hyper" -version = "0.14.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa 1.0.11", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.3.1" @@ -2833,9 +2715,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.4", - "http 1.1.0", - "http-body 1.0.0", + "h2", + "http", + "http-body", "httparse", "httpdate", "itoa 1.0.11", @@ -2852,8 +2734,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "908bb38696d7a037a01ebcc68a00634112ac2bbf8ca74e30a2c3d2f4f021302b" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.3.1", + "http", + "hyper", "hyper-util", "log", "rustls 0.23.5", @@ -2866,14 +2748,15 @@ dependencies = [ [[package]] name = "hyper-timeout" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "hyper 0.14.28", + "hyper", + "hyper-util", "pin-project-lite", "tokio", - "tokio-io-timeout", + "tower-service", ] [[package]] @@ -2885,9 +2768,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", - "http-body 1.0.0", - "hyper 1.3.1", + "http", + "http-body", + "hyper", "pin-project-lite", "socket2", "tokio", @@ -3189,7 +3072,7 @@ dependencies = [ "async-graphql-axum", "async-trait", "athena", - "axum 0.7.5", + "axum", "axum-extra", "axum-flash", "blowocking", @@ -3204,7 +3087,7 @@ dependencies = [ "fs_extra", "futures-util", "headers", - "http 1.1.0", + "http", "http-body-util", "http-signatures", "iso8601-timestamp", @@ -3283,9 +3166,9 @@ dependencies = [ "diesel-async", "futures-util", "headers", - "http 1.1.0", + "http", "http-body-util", - "hyper 1.3.1", + "hyper", "iso8601-timestamp", "kitsune-cache", "kitsune-config", @@ -3341,7 +3224,7 @@ name = "kitsune-captcha" version = "0.0.1-pre.6" dependencies = [ "enum_dispatch", - "http 1.1.0", + "http", "kitsune-error", "kitsune-http-client", "serde", @@ -3477,7 +3360,7 @@ dependencies = [ "diesel", "diesel-async", "embed-sdk", - "http 1.1.0", + "http", "iso8601-timestamp", "kitsune-db", "kitsune-derive", @@ -3492,10 +3375,10 @@ dependencies = [ name = "kitsune-error" version = "0.0.1-pre.6" dependencies = [ - "axum-core 0.4.3", + "axum-core", "eyre", "garde", - "http 1.1.0", + "http", "simd-json", "sync_wrapper 1.0.1", "tracing", @@ -3540,10 +3423,10 @@ dependencies = [ "async-stream", "bytes", "futures-util", - "http-body 1.0.0", + "http-body", "http-body-util", "http-signatures", - "hyper 1.3.1", + "hyper", "hyper-rustls", "hyper-util", "kitsune-type", @@ -3649,8 +3532,7 @@ dependencies = [ "async-trait", "eyre", "http-body-util", - "http-compat", - "hyper 1.3.1", + "hyper", "kitsune-config", "kitsune-http-client", "opentelemetry", @@ -3668,7 +3550,7 @@ name = "kitsune-oidc" version = "0.0.1-pre.6" dependencies = [ "enum_dispatch", - "http 1.1.0", + "http", "http-body-util", "kitsune-config", "kitsune-derive", @@ -3692,7 +3574,7 @@ version = "0.0.1-pre.6" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http", "kitsune-error", "kitsune-http-client", "kitsune-test", @@ -3725,7 +3607,7 @@ dependencies = [ "enum_dispatch", "futures-io", "futures-util", - "http 1.1.0", + "http", "kitsune-config", "kitsune-db", "kitsune-derive", @@ -3758,9 +3640,9 @@ dependencies = [ "futures-util", "garde", "hex-simd", - "http 1.1.0", + "http", "http-body-util", - "hyper 1.3.1", + "hyper", "img-parts", "iso8601-timestamp", "kitsune-activitypub", @@ -3829,7 +3711,7 @@ dependencies = [ "bytes", "diesel-async", "futures-util", - "http 1.1.0", + "http", "http-body-util", "isolang", "kitsune-config", @@ -3922,9 +3804,9 @@ version = "0.0.1-pre.6" dependencies = [ "async-trait", "futures-util", - "http 1.1.0", + "http", "http-body-util", - "hyper 1.3.1", + "hyper", "kitsune-cache", "kitsune-core", "kitsune-error", @@ -4542,7 +4424,7 @@ dependencies = [ "bytes", "encoding_rs", "futures-util", - "http 1.1.0", + "http", "httparse", "memchr", "mime", @@ -4687,7 +4569,7 @@ dependencies = [ "base64 0.22.1", "chrono", "getrandom 0.2.15", - "http 1.1.0", + "http", "rand 0.8.5", "serde", "serde_json", @@ -4746,7 +4628,7 @@ dependencies = [ "dyn-clone", "ed25519-dalek", "hmac", - "http 1.1.0", + "http", "itertools 0.10.5", "log", "oauth2", @@ -4775,8 +4657,7 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "opentelemetry" version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" +source = "git+https://github.com/open-telemetry/opentelemetry-rust.git?rev=b44cb130e4a102b0d676289e91c003f4b1008d08#b44cb130e4a102b0d676289e91c003f4b1008d08" dependencies = [ "futures-core", "futures-sink", @@ -4784,36 +4665,34 @@ dependencies = [ "once_cell", "pin-project-lite", "thiserror", - "urlencoding", ] [[package]] name = "opentelemetry-http" version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7690dc77bf776713848c4faa6501157469017eaf332baccd4eb1cea928743d94" +source = "git+https://github.com/open-telemetry/opentelemetry-rust.git?rev=b44cb130e4a102b0d676289e91c003f4b1008d08#b44cb130e4a102b0d676289e91c003f4b1008d08" dependencies = [ "async-trait", "bytes", - "http 0.2.12", + "http", "opentelemetry", ] [[package]] name = "opentelemetry-otlp" version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" +source = "git+https://github.com/open-telemetry/opentelemetry-rust.git?rev=b44cb130e4a102b0d676289e91c003f4b1008d08#b44cb130e4a102b0d676289e91c003f4b1008d08" dependencies = [ "async-trait", "futures-core", - "http 0.2.12", + "http", "opentelemetry", "opentelemetry-http", "opentelemetry-proto", "opentelemetry-semantic-conventions", "opentelemetry_sdk", "prost", + "serde_json", "thiserror", "tokio", "tonic", @@ -4822,29 +4701,27 @@ dependencies = [ [[package]] name = "opentelemetry-proto" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8fddc9b68f5b80dae9d6f510b88e02396f006ad48cac349411fbecc80caae4" +source = "git+https://github.com/open-telemetry/opentelemetry-rust.git?rev=b44cb130e4a102b0d676289e91c003f4b1008d08#b44cb130e4a102b0d676289e91c003f4b1008d08" dependencies = [ + "hex", "opentelemetry", "opentelemetry_sdk", "prost", + "serde", "tonic", ] [[package]] name = "opentelemetry-semantic-conventions" version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9ab5bd6c42fb9349dcf28af2ba9a0667f697f9bdcca045d39f2cec5543e2910" +source = "git+https://github.com/open-telemetry/opentelemetry-rust.git?rev=b44cb130e4a102b0d676289e91c003f4b1008d08#b44cb130e4a102b0d676289e91c003f4b1008d08" [[package]] name = "opentelemetry_sdk" version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e90c7113be649e31e9a0f8b5ee24ed7a16923b322c3c5ab6367469c049d6b7e" +source = "git+https://github.com/open-telemetry/opentelemetry-rust.git?rev=b44cb130e4a102b0d676289e91c003f4b1008d08#b44cb130e4a102b0d676289e91c003f4b1008d08" dependencies = [ "async-trait", - "crossbeam-channel", "futures-channel", "futures-executor", "futures-util", @@ -4941,7 +4818,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3592c190977a91610618349bd947fec5bf10b2ca1cdc882f6623031de4cd34e1" dependencies = [ - "axum 0.7.5", + "axum", "oxide-auth", ] @@ -7077,16 +6954,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.2.0" @@ -7283,27 +7150,29 @@ dependencies = [ [[package]] name = "tonic" version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +source = "git+https://github.com/hyperium/tonic.git?rev=9b306af386528f11dbd022bc372d367adc4e96b5#9b306af386528f11dbd022bc372d367adc4e96b5" dependencies = [ "async-stream", "async-trait", - "axum 0.6.20", + "axum", "base64 0.21.7", "bytes", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", "prost", + "rustls 0.23.5", "rustls-native-certs", "rustls-pemfile", - "rustls-pki-types", + "socket2", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tokio-stream", "tower", "tower-layer", @@ -7342,8 +7211,8 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "http 1.1.0", - "http-body 1.0.0", + "http", + "http-body", "http-body-util", "http-range-header", "httpdate", @@ -7369,8 +7238,8 @@ dependencies = [ "bytes", "either", "futures-test", - "http 1.1.0", - "http-body 1.0.0", + "http", + "http-body", "http-body-util", "memchr", "pin-project-lite", @@ -7400,7 +7269,7 @@ version = "0.0.1-pre.6" dependencies = [ "either", "futures", - "http 1.1.0", + "http", "once_cell", "regex", "tower", @@ -7413,7 +7282,7 @@ name = "tower-x-clacks-overhead" version = "0.0.1-pre.6" dependencies = [ "futures-test", - "http 1.1.0", + "http", "itertools 0.12.1", "pin-project-lite", "tower", @@ -7491,8 +7360,7 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9be14ba1bbe4ab79e9229f7f89fab8d120b865859f10527f31c033e599d2284" +source = "git+https://github.com/aumetra/tracing-opentelemetry.git?branch=v0.1.x-http1#6f438815e556f95ac15f67c1fe2de395e70a30c3" dependencies = [ "js-sys", "once_cell", @@ -7561,7 +7429,7 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http 1.1.0", + "http", "httparse", "log", "rand 0.8.5", @@ -7758,7 +7626,7 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b39868d43c011961e04b41623e050aedf2cc93652562ff7935ce0f819aaf2da" dependencies = [ - "axum 0.7.5", + "axum", "mime_guess", "regex", "rust-embed", diff --git a/Cargo.toml b/Cargo.toml index 3a25447fe..0b05f2015 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,6 @@ members = [ "lib/blowocking", "lib/cursiv", "lib/geomjeungja", - "lib/http-compat", "lib/http-signatures", "lib/just-retry", "lib/masto-id-convert", @@ -126,3 +125,11 @@ install-updater = true diesel-async = { git = "https://github.com/weiznich/diesel_async.git", rev = "d02798c67065d763154d7272dd0c09b39757d0f2" } scraper = { git = "https://github.com/causal-agent/scraper.git", rev = "d67111f5cc0b7da6e6ff10e4549d87cf09ba3e5b" } tokio-postgres-rustls = { git = "https://github.com/jbg/tokio-postgres-rustls.git", rev = "b16c1bc0f5d4f91324174fd1bd839d743a70f86a" } + +# Patch to make OpenTelemetry with with hyper 1 +opentelemetry = { git = "https://github.com/open-telemetry/opentelemetry-rust.git", rev = "b44cb130e4a102b0d676289e91c003f4b1008d08" } +opentelemetry-http = { git = "https://github.com/open-telemetry/opentelemetry-rust.git", rev = "b44cb130e4a102b0d676289e91c003f4b1008d08" } +opentelemetry-otlp = { git = "https://github.com/open-telemetry/opentelemetry-rust.git", rev = "b44cb130e4a102b0d676289e91c003f4b1008d08" } +opentelemetry_sdk = { git = "https://github.com/open-telemetry/opentelemetry-rust.git", rev = "b44cb130e4a102b0d676289e91c003f4b1008d08" } +tonic = { git = "https://github.com/hyperium/tonic.git", rev = "9b306af386528f11dbd022bc372d367adc4e96b5" } +tracing-opentelemetry = { git = "https://github.com/aumetra/tracing-opentelemetry.git", branch = "v0.1.x-http1" } diff --git a/crates/kitsune-observability/Cargo.toml b/crates/kitsune-observability/Cargo.toml index d206ffc86..2bd58ce84 100644 --- a/crates/kitsune-observability/Cargo.toml +++ b/crates/kitsune-observability/Cargo.toml @@ -9,7 +9,6 @@ license.workspace = true async-trait = "0.1.80" eyre = "0.6.12" http-body-util = "0.1.1" -http-compat = { path = "../../lib/http-compat" } hyper = { version = "1.3.1", default-features = false } kitsune-config = { path = "../kitsune-config" } kitsune-http-client = { path = "../kitsune-http-client" } @@ -19,6 +18,7 @@ opentelemetry = { version = "0.22.0", default-features = false, features = [ opentelemetry-http = "0.11.1" opentelemetry-otlp = { version = "0.15.0", default-features = false, features = [ "grpc-tonic", + "http-json", "http-proto", "tls", "tls-roots", diff --git a/crates/kitsune-observability/src/lib.rs b/crates/kitsune-observability/src/lib.rs index b1bb2147f..47879e081 100644 --- a/crates/kitsune-observability/src/lib.rs +++ b/crates/kitsune-observability/src/lib.rs @@ -1,7 +1,6 @@ use async_trait::async_trait; use eyre::WrapErr; use http_body_util::BodyExt; -use http_compat::Compat; use kitsune_config::{open_telemetry::Transport, Configuration}; use opentelemetry::trace::{noop::NoopTracer, Tracer}; use opentelemetry_http::{Bytes, HttpClient, HttpError, Request, Response}; @@ -34,12 +33,12 @@ impl HttpClient for HttpClientAdapter { let (parts, body) = request.into_parts(); let request = Request::from_parts(parts, body.into()); - let response = self.inner.execute(request.compat()).await?.into_inner(); + let response = self.inner.execute(request).await?.into_inner(); let (parts, body) = response.into_parts(); let body = body.collect().await?.to_bytes(); - Ok(hyper::http::Response::from_parts(parts, body).compat()) + Ok(hyper::http::Response::from_parts(parts, body)) } } diff --git a/lib/http-compat/Cargo.toml b/lib/http-compat/Cargo.toml deleted file mode 100644 index 760c7d238..000000000 --- a/lib/http-compat/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "http-compat" -authors.workspace = true -edition.workspace = true -version.workspace = true -license = "MIT OR Apache-2.0" - -[dependencies] -http02 = { package = "http", version = "0.2.12" } -http1 = { package = "http", version = "1.1.0" } - -[lints] -workspace = true diff --git a/lib/http-compat/LICENSE-APACHE-2.0 b/lib/http-compat/LICENSE-APACHE-2.0 deleted file mode 120000 index bffaaba2f..000000000 --- a/lib/http-compat/LICENSE-APACHE-2.0 +++ /dev/null @@ -1 +0,0 @@ -../../LICENSE-APACHE-2.0 \ No newline at end of file diff --git a/lib/http-compat/LICENSE-MIT b/lib/http-compat/LICENSE-MIT deleted file mode 120000 index b2cfbdc7b..000000000 --- a/lib/http-compat/LICENSE-MIT +++ /dev/null @@ -1 +0,0 @@ -../../LICENSE-MIT \ No newline at end of file diff --git a/lib/http-compat/src/lib.rs b/lib/http-compat/src/lib.rs deleted file mode 100644 index 0df98df32..000000000 --- a/lib/http-compat/src/lib.rs +++ /dev/null @@ -1,8 +0,0 @@ -mod v0_2; -mod v1; - -pub trait Compat { - type Output; - - fn compat(self) -> Self::Output; -} diff --git a/lib/http-compat/src/v0_2.rs b/lib/http-compat/src/v0_2.rs deleted file mode 100644 index 2656d59c2..000000000 --- a/lib/http-compat/src/v0_2.rs +++ /dev/null @@ -1,74 +0,0 @@ -use crate::Compat; -use std::str::FromStr; - -impl Compat for http02::HeaderName { - type Output = http1::HeaderName; - - fn compat(self) -> Self::Output { - http1::HeaderName::from_bytes(self.as_str().as_bytes()).unwrap() - } -} - -impl Compat for http02::HeaderValue { - type Output = http1::HeaderValue; - - fn compat(self) -> Self::Output { - http1::HeaderValue::from_bytes(self.as_bytes()).unwrap() - } -} - -impl Compat for http02::HeaderMap { - type Output = http1::HeaderMap; - - fn compat(self) -> Self::Output { - self.iter() - .map(|(name, value)| (name.clone().compat(), value.clone().compat())) - .collect() - } -} - -impl Compat for http02::Method { - type Output = http1::Method; - - fn compat(self) -> Self::Output { - http1::Method::from_bytes(self.as_str().as_bytes()).unwrap() - } -} - -impl Compat for http02::Request { - type Output = http1::Request; - - fn compat(self) -> Self::Output { - let (parts, body) = self.into_parts(); - let mut req_builder = http1::Request::builder() - .method(parts.method.compat()) - .uri(parts.uri.compat()) - .version(parts.version.compat()); - *req_builder.headers_mut().unwrap() = parts.headers.compat(); - - req_builder.body(body).unwrap() - } -} - -impl Compat for http02::Uri { - type Output = http1::Uri; - - fn compat(self) -> Self::Output { - http1::Uri::from_str(&self.to_string()).unwrap() - } -} - -impl Compat for http02::Version { - type Output = http1::Version; - - fn compat(self) -> Self::Output { - match self { - http02::Version::HTTP_09 => http1::Version::HTTP_09, - http02::Version::HTTP_10 => http1::Version::HTTP_10, - http02::Version::HTTP_11 => http1::Version::HTTP_11, - http02::Version::HTTP_2 => http1::Version::HTTP_2, - http02::Version::HTTP_3 => http1::Version::HTTP_3, - _ => unreachable!(), - } - } -} diff --git a/lib/http-compat/src/v1.rs b/lib/http-compat/src/v1.rs deleted file mode 100644 index 59734ecba..000000000 --- a/lib/http-compat/src/v1.rs +++ /dev/null @@ -1,64 +0,0 @@ -use crate::Compat; - -impl Compat for http1::HeaderName { - type Output = http02::HeaderName; - - fn compat(self) -> Self::Output { - http02::HeaderName::from_bytes(self.as_str().as_bytes()).unwrap() - } -} - -impl Compat for http1::HeaderValue { - type Output = http02::HeaderValue; - - fn compat(self) -> Self::Output { - http02::HeaderValue::from_bytes(self.as_bytes()).unwrap() - } -} - -impl Compat for http1::HeaderMap { - type Output = http02::HeaderMap; - - fn compat(self) -> Self::Output { - self.iter() - .map(|(name, value)| (name.clone().compat(), value.clone().compat())) - .collect() - } -} - -impl Compat for http1::Response { - type Output = http02::Response; - - fn compat(self) -> Self::Output { - let (parts, body) = self.into_parts(); - let mut res_builder = http02::Response::builder() - .status(parts.status.compat()) - .version(parts.version.compat()); - *res_builder.headers_mut().unwrap() = parts.headers.compat(); - - res_builder.body(body).unwrap() - } -} - -impl Compat for http1::StatusCode { - type Output = http02::StatusCode; - - fn compat(self) -> Self::Output { - http02::StatusCode::from_u16(self.as_u16()).unwrap() - } -} - -impl Compat for http1::Version { - type Output = http02::Version; - - fn compat(self) -> Self::Output { - match self { - http1::Version::HTTP_09 => http02::Version::HTTP_09, - http1::Version::HTTP_10 => http02::Version::HTTP_10, - http1::Version::HTTP_11 => http02::Version::HTTP_11, - http1::Version::HTTP_2 => http02::Version::HTTP_2, - http1::Version::HTTP_3 => http02::Version::HTTP_3, - _ => unreachable!(), - } - } -}