diff --git a/Cargo.lock b/Cargo.lock index 873f306f5..6dc04eb9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,7 +77,7 @@ checksum = "d1eb7c4fcde1858a6796c18a729b661346d38e05a207e2d9028bce822fc20283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -201,7 +201,7 @@ dependencies = [ "argh_shared", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -252,13 +252,13 @@ dependencies = [ [[package]] name = "askama_axum" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b336dea26a2eb67f04e1134385721f794b654a870ce5146d2fcb69ea39c3a4" +checksum = "a41603f7cdbf5ac4af60760f17253eb6adf6ec5b6f14a7ed830cf687d375f163" dependencies = [ "askama", - "axum-core", - "http", + "axum-core 0.4.2", + "http 1.0.0", ] [[package]] @@ -274,7 +274,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -332,9 +332,9 @@ dependencies = [ [[package]] name = "async-graphql" -version = "6.0.11" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298a5d587d6e6fdb271bf56af2dc325a80eb291fd0fc979146584b9a05494a8c" +checksum = "8ad990024653fd2d0321a568f64e620404a894047b2ab8c475f7452c8bb82cf6" dependencies = [ "async-graphql-derive", "async-graphql-parser", @@ -346,7 +346,7 @@ dependencies = [ "bytes", "fnv", "futures-util", - "http", + "http 1.0.0", "indexmap 2.1.0", "mime", "multer", @@ -368,13 +368,13 @@ dependencies = [ [[package]] name = "async-graphql-axum" -version = "6.0.11" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a1c20a2059bffbc95130715b23435a05168c518fba9709c81fa2a38eed990c" +checksum = "eb1c9aed04854fb55a9d3fbab94e013cfc7ca5e3cead0b49b439884f8a467039" dependencies = [ "async-graphql", "async-trait", - "axum", + "axum 0.7.3", "bytes", "futures-util", "serde_json", @@ -386,9 +386,9 @@ dependencies = [ [[package]] name = "async-graphql-derive" -version = "6.0.11" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f329c7eb9b646a72f70c9c4b516c70867d356ec46cb00dcac8ad343fd006b0" +checksum = "3909cc7228128099b603d057e5a920b9499ce24299f8f680d5d1f213d7b830c0" dependencies = [ "Inflector", "async-graphql-parser", @@ -397,15 +397,15 @@ dependencies = [ "proc-macro2", "quote", "strum", - "syn 2.0.46", + "syn 2.0.48", "thiserror", ] [[package]] name = "async-graphql-parser" -version = "6.0.11" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6139181845757fd6a73fbb8839f3d036d7150b798db0e9bb3c6e83cdd65bd53b" +checksum = "5ceb02570faf16e3b6775cc286b1f0fb2e4eb846144a08c130ca5ad6e25219fe" dependencies = [ "async-graphql-value", "pest", @@ -415,9 +415,9 @@ dependencies = [ [[package]] name = "async-graphql-value" -version = "6.0.11" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "323a5143f5bdd2030f45e3f2e0c821c9b1d36e79cf382129c64299c50a7f3750" +checksum = "516317bb55d143cc47941c0cb952134dd207c5ab3c839ee226eedd6dd9a96f43" dependencies = [ "bytes", "indexmap 2.1.0", @@ -455,14 +455,14 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] name = "async-task" -version = "4.6.0" +version = "4.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d90cd0b264dfdd8eb5bad0a2c217c1f88fa96a8573f40e7b12de23fb468f46" +checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" @@ -472,7 +472,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -548,7 +548,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -558,16 +558,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.3.4", + "bitflags 1.3.2", + "bytes", + "futures-util", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", + "itoa 1.0.10", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d09dbe0e490df5da9d69b36dca48a76635288a82f92eca90024883a56202026d" +dependencies = [ + "async-trait", + "axum-core 0.4.2", "axum-macros", "base64 0.21.5", - "bitflags 1.3.2", "bytes", "futures-util", - "headers", - "http", - "http-body", - "hyper", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.1.0", + "hyper-util", "itoa 1.0.10", "matchit", "memchr", @@ -587,6 +615,7 @@ dependencies = [ "tower", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -598,8 +627,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.11", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -607,45 +636,45 @@ dependencies = [ ] [[package]] -name = "axum-extra" -version = "0.7.7" +name = "axum-core" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a93e433be9382c737320af3924f7d5fc6f89c155cf2bf88949d8f5126fab283f" +checksum = "e87c8503f93e6d144ee5690907ba22db7ba79ab001a932ab99034f0fe836b3df" dependencies = [ - "axum", - "axum-core", + "async-trait", "bytes", - "cookie 0.17.0", "futures-util", - "http", - "http-body", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", "mime", "pin-project-lite", - "serde", - "tokio", - "tower", + "rustversion", + "sync_wrapper", "tower-layer", "tower-service", + "tracing", ] [[package]] name = "axum-extra" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ab90e7b70bea63a153137162affb6a0bce26b584c24a4c7885509783e2cf30b" +checksum = "881348a37b079994894b6e5e46edcc4b8a60e1c0333669a65b810abeed780598" dependencies = [ - "axum", - "axum-core", + "axum 0.7.3", + "axum-core 0.4.2", "bytes", - "cookie 0.17.0", + "cookie", "futures-util", - "http", - "http-body", + "headers", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", "mime", "pin-project-lite", "serde", "serde_html_form", - "tokio", "tower", "tower-layer", "tower-service", @@ -653,16 +682,16 @@ dependencies = [ [[package]] name = "axum-flash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d104c8fdd083e19a9ba8b579b1c10ecea38c131a65acdea052a6af561d397" +checksum = "1353f895919cf98d30146a7bb8e2275a5f096d1f6252be9101dbd29e8fe22e2f" dependencies = [ "async-trait", - "axum-core", - "axum-extra 0.7.7", + "axum-core 0.4.2", + "axum-extra", "base64 0.21.5", - "cookie 0.17.0", - "http", + "cookie", + "http 1.0.0", "serde", "serde_json", "tower-layer", @@ -671,14 +700,14 @@ dependencies = [ [[package]] name = "axum-macros" -version = "0.3.8" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdca6a10ecad987bda04e95606ef85a5417dcaac1a78455242d72e031e2b6b62" +checksum = "5a2edad600410b905404c594e2523549f1bcd4bded1e252c8f74524ccce0b867" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -1082,9 +1111,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.12" +version = "4.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" +checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" dependencies = [ "clap_builder", "clap_derive", @@ -1112,7 +1141,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -1124,7 +1153,7 @@ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "client-sdk-common" version = "0.1.0" -source = "git+https://github.com/Lantern-chat/client-sdk-rs#c43a3ad1642551cff159e8f45d4f4fc9057078fa" +source = "git+https://github.com/Lantern-chat/client-sdk-rs#7bd4194259a4fe429bf121b0252e165006603c00" dependencies = [ "rkyv", "serde", @@ -1235,9 +1264,9 @@ dependencies = [ [[package]] name = "cookie" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" +checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" dependencies = [ "base64 0.21.5", "hmac", @@ -1249,17 +1278,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "cookie" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - [[package]] name = "core-foundation" version = "0.9.4" @@ -1278,9 +1296,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -1430,7 +1448,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -1470,12 +1488,12 @@ version = "0.0.1-pre.4" dependencies = [ "aliri_braid", "async-trait", - "axum-core", + "axum-core 0.4.2", "blake3", - "cookie 0.18.0", + "cookie", "futures", "hex-simd", - "http", + "http 1.0.0", "pin-project-lite", "rand 0.8.5", "tower", @@ -1507,7 +1525,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -1555,7 +1573,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -1577,7 +1595,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -1725,7 +1743,7 @@ checksum = "2bba3e9872d7c58ce7ef0fcf1844fcc3e23ef2a58377b50df35dd98e42a5726e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -1766,7 +1784,7 @@ dependencies = [ "diesel_table_macro_syntax", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -1795,7 +1813,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" dependencies = [ - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -1996,7 +2014,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -2269,7 +2287,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -2335,9 +2353,9 @@ dependencies = [ [[package]] name = "garde" -version = "0.16.3" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f0bde634ca1248cfcd67a29f7b3798997d328406020f5e19b502b0a0d5e8cae" +checksum = "0237d668ccb63fd96dff6a81c5f37b7d984872f9584794dc1d1a62472d2c7b57" dependencies = [ "compact_str", "garde_derive", @@ -2350,14 +2368,14 @@ dependencies = [ [[package]] name = "garde_derive" -version = "0.16.3" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feafd106c73dd61d6f10f2fa782cdb6212b3422aee5b953a094818e9575078aa" +checksum = "4a42efb40be9de1926cfd15881ff08adb7a70c6cedacced425537c8b1f96ac4f" dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -2451,7 +2469,26 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.11", + "indexmap 2.1.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d308f63daf4181410c242d34c11f928dcb3aa105852019e043c9d1f4e4368a" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.0.0", "indexmap 2.1.0", "slab", "tokio", @@ -2505,14 +2542,14 @@ dependencies = [ [[package]] name = "headers" -version = "0.3.9" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" +checksum = "322106e6bd0cba2d5ead589ddb8150a13d7c4217cf80d7c4f682ca994ccc6aa9" dependencies = [ "base64 0.21.5", "bytes", "headers-core", - "http", + "http 1.0.0", "httpdate", "mime", "sha1", @@ -2520,11 +2557,11 @@ dependencies = [ [[package]] name = "headers-core" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" dependencies = [ - "http", + "http 1.0.0", ] [[package]] @@ -2609,6 +2646,17 @@ dependencies = [ "itoa 1.0.10", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa 1.0.10", +] + [[package]] name = "http-body" version = "0.4.6" @@ -2616,15 +2664,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.11", + "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.0.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", "pin-project-lite", ] +[[package]] +name = "http-compat" +version = "0.0.1-pre.4" +dependencies = [ + "http 0.2.11", + "http 1.0.0", +] + [[package]] name = "http-range-header" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" +checksum = "3ce4ef31cda248bbdb6e6820603b82dfcd9e833db65a43e997a0ccec777d11fe" [[package]] name = "httparse" @@ -2657,9 +2736,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.22", + "http 0.2.11", + "http-body 0.4.6", "httparse", "httpdate", "itoa 1.0.10", @@ -2672,19 +2751,41 @@ dependencies = [ ] [[package]] -name = "hyper-rustls" -version = "0.24.2" +name = "hyper" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" dependencies = [ + "bytes", + "futures-channel", "futures-util", - "http", - "hyper", + "h2 0.4.0", + "http 1.0.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa 1.0.10", + "pin-project-lite", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.25.0" +source = "git+https://github.com/rustls/hyper-rustls.git?rev=8e502d807f637709b4d88c34d6bf7d921272a36a#8e502d807f637709b4d88c34d6bf7d921272a36a" +dependencies = [ + "futures-util", + "http 1.0.0", + "hyper 1.1.0", + "hyper-util", "log", - "rustls 0.21.10", - "rustls-native-certs", + "rustls 0.22.1", + "rustls-native-certs 0.7.0", + "rustls-pki-types", "tokio", - "tokio-rustls 0.24.1", + "tokio-rustls 0.25.0", + "tower-service", ] [[package]] @@ -2693,12 +2794,32 @@ 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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "hyper 1.1.0", + "pin-project-lite", + "socket2 0.5.5", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.59" @@ -2846,7 +2967,7 @@ dependencies = [ "encoding_rs", "event-listener 2.5.3", "futures-lite 1.13.0", - "http", + "http 0.2.11", "log", "mime", "once_cell", @@ -2943,8 +3064,8 @@ dependencies = [ "async-graphql-axum", "async-trait", "athena", - "axum", - "axum-extra 0.8.0", + "axum 0.7.3", + "axum-extra", "axum-flash", "bytes", "camino", @@ -2959,8 +3080,8 @@ dependencies = [ "fs_extra", "futures-util", "headers", - "http", - "hyper", + "http 1.0.0", + "http-body-util", "iso8601-timestamp", "kitsune-activitypub", "kitsune-blocking", @@ -3035,8 +3156,9 @@ dependencies = [ "diesel-async", "futures-util", "headers", - "http", - "hyper", + "http 1.0.0", + "http-body-util", + "hyper 1.1.0", "iso8601-timestamp", "kitsune-cache", "kitsune-config", @@ -3104,7 +3226,7 @@ name = "kitsune-captcha" version = "0.0.1-pre.4" dependencies = [ "enum_dispatch", - "http", + "http 1.0.0", "kitsune-http-client", "serde", "serde_urlencoded", @@ -3149,7 +3271,7 @@ version = "0.0.1-pre.4" dependencies = [ "async-trait", "const_format", - "http", + "http 1.0.0", "kitsune-db", "kitsune-messaging", "serde", @@ -3211,7 +3333,7 @@ dependencies = [ "diesel", "diesel-async", "embed-sdk", - "http", + "http 1.0.0", "iso8601-timestamp", "kitsune-db", "kitsune-http-client", @@ -3255,15 +3377,18 @@ dependencies = [ name = "kitsune-http-client" version = "0.0.1-pre.4" dependencies = [ + "async-stream", "bytes", - "futures-core", + "futures-util", "headers", - "http-body", - "hyper", + "http-body 1.0.0", + "http-body-util", + "hyper 1.1.0", "hyper-rustls", + "hyper-util", "kitsune-http-signatures", "kitsune-type", - "pin-project-lite", + "pin-project", "serde", "simd-json", "tokio", @@ -3277,7 +3402,7 @@ version = "0.0.1-pre.4" dependencies = [ "base64-simd", "derive_builder", - "http", + "http 1.0.0", "kitsune-blocking", "pem", "pkcs8", @@ -3396,7 +3521,9 @@ name = "kitsune-observability" version = "0.0.1-pre.4" dependencies = [ "async-trait", - "hyper", + "http-body-util", + "http-compat", + "hyper 1.1.0", "kitsune-config", "kitsune-http-client", "metrics", @@ -3420,8 +3547,8 @@ version = "0.0.1-pre.4" dependencies = [ "deadpool-redis", "enum_dispatch", - "http", - "hyper", + "http 1.0.0", + "http-compat", "kitsune-config", "kitsune-http-client", "miette", @@ -3491,8 +3618,9 @@ dependencies = [ "futures-util", "garde", "hex-simd", - "http", - "hyper", + "http 1.0.0", + "http-body-util", + "hyper 1.1.0", "img-parts", "iso8601-timestamp", "kitsune-activitypub", @@ -3548,8 +3676,7 @@ dependencies = [ "bytes", "derive_more 1.0.0-beta.6", "futures-util", - "http", - "hyper", + "http 1.0.0", "kitsune-http-client", "rusty-s3", "tempfile", @@ -3561,12 +3688,13 @@ dependencies = [ name = "kitsune-test" version = "0.0.1-pre.4" dependencies = [ + "bytes", "deadpool-redis", "diesel", "diesel-async", "futures-util", - "http", - "hyper", + "http 1.0.0", + "http-body-util", "kitsune-db", "pin-project-lite", "redis", @@ -3617,8 +3745,9 @@ dependencies = [ "autometrics", "deadpool-redis", "futures-util", - "http", - "hyper", + "http 1.0.0", + "http-body-util", + "hyper 1.1.0", "kitsune-cache", "kitsune-core", "kitsune-http-client", @@ -3818,7 +3947,7 @@ checksum = "de09dc283fb2f502fd8173d200675ea5ac0559f37c67b77166d75a67565c0e3d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -3869,7 +3998,7 @@ dependencies = [ "proc-macro2", "quote", "regex-syntax 0.6.29", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -4016,30 +4145,18 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "metrics" -version = "0.21.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" +checksum = "77b9e10a211c839210fd7f99954bda26e5f8e26ec686ad68da6a32df7c80e782" dependencies = [ "ahash 0.8.7", - "metrics-macros", "portable-atomic", ] -[[package]] -name = "metrics-macros" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.46", -] - [[package]] name = "metrics-opentelemetry" version = "0.1.0" -source = "git+https://github.com/aumetra/metrics-opentelemetry.git?rev=d4762c6704ecac8bca8f14ee201ce83d652c382a#d4762c6704ecac8bca8f14ee201ce83d652c382a" +source = "git+https://github.com/aumetra/metrics-opentelemetry.git?rev=b2e2586da553ebd62abdcd3bfd04b5f41a32449a#b2e2586da553ebd62abdcd3bfd04b5f41a32449a" dependencies = [ "metrics", "opentelemetry", @@ -4048,10 +4165,11 @@ dependencies = [ [[package]] name = "metrics-tracing-context" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec95d1490f2b7e2d49462f9d75aa4fed52cc21e0b40aefc5987c6f404d40a2" +checksum = "fb791d015f8947acf5a7f62bd28d00f289bb7ea98cfbe3ffec1d061eee12df12" dependencies = [ + "indexmap 2.1.0", "itoa 1.0.10", "lockfree-object-pool", "metrics", @@ -4064,9 +4182,9 @@ dependencies = [ [[package]] name = "metrics-util" -version = "0.15.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de2ed6e491ed114b40b732e4d1659a9d53992ebd87490c44a6ffe23739d973e" +checksum = "2670b8badcc285d486261e2e9f1615b506baff91427b61bd336a472b65bbf5ed" dependencies = [ "aho-corasick", "crossbeam-epoch", @@ -4075,8 +4193,8 @@ dependencies = [ "indexmap 1.9.3", "metrics", "num_cpus", - "ordered-float 3.9.2", - "quanta", + "ordered-float 4.2.0", + "quanta 0.12.2", "radix_trie", "sketches-ddsketch", ] @@ -4110,7 +4228,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -4205,7 +4323,7 @@ dependencies = [ "crossbeam-utils", "once_cell", "parking_lot", - "quanta", + "quanta 0.11.1", "rustc_version", "skeptic", "smallvec", @@ -4217,9 +4335,9 @@ dependencies = [ [[package]] name = "mrml" -version = "2.1.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b6cbfe1ae1e7de18c2a51b9709a5f859bfacca91fc1029d8947ae77fe0f652" +checksum = "119192bf8e556b94c06ae02afb46680f76704abba2def85e2e5f5f8418b4db81" dependencies = [ "indexmap 2.1.0", "mrml-macros", @@ -4234,7 +4352,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c141a78933cb6151e19b1d3daacfd5d2903bc1caf96f6424b6eccc48ca8ce00f" dependencies = [ - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -4247,19 +4365,19 @@ dependencies = [ "mrml-common-macros", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] name = "multer" -version = "2.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" +checksum = "a15d522be0a9c3e46fd2632e272d178f56387bdb5c9fbb3a36c649062e9b5219" dependencies = [ "bytes", "encoding_rs", "futures-util", - "http", + "http 1.0.0", "httparse", "log", "memchr", @@ -4351,7 +4469,7 @@ checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -4434,7 +4552,7 @@ dependencies = [ "base64 0.13.1", "chrono", "getrandom 0.2.11", - "http", + "http 0.2.11", "rand 0.8.5", "serde", "serde_json", @@ -4476,7 +4594,7 @@ dependencies = [ "dyn-clone", "ed25519-dalek", "hmac", - "http", + "http 0.2.11", "itertools", "log", "oauth2", @@ -4549,7 +4667,7 @@ checksum = "7f51189ce8be654f9b5f7e70e49967ed894e84a06fc35c6c042e64ac1fc5399e" dependencies = [ "async-trait", "bytes", - "http", + "http 0.2.11", "opentelemetry", ] @@ -4561,7 +4679,7 @@ checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" dependencies = [ "async-trait", "futures-core", - "http", + "http 0.2.11", "opentelemetry", "opentelemetry-http", "opentelemetry-proto", @@ -4596,9 +4714,9 @@ dependencies = [ [[package]] name = "opentelemetry_sdk" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968ba3f2ca03e90e5187f5e4f46c791ef7f2c163ae87789c8ce5f5ca3b7b7de5" +checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4" dependencies = [ "async-trait", "crossbeam-channel", @@ -4631,15 +4749,6 @@ dependencies = [ "num-traits 0.2.17", ] -[[package]] -name = "ordered-float" -version = "3.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" -dependencies = [ - "num-traits 0.2.17", -] - [[package]] name = "ordered-float" version = "4.2.0" @@ -4703,11 +4812,11 @@ dependencies = [ [[package]] name = "oxide-auth-axum" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5c4549a915268feef20fabcf85acd0172c0840c756a5d3974ca528100e52dcc" +checksum = "3592c190977a91610618349bd947fec5bf10b2ca1cdc882f6623031de4cd34e1" dependencies = [ - "axum", + "axum 0.7.3", "oxide-auth", ] @@ -4808,9 +4917,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" dependencies = [ "memchr", "thiserror", @@ -4937,7 +5046,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -4984,7 +5093,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -5184,9 +5293,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.74" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] @@ -5264,7 +5373,22 @@ dependencies = [ "libc", "mach2", "once_cell", - "raw-cpuid", + "raw-cpuid 10.7.0", + "wasi 0.11.0+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + +[[package]] +name = "quanta" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid 11.0.1", "wasi 0.11.0+wasi-snapshot-preview1", "web-sys", "winapi", @@ -5397,6 +5521,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "raw-cpuid" +version = "11.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" +dependencies = [ + "bitflags 2.4.1", +] + [[package]] name = "rayon" version = "1.8.0" @@ -5434,7 +5567,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls 0.21.10", - "rustls-native-certs", + "rustls-native-certs 0.6.3", "rustls-pemfile 1.0.4", "rustls-webpki 0.101.7", "ryu", @@ -5484,7 +5617,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -5708,7 +5841,7 @@ dependencies = [ "quote", "rust-embed-utils", "shellexpand", - "syn 2.0.46", + "syn 2.0.48", "walkdir", ] @@ -5795,6 +5928,19 @@ dependencies = [ "security-framework", ] +[[package]] +name = "rustls-native-certs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.0.0", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -6025,9 +6171,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] @@ -6044,13 +6190,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -6068,9 +6214,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.110" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fbd975230bada99c8bb618e0c365c2eefa219158d5c6c29610fd09ff1833257" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa 1.0.10", "ryu", @@ -6154,7 +6300,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -6179,7 +6325,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -6278,9 +6424,9 @@ dependencies = [ [[package]] name = "simd-json" -version = "0.13.4" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a3720326b20bf5b95b72dbbd133caae7e0dcf71eae8f6e6656e71a7e5c9aaa" +checksum = "0c58001aca67fc467da571f35e7e1dc9c094e91b099cc54bd3cead2962db2432" dependencies = [ "getrandom 0.2.11", "halfbrown", @@ -6413,7 +6559,7 @@ checksum = "c87e960f4dca2788eeb86bbdde8dd246be8948790b7618d656e68f9b720a86e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -6535,7 +6681,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -6585,9 +6731,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.46" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -6690,7 +6836,7 @@ checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -6796,7 +6942,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -6871,9 +7017,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" dependencies = [ "futures-util", "log", @@ -6963,20 +7109,20 @@ checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" dependencies = [ "async-stream", "async-trait", - "axum", + "axum 0.6.20", "base64 0.21.5", "bytes", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.22", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", "prost", - "rustls-native-certs", + "rustls-native-certs 0.6.3", "rustls-pemfile 1.0.4", "tokio", "tokio-rustls 0.24.1", @@ -7009,17 +7155,17 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.4.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" +checksum = "09e12e6351354851911bdf8c2b8f2ab15050c567d70a8b9a37ae7b8301a4080d" dependencies = [ "async-compression", "bitflags 2.4.1", "bytes", - "futures-core", "futures-util", - "http", - "http-body", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", "http-range-header", "httpdate", "iri-string", @@ -7052,7 +7198,7 @@ name = "tower-x-clacks-overhead" version = "0.0.1-pre.4" dependencies = [ "futures", - "http", + "http 1.0.0", "pin-project-lite", "tower", "tower-layer", @@ -7079,7 +7225,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -7169,14 +7315,14 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 1.0.0", "httparse", "log", "rand 0.8.5", @@ -7203,7 +7349,7 @@ checksum = "982ee4197351b5c9782847ef5ec1fdcaf50503fb19d68f9771adae314e72b492" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -7336,17 +7482,17 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.46", + "syn 2.0.48", "uuid", ] [[package]] name = "utoipa-swagger-ui" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "154517adf0d0b6e22e8e1f385628f14fcaa3db43531dc74303d3edef89d6dfe5" +checksum = "f839caa8e09dddc3ff1c3112a91ef7da0601075ba5025d9f33ae99c4cb9b6e51" dependencies = [ - "axum", + "axum 0.7.3", "mime_guess", "regex", "rust-embed", @@ -7484,7 +7630,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -7518,7 +7664,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7560,11 +7706,11 @@ dependencies = [ [[package]] name = "whatlang" -version = "0.16.3" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcdcd0195a5b871e50926da8e881277f36a4621b3220d85092e7b91cc85f6bd9" +checksum = "471d1c1645d361eb782a1650b1786a8fb58dd625e681a04c09f5ff7c8764a7b0" dependencies = [ - "hashbrown 0.12.3", + "hashbrown 0.14.3", "once_cell", ] @@ -7824,9 +7970,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.31" +version = "0.5.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" +checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" dependencies = [ "memchr", ] @@ -7899,7 +8045,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -7919,7 +8065,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index cc6e0eff7..997f56bf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,6 @@ lto = true strip = true [workspace] -exclude = ["xtask"] members = [ "crates/kitsune-activitypub", "crates/kitsune-blocking", @@ -46,6 +45,7 @@ members = [ "kitsune-job-runner", "lib/athena", "lib/cursiv", + "lib/http-compat", "lib/masto-id-convert", "lib/post-process", "lib/speedy-uuid", @@ -65,6 +65,7 @@ cast_sign_loss = "allow" module_name_repetitions = "allow" missing_errors_doc = "allow" missing_panics_doc = "allow" +no_effect_underscore_binding = "allow" [workspace.lints.rust] forbidden_lint_groups = "allow" diff --git a/crates/kitsune-activitypub/Cargo.toml b/crates/kitsune-activitypub/Cargo.toml index c501cc6ef..5c91494be 100644 --- a/crates/kitsune-activitypub/Cargo.toml +++ b/crates/kitsune-activitypub/Cargo.toml @@ -11,8 +11,9 @@ base64-simd = { version = "0.8.0", features = ["unstable"] } diesel = "2.1.4" diesel-async = "0.4.1" futures-util = "0.3.30" -headers = "0.3.9" -http = "0.2.11" +headers = "0.4.0" +http = "1.0.0" +http-body-util = "0.1.0" iso8601-timestamp = "0.2.16" kitsune-cache = { path = "../kitsune-cache" } kitsune-core = { path = "../kitsune-core" } @@ -31,9 +32,9 @@ mime = "0.3.17" mime_guess = { version = "2.0.4", default-features = false } rsa = "0.9.6" scoped-futures = "0.1.3" -serde = "1.0.194" +serde = "1.0.195" sha2 = "0.10.8" -simd-json = { version = "0.13.4", features = ["hints"] } +simd-json = { version = "0.13.6", features = ["hints"] } speedy-uuid = { path = "../../lib/speedy-uuid" } thiserror = "1.0.56" tracing = "0.1.40" @@ -44,7 +45,7 @@ url = "2.5.0" sha2 = { version = "0.10.8", features = ["asm"] } [dev-dependencies] -hyper = "0.14.28" +hyper = "1.1.0" kitsune-config = { path = "../kitsune-config" } kitsune-test = { path = "../kitsune-test" } kitsune-webfinger = { path = "../kitsune-webfinger" } diff --git a/crates/kitsune-activitypub/src/deliverer/core.rs b/crates/kitsune-activitypub/src/deliverer/core.rs index 864e43ef2..46e3bfc3a 100644 --- a/crates/kitsune-activitypub/src/deliverer/core.rs +++ b/crates/kitsune-activitypub/src/deliverer/core.rs @@ -26,8 +26,8 @@ pub struct Deliverer { impl Deliverer { /// Deliver the activity to an inbox - #[instrument(skip_all, fields(%inbox_url, activity_url = %activity.id))] #[autometrics(track_concurrency)] + #[instrument(skip_all, fields(%inbox_url, activity_url = %activity.id))] pub async fn deliver( &self, inbox_url: &str, diff --git a/crates/kitsune-activitypub/tests/fetcher/filter.rs b/crates/kitsune-activitypub/tests/fetcher/filter.rs index 92442104c..8546b7768 100644 --- a/crates/kitsune-activitypub/tests/fetcher/filter.rs +++ b/crates/kitsune-activitypub/tests/fetcher/filter.rs @@ -1,5 +1,6 @@ use super::handle::handle; -use hyper::{Body, Request, Response}; +use http_body_util::Empty; +use hyper::{body::Bytes, Request, Response}; use kitsune_activitypub::{error::Error, Fetcher}; use kitsune_cache::NoopCache; use kitsune_config::instance::FederationFilterConfiguration; @@ -32,7 +33,7 @@ async fn federation_allow() { let client = service_fn( #[allow(unreachable_code)] // https://github.com/rust-lang/rust/issues/67227 |_: Request<_>| async { - panic!("Requested a denied domain") as Result, Infallible> + panic!("Requested a denied domain") as Result>, Infallible> }, ); let client = Client::builder().service(client); @@ -92,7 +93,7 @@ async fn federation_deny() { let client = service_fn( #[allow(unreachable_code)] |_: Request<_>| async { - panic!("Requested a denied domain") as Result, Infallible> + panic!("Requested a denied domain") as Result>, Infallible> }, ); let client = Client::builder().service(client); diff --git a/crates/kitsune-activitypub/tests/fetcher/handle.rs b/crates/kitsune-activitypub/tests/fetcher/handle.rs index bb67bb0a1..3a86a465a 100644 --- a/crates/kitsune-activitypub/tests/fetcher/handle.rs +++ b/crates/kitsune-activitypub/tests/fetcher/handle.rs @@ -1,9 +1,12 @@ use http::{Request, Response, StatusCode}; -use hyper::Body; +use http_body_util::Full; +use hyper::body::Bytes; use kitsune_test::build_ap_response; use std::convert::Infallible; -pub async fn handle(req: Request) -> Result, Infallible> { +pub async fn handle( + req: Request, +) -> Result>, Infallible> { match req.uri().path_and_query().unwrap().as_str() { "/users/0x0" => { let body = include_str!("../../../../test-fixtures/0x0_actor.json"); @@ -29,12 +32,12 @@ pub async fn handle(req: Request) -> Result, Infallible> { } "/.well-known/webfinger?resource=acct:0x0@corteximplant.com" => { let body = include_str!("../../../../test-fixtures/0x0_jrd.json"); - Ok::<_, Infallible>(Response::new(Body::from(body))) + Ok::<_, Infallible>(Response::new(Full::new(body.as_bytes().into()))) } path if path.starts_with("/.well-known/webfinger?") => Ok::<_, Infallible>( Response::builder() .status(StatusCode::NOT_FOUND) - .body(Body::empty()) + .body(Full::default()) .unwrap(), ), path => panic!("HTTP client hit unexpected route: {path}"), diff --git a/crates/kitsune-activitypub/tests/fetcher/webfinger.rs b/crates/kitsune-activitypub/tests/fetcher/webfinger.rs index c5d353d9f..e928c2b64 100644 --- a/crates/kitsune-activitypub/tests/fetcher/webfinger.rs +++ b/crates/kitsune-activitypub/tests/fetcher/webfinger.rs @@ -1,5 +1,6 @@ use super::handle::handle; -use hyper::{Body, Request, Response}; +use http_body_util::Full; +use hyper::{Request, Response}; use kitsune_activitypub::Fetcher; use kitsune_cache::NoopCache; use kitsune_config::instance::FederationFilterConfiguration; @@ -38,7 +39,7 @@ async fn fetch_actor_with_custom_acct() { | ( "joinkitsune.org", "/.well-known/webfinger?resource=acct:0x0@joinkitsune.org", - ) => Ok::<_, Infallible>(Response::new(Body::from(jrd_body))), + ) => Ok::<_, Infallible>(Response::new(Full::from(jrd_body))), _ => handle(req).await, } } @@ -111,14 +112,14 @@ async fn ignore_fake_webfinger_acct() { ..jrd }; let body = simd_json::to_string(&fake_jrd).unwrap(); - Ok::<_, Infallible>(Response::new(Body::from(body))) + Ok::<_, Infallible>(Response::new(Full::from(body))) } ( "whitehouse.gov", "/.well-known/webfinger?resource=acct:POTUS@whitehouse.gov", ) => { let body = simd_json::to_string(&jrd).unwrap(); - Ok(Response::new(Body::from(body))) + Ok(Response::new(Full::from(body))) } _ => handle(req).await, } diff --git a/crates/kitsune-cache/Cargo.toml b/crates/kitsune-cache/Cargo.toml index 2fa69280e..3887f7101 100644 --- a/crates/kitsune-cache/Cargo.toml +++ b/crates/kitsune-cache/Cargo.toml @@ -9,8 +9,8 @@ deadpool-redis = "0.14.0" enum_dispatch = "0.3.12" moka = { version = "0.12.2", features = ["sync"] } redis = "0.24.0" -serde = "1.0.194" -simd-json = "0.13.4" +serde = "1.0.195" +simd-json = "0.13.6" thiserror = "1.0.56" tracing = "0.1.40" typed-builder = "0.18.0" diff --git a/crates/kitsune-captcha/Cargo.toml b/crates/kitsune-captcha/Cargo.toml index fc3627cde..e24582c61 100644 --- a/crates/kitsune-captcha/Cargo.toml +++ b/crates/kitsune-captcha/Cargo.toml @@ -6,11 +6,11 @@ edition.workspace = true [dependencies] enum_dispatch = "0.3.12" -http = "0.2.11" +http = "1.0.0" kitsune-http-client = { path = "../kitsune-http-client" } -serde = { version = "1.0.194", features = ["derive"] } +serde = { version = "1.0.195", features = ["derive"] } serde_urlencoded = "0.7.1" -simd-json = "0.13.4" +simd-json = "0.13.6" strum = { version = "0.25.0", features = ["derive"] } thiserror = "1.0.56" typed-builder = "0.18.0" diff --git a/crates/kitsune-config/Cargo.toml b/crates/kitsune-config/Cargo.toml index 00e4475e9..f229f74e2 100644 --- a/crates/kitsune-config/Cargo.toml +++ b/crates/kitsune-config/Cargo.toml @@ -6,7 +6,7 @@ version.workspace = true [dependencies] miette = "5.10.0" -serde = { version = "1.0.194", features = ["derive"] } +serde = { version = "1.0.195", features = ["derive"] } smol_str = { version = "0.2.0", features = ["serde"] } tokio = { version = "1.35.1", features = ["fs"] } toml = { version = "0.8.8", default-features = false, features = ["parse"] } diff --git a/crates/kitsune-core/Cargo.toml b/crates/kitsune-core/Cargo.toml index 98ef1edab..58acca600 100644 --- a/crates/kitsune-core/Cargo.toml +++ b/crates/kitsune-core/Cargo.toml @@ -8,10 +8,10 @@ build = "build.rs" [dependencies] async-trait = "0.1.77" const_format = "0.2.32" -http = "0.2.11" +http = "1.0.0" kitsune-db = { path = "../kitsune-db" } kitsune-messaging = { path = "../kitsune-messaging" } -serde = { version = "1.0.194", features = ["derive"] } +serde = { version = "1.0.195", features = ["derive"] } speedy-uuid = { path = "../../lib/speedy-uuid", features = ["diesel"] } thiserror = "1.0.56" typed-builder = "0.18.0" diff --git a/crates/kitsune-db/Cargo.toml b/crates/kitsune-db/Cargo.toml index c5ab14fcc..25abe76de 100644 --- a/crates/kitsune-db/Cargo.toml +++ b/crates/kitsune-db/Cargo.toml @@ -22,8 +22,8 @@ kitsune-type = { path = "../kitsune-type" } miette = "5.10.0" num-derive = "0.4.1" num-traits = "0.2.17" -serde = { version = "1.0.194", features = ["derive"] } -simd-json = "0.13.4" +serde = { version = "1.0.195", features = ["derive"] } +simd-json = "0.13.6" speedy-uuid = { path = "../../lib/speedy-uuid", features = ["diesel"] } thiserror = "1.0.56" tracing-log = "0.2.0" diff --git a/crates/kitsune-email/Cargo.toml b/crates/kitsune-email/Cargo.toml index e2b5c97ce..b4bb6bf52 100644 --- a/crates/kitsune-email/Cargo.toml +++ b/crates/kitsune-email/Cargo.toml @@ -9,7 +9,7 @@ ignored = ["askama_axum"] # See reason below. [dependencies] askama = "0.12.1" -askama_axum = "0.3.0" # Damn it, cargo. Because "kitsune" uses "askama" with the axum feature, we have to have the crate available here as well.. +askama_axum = "0.4.0" # Damn it, cargo. Because "kitsune" uses "askama" with the axum feature, we have to have the crate available here as well.. diesel = "2.1.4" diesel-async = "0.4.1" kitsune-db = { path = "../kitsune-db" } @@ -24,7 +24,7 @@ lettre = { version = "0.11.3", default-features = false, features = [ "tracing", ] } miette = "5.10.0" -mrml = { version = "2.1.1", default-features = false, features = [ +mrml = { version = "3.0.0", default-features = false, features = [ "orderedmap", "parse", "render", diff --git a/crates/kitsune-embed/Cargo.toml b/crates/kitsune-embed/Cargo.toml index 4b956246a..9e077d221 100644 --- a/crates/kitsune-embed/Cargo.toml +++ b/crates/kitsune-embed/Cargo.toml @@ -8,7 +8,7 @@ version.workspace = true diesel = "2.1.4" diesel-async = "0.4.1" embed-sdk = { git = "https://github.com/Lantern-chat/embed-service.git", rev = "b00278f1d2c41bc4394d394426dff0ecf8e42c90" } -http = "0.2.11" +http = "1.0.0" iso8601-timestamp = "0.2.16" kitsune-db = { path = "../kitsune-db" } kitsune-http-client = { path = "../kitsune-http-client" } diff --git a/crates/kitsune-http-client/Cargo.toml b/crates/kitsune-http-client/Cargo.toml index 192afeb50..c7d4f8d0e 100644 --- a/crates/kitsune-http-client/Cargo.toml +++ b/crates/kitsune-http-client/Cargo.toml @@ -5,25 +5,31 @@ authors.workspace = true edition.workspace = true [dependencies] +async-stream = "0.3.5" bytes = "1.5.0" -futures-core = "0.3.30" -headers = "0.3.9" -http-body = "0.4.6" -hyper = { version = "0.14.28", features = [ - "client", - "deprecated", +futures-util = { version = "0.3.30", default-features = false, features = [ + "alloc", +] } +headers = "0.4.0" +http-body = "1.0.0" +http-body-util = "0.1.0" +hyper = "1.1.0" +hyper-util = { version = "0.1.2", features = [ + "client-legacy", "http1", "http2", - "runtime", + "tokio", +] } +hyper-rustls = { git = "https://github.com/rustls/hyper-rustls.git", rev = "8e502d807f637709b4d88c34d6bf7d921272a36a", features = [ + "http2", ] } -hyper-rustls = { version = "0.24.2", features = ["http2"] } kitsune-http-signatures = { path = "../kitsune-http-signatures" } kitsune-type = { path = "../kitsune-type" } -pin-project-lite = "0.2.13" -serde = "1.0.194" -simd-json = "0.13.4" +pin-project = "1.1.3" +serde = "1.0.195" +simd-json = "0.13.6" tower = { version = "0.4.13", features = ["util"] } -tower-http = { version = "0.4.4", features = [ +tower-http = { version = "0.5.0", features = [ # Explicitly exclude `zstd` # It's not widely adopted and takes a long time to build "decompression-br", diff --git a/crates/kitsune-http-client/src/body.rs b/crates/kitsune-http-client/src/body.rs new file mode 100644 index 000000000..58e32f993 --- /dev/null +++ b/crates/kitsune-http-client/src/body.rs @@ -0,0 +1,98 @@ +use bytes::Bytes; +use futures_util::{stream::BoxStream, StreamExt, TryStream, TryStreamExt}; +use http_body::Frame; +use http_body_util::StreamBody; +use pin_project::pin_project; +use std::{ + fmt::{self, Debug}, + pin::Pin, + task::{self, Poll}, +}; +use tower::BoxError; + +/// Body on a budget +#[derive(Default)] +#[pin_project(project = BodyProj)] +pub enum Body { + /// Empty body + #[default] + Empty, + + /// Body consisting of a single chunk + Full(Option), + + /// Body backed by a `StreamBody` + Stream(#[pin] StreamBody, BoxError>>>), +} + +impl Body { + /// Empty body + #[must_use] + pub fn empty() -> Self { + Self::Empty + } + + /// Single byte chunk body + pub fn data(data: D) -> Self + where + D: Into, + { + Self::Full(Some(data.into())) + } + + /// Stream body + pub fn stream(stream: S) -> Self + where + S: TryStream + Send + 'static, + S::Ok: Into, + S::Error: Into, + { + let stream = stream + .map_ok(|chunk| Frame::data(chunk.into())) + .map_err(Into::into) + .boxed(); + + Self::Stream(StreamBody::new(stream)) + } +} + +impl Debug for Body { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct(std::any::type_name::()) + .finish_non_exhaustive() + } +} + +impl From for Body { + fn from(value: Bytes) -> Self { + Self::data(value) + } +} + +impl From for Body { + fn from(value: String) -> Self { + Self::data(value) + } +} + +impl From> for Body { + fn from(value: Vec) -> Self { + Self::data(value) + } +} + +impl http_body::Body for Body { + type Data = Bytes; + type Error = BoxError; + + fn poll_frame( + self: Pin<&mut Self>, + cx: &mut task::Context<'_>, + ) -> Poll, Self::Error>>> { + match self.project() { + BodyProj::Empty => Poll::Ready(None), + BodyProj::Full(data) => Poll::Ready(data.take().map(|data| Ok(Frame::data(data)))), + BodyProj::Stream(stream) => stream.poll_frame(cx), + } + } +} diff --git a/crates/kitsune-http-client/src/lib.rs b/crates/kitsune-http-client/src/lib.rs index 8b8fbee63..dc1c62b07 100644 --- a/crates/kitsune-http-client/src/lib.rs +++ b/crates/kitsune-http-client/src/lib.rs @@ -2,28 +2,26 @@ #![deny(missing_docs)] use self::util::BoxCloneService; +use async_stream::try_stream; use bytes::Buf; -use futures_core::Stream; +use futures_util::Stream; use headers::{Date, HeaderMapExt}; -use http_body::{combinators::BoxBody, Body as HttpBody, Limited}; +use http_body::Body as HttpBody; +use http_body_util::{BodyExt, BodyStream, Limited}; use hyper::{ body::Bytes, - client::HttpConnector, header::{HeaderName, USER_AGENT}, http::{self, HeaderValue}, - Body, Client as HyperClient, HeaderMap, Request, Response as HyperResponse, StatusCode, Uri, - Version, + HeaderMap, Request, Response as HyperResponse, StatusCode, Uri, Version, }; -use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; +use hyper_rustls::HttpsConnectorBuilder; +use hyper_util::{client::legacy::Client as HyperClient, rt::TokioExecutor}; use kitsune_http_signatures::{HttpSigner, PrivateKey, SignatureComponent, SigningKey}; use kitsune_type::jsonld::RdfNode; -use pin_project_lite::pin_project; use serde::de::DeserializeOwned; use std::{ error::Error as StdError, fmt, - pin::Pin, - task::{self, Poll}, time::{Duration, SystemTime}, }; use tower::{layer::util::Identity, util::Either, BoxError, Service, ServiceBuilder, ServiceExt}; @@ -34,40 +32,32 @@ use tower_http::{ timeout::TimeoutLayer, }; +mod body; mod util; +type BoxBody = http_body_util::combinators::BoxBody; type Result = std::result::Result; /// Default body limit of 1MB const DEFAULT_BODY_LIMIT: usize = 1024 * 1024; -pin_project! { - struct BodyStream { - #[pin] - inner: B, - } -} - -impl Stream for BodyStream -where - B: HttpBody, -{ - type Item = Result; - - fn poll_next(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll> { - let this = self.project(); - this.inner.poll_data(cx).map_err(Into::into) - } -} +/// Alias for our internal HTTP body type +pub use self::body::Body; /// Client error type pub struct Error { inner: BoxError, } -impl From for Error { - fn from(value: BoxError) -> Self { - Self { inner: value } +impl Error { + #[inline] + pub(crate) fn new(inner: E) -> Self + where + E: Into, + { + Self { + inner: inner.into(), + } } } @@ -123,7 +113,7 @@ impl ClientBuilder { { self.default_headers.insert( key.try_into().map_err(|e| Error { inner: e.into() })?, - value.try_into().map_err(Into::into)?, + value.try_into().map_err(Error::new)?, ); Ok(self) @@ -162,13 +152,19 @@ impl ClientBuilder { pub fn build(self) -> Client { let connector = HttpsConnectorBuilder::new() .with_native_roots() + .expect("Failed to fetch native certificates") .https_or_http() .enable_http1() .enable_http2() .build(); - let client: HyperClient, Body> = - HyperClient::builder().build(connector); + let client = HyperClient::builder(TokioExecutor::new()) + .build(connector) + .map_response(|resp| { + let (parts, body) = resp.into_parts(); + let body = BoxBody::new(body); + HyperResponse::from_parts(parts, body) + }); self.service(client) } @@ -227,7 +223,7 @@ impl Default for ClientBuilder { /// An opinionated HTTP client pub struct Client { default_headers: HeaderMap, - inner: BoxCloneService, HyperResponse>, BoxError>, + inner: BoxCloneService, HyperResponse, BoxError>, } impl Client { @@ -253,7 +249,10 @@ impl Client { /// - The request failed pub async fn execute(&self, req: Request) -> Result { let req = self.prepare_request(req); - let response = self.inner.clone().ready().await?.call(req).await?; + + let mut ready_svc = self.inner.clone(); + let ready_svc = ready_svc.ready().await.map_err(Error::new)?; + let response = ready_svc.call(req).await.map_err(Error::new)?; Ok(Response { inner: response }) } @@ -295,7 +294,7 @@ impl Client { private_key, ) .await - .map_err(BoxError::from)?; + .map_err(Error::new)?; parts.headers.insert(name, value); self.execute(Request::from_parts(parts, body)).await @@ -315,7 +314,7 @@ impl Client { let req = Request::builder() .uri(uri) .body(Body::empty()) - .map_err(BoxError::from)?; + .map_err(Error::new)?; self.execute(req).await } @@ -330,13 +329,13 @@ impl Default for Client { /// HTTP response #[derive(Debug)] pub struct Response { - inner: HyperResponse>, + inner: HyperResponse, } impl Response { /// Convert the response into its inner `hyper` representation #[must_use] - pub fn into_inner(self) -> HyperResponse> { + pub fn into_inner(self) -> HyperResponse { self.inner } @@ -346,7 +345,7 @@ impl Response { /// /// Reading the body from the remote failed pub async fn bytes(self) -> Result { - Ok(self.inner.collect().await?.to_bytes()) + Ok(self.inner.collect().await.map_err(Error::new)?.to_bytes()) } /// Get a reference to the headers @@ -363,7 +362,7 @@ impl Response { /// - The body isn't a UTF-8 encoded string pub async fn text(self) -> Result { let body = self.bytes().await?; - Ok(String::from_utf8(body.to_vec()).map_err(BoxError::from)?) + String::from_utf8(body.to_vec()).map_err(Error::new) } /// Read the body and deserialise it as JSON into a `serde` enabled structure @@ -377,7 +376,7 @@ impl Response { T: DeserializeOwned, { let bytes = self.bytes().await?; - Ok(simd_json::from_reader(bytes.reader()).map_err(BoxError::from)?) + simd_json::from_reader(bytes.reader()).map_err(Error::new) } /// Read the body and deserialise it as JSON-LD node and verify the returned node's `@id` @@ -400,20 +399,21 @@ impl Response { // This only happens if the `FollowRedirect` middleware neglect to insert the extension // or the URI doesn't contain the authority part, which won't occur in the current // version of `tower-http` - return Err(BoxError::from("Failed to get the server authority").into()); + return Err(Error::new(BoxError::from( + "Failed to get the server authority", + ))); }; let node: T = self.json().await?; if let Some(id) = node.id() { if Uri::try_from(id) - .map_err(BoxError::from)? + .map_err(Error::new)? .authority() .map_or(true, |node_authority| *node_authority != server_authority) { - return Err(BoxError::from( + return Err(Error::new(BoxError::from( "Authority of `@id` doesn't belong to the originating server", - ) - .into()); + ))); } } @@ -428,8 +428,18 @@ impl Response { /// Stream the body pub fn stream(self) -> impl Stream> { - BodyStream { - inner: self.inner.into_body(), + let body_stream = BodyStream::new(self.inner.into_body()); + + try_stream! { + for await frame in body_stream { + match frame.map_err(Error::new)?.into_data() { + Ok(val) if val.has_remaining() => yield val, + Ok(..) | Err(..) => { + // There was either no remaining data or the frame was no data frame. + // Therefore we just discard it. + } + } + } } } diff --git a/crates/kitsune-http-client/tests/basic.rs b/crates/kitsune-http-client/tests/basic.rs index 5c914c4eb..58f3f3a6c 100644 --- a/crates/kitsune-http-client/tests/basic.rs +++ b/crates/kitsune-http-client/tests/basic.rs @@ -1,13 +1,15 @@ +use bytes::Bytes; use core::convert::Infallible; -use hyper::{Body, Request, Response}; -use kitsune_http_client::Client; +use http_body_util::Empty; +use hyper::{Request, Response}; +use kitsune_http_client::{Body, Client}; use tower::service_fn; #[tokio::test] async fn basic_request() { let client = service_fn(|req: Request<_>| async move { assert_eq!(req.uri().path_and_query().unwrap(), "/path"); - Ok::<_, Infallible>(Response::new(Body::empty())) + Ok::<_, Infallible>(Response::new(Empty::::new())) }); let client = Client::builder().service(client); diff --git a/crates/kitsune-http-client/tests/json.rs b/crates/kitsune-http-client/tests/json.rs index 5dbc30aee..eec9cb961 100644 --- a/crates/kitsune-http-client/tests/json.rs +++ b/crates/kitsune-http-client/tests/json.rs @@ -1,7 +1,8 @@ +use bytes::Bytes; use core::convert::Infallible; -use hyper::Response; -use hyper::{Body, Request}; -use kitsune_http_client::Client; +use http_body_util::Full; +use hyper::{Request, Response}; +use kitsune_http_client::{Body, Client}; use simd_json::{base::ValueAsScalar, OwnedValue}; use tower::service_fn; @@ -9,7 +10,9 @@ use tower::service_fn; async fn json_request() { let client = service_fn(|req: Request<_>| async move { assert_eq!(req.headers()["Accept"], "application/activity+json"); - Ok::<_, Infallible>(Response::new(Body::from(r#"{"preferredUsername":"0x0"}"#))) + Ok::<_, Infallible>(Response::new(Full::new(Bytes::from( + r#"{"preferredUsername":"0x0"}"#, + )))) }); let client = Client::builder() diff --git a/crates/kitsune-http-signatures/Cargo.toml b/crates/kitsune-http-signatures/Cargo.toml index d0853f9e4..0d435fc73 100644 --- a/crates/kitsune-http-signatures/Cargo.toml +++ b/crates/kitsune-http-signatures/Cargo.toml @@ -7,7 +7,7 @@ edition.workspace = true [dependencies] base64-simd = { version = "0.8.0", features = ["unstable"] } derive_builder = "0.12.0" -http = "0.2.11" +http = "1.0.0" kitsune-blocking = { path = "../kitsune-blocking" } ring = { version = "0.17.7", features = ["std"] } time = { version = "0.3.31", default-features = false, features = [ diff --git a/crates/kitsune-jobs/Cargo.toml b/crates/kitsune-jobs/Cargo.toml index 2ece224aa..eb1e17480 100644 --- a/crates/kitsune-jobs/Cargo.toml +++ b/crates/kitsune-jobs/Cargo.toml @@ -15,7 +15,7 @@ kitsune-db = { path = "../kitsune-db" } kitsune-email = { path = "../kitsune-email" } miette = "5.10.0" scoped-futures = "0.1.3" -serde = { version = "1.0.194", features = ["derive"] } +serde = { version = "1.0.195", features = ["derive"] } speedy-uuid = { path = "../../lib/speedy-uuid" } tracing = "0.1.40" typed-builder = "0.18.0" diff --git a/crates/kitsune-language/Cargo.toml b/crates/kitsune-language/Cargo.toml index da1c6d52b..337d52513 100644 --- a/crates/kitsune-language/Cargo.toml +++ b/crates/kitsune-language/Cargo.toml @@ -13,7 +13,7 @@ isolang = { version = "2.4.0", features = [ "serde", ] } rustc-hash = "1.1.0" -whatlang = { version = "0.16.3", optional = true } +whatlang = { version = "0.16.4", optional = true } whichlang = { version = "0.1.0", optional = true } [features] diff --git a/crates/kitsune-mastodon/Cargo.toml b/crates/kitsune-mastodon/Cargo.toml index 19b32f0ea..f71384878 100644 --- a/crates/kitsune-mastodon/Cargo.toml +++ b/crates/kitsune-mastodon/Cargo.toml @@ -20,8 +20,8 @@ kitsune-url = { path = "../kitsune-url" } kitsune-util = { path = "../kitsune-util" } mime = "0.3.17" scoped-futures = "0.1.3" -serde = "1.0.194" -simd-json = "0.13.4" +serde = "1.0.195" +simd-json = "0.13.6" smol_str = "0.2.0" speedy-uuid = { path = "../../lib/speedy-uuid" } thiserror = "1.0.56" diff --git a/crates/kitsune-messaging/Cargo.toml b/crates/kitsune-messaging/Cargo.toml index 6786d3ab3..391547ee4 100644 --- a/crates/kitsune-messaging/Cargo.toml +++ b/crates/kitsune-messaging/Cargo.toml @@ -15,8 +15,8 @@ redis = { version = "0.24.0", features = [ "connection-manager", "tokio-rustls-comp", ] } -serde = "1.0.194" -simd-json = "0.13.4" +serde = "1.0.195" +simd-json = "0.13.6" tokio = { version = "1.35.1", features = ["macros", "rt", "sync"] } tokio-stream = { version = "0.1.14", features = ["sync"] } tracing = "0.1.40" diff --git a/crates/kitsune-observability/Cargo.toml b/crates/kitsune-observability/Cargo.toml index 5c946a153..23234255e 100644 --- a/crates/kitsune-observability/Cargo.toml +++ b/crates/kitsune-observability/Cargo.toml @@ -6,13 +6,15 @@ version.workspace = true [dependencies] async-trait = "0.1.77" -hyper = { version = "0.14.28", default-features = false } +http-body-util = "0.1.0" +http-compat = { path = "../../lib/http-compat" } +hyper = { version = "1.1.0", default-features = false } kitsune-config = { path = "../kitsune-config" } kitsune-http-client = { path = "../kitsune-http-client" } -metrics = "0.21.1" -metrics-opentelemetry = { git = "https://github.com/aumetra/metrics-opentelemetry.git", rev = "d4762c6704ecac8bca8f14ee201ce83d652c382a" } -metrics-tracing-context = "0.14.0" -metrics-util = "0.15.1" +metrics = "0.22.0" +metrics-opentelemetry = { git = "https://github.com/aumetra/metrics-opentelemetry.git", rev = "b2e2586da553ebd62abdcd3bfd04b5f41a32449a" } +metrics-tracing-context = "0.15.0" +metrics-util = "0.16.0" miette = "5.10.0" opentelemetry = { version = "0.21.0", default-features = false, features = [ "trace", @@ -26,7 +28,7 @@ opentelemetry-otlp = { version = "0.14.0", default-features = false, features = "tls-roots", "trace", ] } -opentelemetry_sdk = { version = "0.21.1", default-features = false, features = [ +opentelemetry_sdk = { version = "0.21.2", default-features = false, features = [ "rt-tokio", ] } tracing = "0.1.40" diff --git a/crates/kitsune-observability/src/lib.rs b/crates/kitsune-observability/src/lib.rs index 354e01823..e4b28d55d 100644 --- a/crates/kitsune-observability/src/lib.rs +++ b/crates/kitsune-observability/src/lib.rs @@ -1,5 +1,6 @@ use async_trait::async_trait; -use hyper::body::{Body, HttpBody}; +use http_body_util::BodyExt; +use http_compat::Compat; use kitsune_config::{open_telemetry::Transport, Configuration}; use metrics_opentelemetry::OpenTelemetryRecorder; use metrics_tracing_context::{MetricsLayer, TracingContextLayer}; @@ -28,7 +29,8 @@ struct HttpClientAdapter { impl fmt::Debug for HttpClientAdapter { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "HttpClientAdapter") + f.debug_struct(std::any::type_name::()) + .finish_non_exhaustive() } } @@ -36,15 +38,14 @@ impl fmt::Debug for HttpClientAdapter { impl HttpClient for HttpClientAdapter { async fn send(&self, request: Request>) -> Result, HttpError> { let (parts, body) = request.into_parts(); - let body = Body::from(body); - let request = Request::from_parts(parts, body); + let request = Request::from_parts(parts, body.into()); - let response = self.inner.execute(request).await?.into_inner(); + let response = self.inner.execute(request.compat()).await?.into_inner(); let (parts, body) = response.into_parts(); let body = body.collect().await?.to_bytes(); - Ok(Response::from_parts(parts, body)) + Ok(hyper::http::Response::from_parts(parts, body).compat()) } } @@ -96,7 +97,7 @@ where fn initialise_metrics(meter: Meter) -> miette::Result<()> { let recorder = TracingContextLayer::all().layer(OpenTelemetryRecorder::new(meter)); - metrics::set_boxed_recorder(Box::new(recorder)) + metrics::set_global_recorder(recorder) .into_diagnostic() .wrap_err("Couldn't install the global metrics recorder")?; diff --git a/crates/kitsune-oidc/Cargo.toml b/crates/kitsune-oidc/Cargo.toml index 35f7daf9e..e79f3a8b8 100644 --- a/crates/kitsune-oidc/Cargo.toml +++ b/crates/kitsune-oidc/Cargo.toml @@ -7,8 +7,8 @@ version.workspace = true [dependencies] deadpool-redis = "0.14.0" enum_dispatch = "0.3.12" -http = "0.2.11" -hyper = "0.14.28" +http = "1.0.0" +http-compat = { path = "../../lib/http-compat" } kitsune-config = { path = "../kitsune-config" } kitsune-http-client = { path = "../kitsune-http-client" } miette = "5.10.0" @@ -20,8 +20,8 @@ openidconnect = { version = "3.4.0", default-features = false, features = [ "accept-string-booleans", ] } redis = "0.24.0" -serde = { version = "1.0.194", features = ["derive"] } -simd-json = "0.13.4" +serde = { version = "1.0.195", features = ["derive"] } +simd-json = "0.13.6" speedy-uuid = { path = "../../lib/speedy-uuid", features = ["serde"] } thiserror = "1.0.56" url = "2.5.0" diff --git a/crates/kitsune-oidc/src/http.rs b/crates/kitsune-oidc/src/http.rs index c38a50a08..81d1f1916 100644 --- a/crates/kitsune-oidc/src/http.rs +++ b/crates/kitsune-oidc/src/http.rs @@ -1,5 +1,5 @@ use http::Request; -use hyper::Body; +use http_compat::Compat; use kitsune_http_client::Client as HttpClient; use once_cell::sync::Lazy; use openidconnect::{HttpRequest, HttpResponse}; @@ -7,14 +7,16 @@ use openidconnect::{HttpRequest, HttpResponse}; static HTTP_CLIENT: Lazy = Lazy::new(HttpClient::default); pub async fn async_client(req: HttpRequest) -> Result { - let mut request = Request::builder().method(req.method).uri(req.url.as_str()); - *request.headers_mut().unwrap() = req.headers; - let request = request.body(Body::from(req.body)).unwrap(); + let mut request = Request::builder() + .method(req.method.compat()) + .uri(req.url.as_str()); + *request.headers_mut().unwrap() = req.headers.compat(); + let request = request.body(req.body.into()).unwrap(); let response = HTTP_CLIENT.execute(request).await?; Ok(HttpResponse { - status_code: response.status(), - headers: response.headers().clone(), + status_code: response.status().compat(), + headers: response.headers().clone().compat(), body: response.bytes().await?.to_vec(), }) } diff --git a/crates/kitsune-search/Cargo.toml b/crates/kitsune-search/Cargo.toml index c18dd0eba..528ad9e30 100644 --- a/crates/kitsune-search/Cargo.toml +++ b/crates/kitsune-search/Cargo.toml @@ -16,7 +16,7 @@ futures-util = "0.3.30" kitsune-db = { path = "../kitsune-db" } kitsune-language = { path = "../kitsune-language" } miette = "5.10.0" -serde = { version = "1.0.194", features = ["derive"] } +serde = { version = "1.0.195", features = ["derive"] } speedy-uuid = { path = "../../lib/speedy-uuid" } strum = { version = "0.25.0", features = ["derive"] } thiserror = "1.0.56" diff --git a/crates/kitsune-service/Cargo.toml b/crates/kitsune-service/Cargo.toml index a23ce6dc4..e3aad6256 100644 --- a/crates/kitsune-service/Cargo.toml +++ b/crates/kitsune-service/Cargo.toml @@ -15,14 +15,14 @@ derive_builder = "0.12.0" diesel = "2.1.4" diesel-async = "0.4.1" futures-util = "0.3.30" -garde = { version = "0.16.3", default-features = false, features = [ +garde = { version = "0.17.0", default-features = false, features = [ "derive", "email", "email-idna", "regex", "serde", ] } -http = "0.2.11" +http = "1.0.0" img-parts = "0.3.0" iso8601-timestamp = "0.2.16" kitsune-blocking = { path = "../kitsune-blocking" } @@ -51,8 +51,8 @@ rand = "0.8.5" rsa = "0.9.6" rusty-s3 = { version = "0.5.0", default-features = false } scoped-futures = "0.1.3" -serde = "1.0.194" -simd-json = "0.13.4" +serde = "1.0.195" +simd-json = "0.13.6" smol_str = "0.2.0" speedy-uuid = { path = "../../lib/speedy-uuid" } thiserror = "1.0.56" @@ -67,7 +67,8 @@ meilisearch = ["kitsune-search/meilisearch"] [dev-dependencies] hex-simd = { version = "0.8.0", features = ["unstable"] } -hyper = "0.14.28" +http-body-util = "0.1.0" +hyper = "1.1.0" kitsune-activitypub = { path = "../kitsune-activitypub" } kitsune-config = { path = "../kitsune-config" } kitsune-federation-filter = { path = "../kitsune-federation-filter" } diff --git a/crates/kitsune-service/src/account.rs b/crates/kitsune-service/src/account.rs index 06e459ebe..91160c2e5 100644 --- a/crates/kitsune-service/src/account.rs +++ b/crates/kitsune-service/src/account.rs @@ -658,8 +658,8 @@ impl AccountService { pub async fn update(&self, mut update: Update) -> Result where - A: Stream> + Send + 'static, - H: Stream> + Send + 'static, + A: Stream> + Send + Sync + 'static, + H: Stream> + Send + Sync + 'static, { update.validate(&())?; diff --git a/crates/kitsune-service/src/attachment.rs b/crates/kitsune-service/src/attachment.rs index 582cdceac..68ded1144 100644 --- a/crates/kitsune-service/src/attachment.rs +++ b/crates/kitsune-service/src/attachment.rs @@ -180,7 +180,7 @@ impl AttachmentService { pub async fn upload(&self, upload: Upload) -> Result where - S: Stream> + Send + 'static, + S: Stream> + Send + Sync + 'static, { upload.validate(&())?; @@ -249,7 +249,7 @@ mod test { use diesel_async::{AsyncConnection, AsyncPgConnection, RunQueryDsl}; use futures_util::{future, pin_mut, stream, StreamExt}; use http::{Request, Response}; - use hyper::Body; + use http_body_util::Empty; use img_parts::{ jpeg::{markers, JpegSegment}, ImageEXIF, @@ -343,8 +343,10 @@ mod test { .await; } - async fn handle(_req: Request) -> Result, Infallible> { - Ok::<_, Infallible>(Response::new(Body::empty())) + async fn handle( + _req: Request, + ) -> Result>, Infallible> { + Ok::<_, Infallible>(Response::new(Empty::new())) } async fn prepare_db(db_conn: &mut AsyncPgConnection) -> Uuid { diff --git a/crates/kitsune-service/src/custom_emoji.rs b/crates/kitsune-service/src/custom_emoji.rs index cb351e526..aa71373f4 100644 --- a/crates/kitsune-service/src/custom_emoji.rs +++ b/crates/kitsune-service/src/custom_emoji.rs @@ -143,7 +143,7 @@ impl CustomEmojiService { pub async fn add_emoji(&self, emoji_upload: EmojiUpload) -> Result where - S: Stream> + Send + 'static, + S: Stream> + Send + Sync + 'static, { emoji_upload.validate(&())?; diff --git a/crates/kitsune-service/src/post/resolver.rs b/crates/kitsune-service/src/post/resolver.rs index b258fd809..3b785ae28 100644 --- a/crates/kitsune-service/src/post/resolver.rs +++ b/crates/kitsune-service/src/post/resolver.rs @@ -115,7 +115,8 @@ mod test { use core::convert::Infallible; use diesel::{QueryDsl, SelectableHelper}; use diesel_async::RunQueryDsl; - use hyper::{Body, Request, Response}; + use http_body_util::Full; + use hyper::{Request, Response}; use iso8601_timestamp::Timestamp; use kitsune_activitypub::Fetcher; use kitsune_cache::NoopCache; @@ -152,11 +153,11 @@ mod test { match req.uri().path_and_query().unwrap().as_str() { "/.well-known/webfinger?resource=acct:0x0@corteximplant.com"=> { let body = include_str!("../../../../test-fixtures/0x0_jrd.json"); - Ok::<_, Infallible>(Response::new(Body::from(body))) + Ok::<_, Infallible>(Response::new(Full::new(body.as_bytes().into()))) } "/users/0x0" => { let body = include_str!("../../../../test-fixtures/0x0_actor.json"); - Ok::<_, Infallible>(build_ap_response(body)) + Ok::<_, Infallible>(build_ap_response(body.as_bytes())) } path => panic!("HTTP client hit unexpected route: {path}"), } diff --git a/crates/kitsune-storage/Cargo.toml b/crates/kitsune-storage/Cargo.toml index a30108ca2..5fe539a81 100644 --- a/crates/kitsune-storage/Cargo.toml +++ b/crates/kitsune-storage/Cargo.toml @@ -8,8 +8,7 @@ edition.workspace = true bytes = "1.5.0" derive_more = { version = "1.0.0-beta.6", features = ["from"] } futures-util = "0.3.30" -http = "0.2.11" -hyper = { version = "0.14.28", features = ["stream"] } +http = "1.0.0" kitsune-http-client = { path = "../kitsune-http-client" } rusty-s3 = { version = "0.5.0", default-features = false } tokio = { version = "1.35.1", features = ["fs", "io-util"] } diff --git a/crates/kitsune-storage/src/fs.rs b/crates/kitsune-storage/src/fs.rs index 3d2e15393..3f776c8a1 100644 --- a/crates/kitsune-storage/src/fs.rs +++ b/crates/kitsune-storage/src/fs.rs @@ -41,7 +41,7 @@ impl StorageBackend for Storage { async fn put(&self, path: &str, input_stream: T) -> Result<()> where - T: Stream> + Send + 'static, + T: Stream> + Send + Sync + 'static, { let mut file = File::create(self.storage_dir.join(path)).await?; pin_mut!(input_stream); diff --git a/crates/kitsune-storage/src/lib.rs b/crates/kitsune-storage/src/lib.rs index eab0713b2..03bec6fba 100644 --- a/crates/kitsune-storage/src/lib.rs +++ b/crates/kitsune-storage/src/lib.rs @@ -28,7 +28,7 @@ pub trait StorageBackend: Clone + Send + Sync { /// Stream something onto the object storage fn put(&self, path: &str, input_stream: T) -> impl Future> where - T: Stream> + Send + 'static; + T: Stream> + Send + Sync + 'static; } #[derive(Clone, From)] @@ -58,7 +58,7 @@ impl StorageBackend for AnyStorageBackend { async fn put(&self, path: &str, input_stream: T) -> Result<()> where - T: Stream> + Send + 'static, + T: Stream> + Send + Sync + 'static, { match self { Self::Fs(fs) => fs.put(path, input_stream).await, diff --git a/crates/kitsune-storage/src/s3.rs b/crates/kitsune-storage/src/s3.rs index bb028b4c3..9df2ade03 100644 --- a/crates/kitsune-storage/src/s3.rs +++ b/crates/kitsune-storage/src/s3.rs @@ -6,8 +6,7 @@ use crate::{Result, StorageBackend}; use bytes::Bytes; use futures_util::{Stream, StreamExt, TryStreamExt}; use http::Request; -use hyper::Body; -use kitsune_http_client::Client as HttpClient; +use kitsune_http_client::{Body, Client as HttpClient}; use rusty_s3::{ actions::{DeleteObject, GetObject, PutObject}, Bucket, Credentials, S3Action, @@ -61,14 +60,14 @@ impl S3Client { pub async fn put_object(&self, path: &str, stream: S) -> Result<()> where - S: Stream> + Send + 'static, + S: Stream> + Send + Sync + 'static, { let put_action = self.bucket.put_object(Some(&self.credentials), path); let request = Request::builder() .uri(String::from(put_action.sign(FIVE_MINUTES))) .method(s3_method_to_http(PutObject::METHOD)) - .body(Body::wrap_stream(stream))?; + .body(Body::stream(stream))?; self.http_client.execute(request).await?; @@ -110,7 +109,7 @@ impl StorageBackend for Storage { async fn put(&self, path: &str, input_stream: S) -> Result<()> where - S: Stream> + Send + 'static, + S: Stream> + Send + Sync + 'static, { self.client.put_object(path, input_stream).await } diff --git a/crates/kitsune-test/Cargo.toml b/crates/kitsune-test/Cargo.toml index be0243f74..904f3bafa 100644 --- a/crates/kitsune-test/Cargo.toml +++ b/crates/kitsune-test/Cargo.toml @@ -5,12 +5,13 @@ edition.workspace = true version.workspace = true [dependencies] +bytes = "1.5.0" deadpool-redis = "0.14.0" diesel = "2.1.4" diesel-async = "0.4.1" futures-util = "0.3.30" -http = "0.2.11" -hyper = "0.14.28" +http = "1.0.0" +http-body-util = "0.1.0" kitsune-db = { path = "../kitsune-db" } pin-project-lite = "0.2.13" redis = "0.24.0" diff --git a/crates/kitsune-test/src/lib.rs b/crates/kitsune-test/src/lib.rs index fb2222c27..828336509 100644 --- a/crates/kitsune-test/src/lib.rs +++ b/crates/kitsune-test/src/lib.rs @@ -1,7 +1,9 @@ use self::catch_panic::CatchPanic; +use bytes::Bytes; use diesel_async::RunQueryDsl; use futures_util::Future; use http::header::CONTENT_TYPE; +use http_body_util::Full; use kitsune_db::PgPool; use scoped_futures::ScopedFutureExt; use std::{env, error::Error, panic}; @@ -10,13 +12,13 @@ mod catch_panic; type BoxError = Box; -pub fn build_ap_response(body: B) -> http::Response +pub fn build_ap_response(body: B) -> http::Response> where - hyper::Body: From, + Bytes: From, { http::Response::builder() .header(CONTENT_TYPE, "application/activity+json") - .body(body.into()) + .body(Full::new(body.into())) .unwrap() } diff --git a/crates/kitsune-type/Cargo.toml b/crates/kitsune-type/Cargo.toml index b40672668..8d26dce35 100644 --- a/crates/kitsune-type/Cargo.toml +++ b/crates/kitsune-type/Cargo.toml @@ -6,8 +6,8 @@ edition.workspace = true [dependencies] iso8601-timestamp = "0.2.16" -serde = { version = "1.0.194", features = ["derive"] } -simd-json = "0.13.4" +serde = { version = "1.0.195", features = ["derive"] } +simd-json = "0.13.6" smol_str = { version = "0.2.0", features = ["serde"] } speedy-uuid = { path = "../../lib/speedy-uuid", features = ["serde"] } utoipa = { version = "4.1.0", features = ["chrono", "uuid"] } diff --git a/crates/kitsune-webfinger/Cargo.toml b/crates/kitsune-webfinger/Cargo.toml index 01eb4be92..bd7d0f771 100644 --- a/crates/kitsune-webfinger/Cargo.toml +++ b/crates/kitsune-webfinger/Cargo.toml @@ -9,7 +9,7 @@ async-trait = "0.1.77" autometrics = { version = "1.0.0", default-features = false } deadpool-redis = "0.14.0" futures-util = "0.3.30" -http = "0.2.11" +http = "1.0.0" kitsune-cache = { path = "../kitsune-cache" } kitsune-core = { path = "../kitsune-core" } kitsune-http-client = { path = "../kitsune-http-client" } @@ -18,9 +18,10 @@ kitsune-util = { path = "../kitsune-util" } tracing = "0.1.40" [dev-dependencies] -hyper = "0.14.28" +http-body-util = "0.1.0" +hyper = "1.1.0" pretty_assertions = "1.4.0" -simd-json = { version = "0.13.4", features = ["hints"] } +simd-json = { version = "0.13.6", features = ["hints"] } tokio = { version = "1.35.1", features = ["macros"] } tower = { version = "0.4.13", default-features = false, features = ["util"] } diff --git a/crates/kitsune-webfinger/tests/basic.rs b/crates/kitsune-webfinger/tests/basic.rs index 7e3a6fcbe..2acafa2e6 100644 --- a/crates/kitsune-webfinger/tests/basic.rs +++ b/crates/kitsune-webfinger/tests/basic.rs @@ -1,4 +1,5 @@ -use hyper::{Body, Request, Response}; +use http_body_util::Full; +use hyper::{body::Bytes, Request, Response}; use kitsune_cache::NoopCache; use kitsune_core::traits::Resolver; use kitsune_http_client::Client; @@ -15,7 +16,7 @@ async fn basic() { "/.well-known/webfinger?resource=acct:0x0@corteximplant.com" ); let body = include_str!("../../../test-fixtures/0x0_jrd.json"); - Ok::<_, Infallible>(Response::new(Body::from(body))) + Ok::>, Infallible>(Response::new(Full::from(Bytes::from(body)))) }); let client = Client::builder().service(client); diff --git a/crates/kitsune-webfinger/tests/redirects.rs b/crates/kitsune-webfinger/tests/redirects.rs index e9f6a76b8..d336f6a08 100644 --- a/crates/kitsune-webfinger/tests/redirects.rs +++ b/crates/kitsune-webfinger/tests/redirects.rs @@ -1,4 +1,5 @@ -use hyper::{Body, Request, Response, StatusCode}; +use http_body_util::Full; +use hyper::{body::Bytes, Request, Response, StatusCode}; use kitsune_cache::NoopCache; use kitsune_core::traits::Resolver; use kitsune_http_client::Client; @@ -29,7 +30,7 @@ async fn follow_jrd_redirect() { "/.well-known/webfinger?resource=acct:0x0@corteximplant.com", ) | ("joinkitsune.org", "/.well-known/webfinger?resource=acct:0x0@joinkitsune.org") => { - Ok::<_, Infallible>(Response::new(Body::from(body))) + Ok::<_, Infallible>(Response::new(Full::new(Bytes::from(body)))) } _ => panic!("HTTP client hit unexpected route: {}", req.uri()), } @@ -64,12 +65,12 @@ async fn reject_fake_jrd_redirect() { ..simd_json::from_slice(&mut base).unwrap() }) .unwrap(); - Ok::<_, Infallible>(Response::new(Body::from(body))) + Ok::<_, Infallible>(Response::new(Full::new(Bytes::from(body)))) } ("whitehouse.gov", "/.well-known/webfinger?resource=acct:0x0@whitehouse.gov") => { Ok(Response::builder() .status(StatusCode::NOT_FOUND) - .body(Body::empty()) + .body(Full::default()) .unwrap()) } _ => panic!("HTTP client hit unexpected route: {}", req.uri()), @@ -110,7 +111,7 @@ async fn reject_unbounded_number_of_jrd_redirects() { ..simd_json::from_slice(&mut base).unwrap() }) .unwrap(); - Ok::<_, Infallible>(Response::new(Body::from(body))) + Ok::<_, Infallible>(Response::new(Full::new(Bytes::from(body)))) }); let client = Client::builder().service(client); diff --git a/kitsune-cli/Cargo.toml b/kitsune-cli/Cargo.toml index ae71999c2..a98e085a4 100644 --- a/kitsune-cli/Cargo.toml +++ b/kitsune-cli/Cargo.toml @@ -12,14 +12,14 @@ license = false eula = false [dependencies] -clap = { version = "4.4.12", features = ["derive", "wrap_help"] } +clap = { version = "4.4.13", features = ["derive", "wrap_help"] } diesel = "2.1.4" diesel-async = "0.4.1" dotenvy = "0.15.7" envy = "0.4.2" kitsune-db = { path = "../crates/kitsune-db" } miette = { version = "5.10.0", features = ["fancy"] } -serde = { version = "1.0.194", features = ["derive"] } +serde = { version = "1.0.195", features = ["derive"] } speedy-uuid = { path = "../lib/speedy-uuid" } tokio = { version = "1.35.1", features = ["full"] } tracing-subscriber = "0.3.18" diff --git a/kitsune-job-runner/Cargo.toml b/kitsune-job-runner/Cargo.toml index 88c4f1bf4..4930c5581 100644 --- a/kitsune-job-runner/Cargo.toml +++ b/kitsune-job-runner/Cargo.toml @@ -12,7 +12,7 @@ eula = false [dependencies] athena = { path = "../lib/athena" } -clap = { version = "4.4.12", features = ["derive", "wrap_help"] } +clap = { version = "4.4.13", features = ["derive", "wrap_help"] } deadpool-redis = "0.14.0" kitsune-config = { path = "../crates/kitsune-config" } kitsune-core = { path = "../crates/kitsune-core" } diff --git a/kitsune/Cargo.toml b/kitsune/Cargo.toml index dc9bf7b8b..66e0417e4 100644 --- a/kitsune/Cargo.toml +++ b/kitsune/Cargo.toml @@ -19,27 +19,28 @@ argon2 = { version = "0.5.2", features = ["std"] } askama = { version = "0.12.1", features = [ "with-axum", ], default-features = false } -askama_axum = "0.3.0" +askama_axum = "0.4.0" async-trait = "0.1.77" -axum = { version = "0.6.20", features = ["headers", "macros", "multipart"] } -axum-extra = { version = "0.8.0", features = [ +axum = { version = "0.7.3", features = ["macros", "multipart"] } +axum-extra = { version = "0.9.1", features = [ "cookie", "cookie-signed", + "typed-header", "query", ] } -axum-flash = "0.7.0" +axum-flash = "0.8.0" bytes = "1.5.0" chrono = { version = "0.4.31", default-features = false } -clap = { version = "4.4.12", features = ["derive", "wrap_help"] } +clap = { version = "4.4.13", features = ["derive", "wrap_help"] } const-oid = { version = "0.9.6", features = ["db"] } cursiv = { path = "../lib/cursiv", features = ["axum"] } der = { version = "0.7.8", features = ["std"] } diesel = "2.1.4" diesel-async = "0.4.1" futures-util = "0.3.30" -headers = "0.3.9" -http = "0.2.11" -hyper = { version = "0.14.28", features = ["deprecated"] } +headers = "0.4.0" +http = "1.0.0" +http-body-util = "0.1.0" iso8601-timestamp = "0.2.16" kitsune-activitypub = { path = "../crates/kitsune-activitypub" } kitsune-blocking = { path = "../crates/kitsune-blocking" } @@ -65,7 +66,7 @@ kitsune-type = { path = "../crates/kitsune-type" } kitsune-url = { path = "../crates/kitsune-url" } kitsune-util = { path = "../crates/kitsune-util" } kitsune-webfinger = { path = "../crates/kitsune-webfinger" } -metrics = "0.21.1" +metrics = "0.22.0" miette = { version = "5.10.0", features = ["fancy"] } mimalloc = "0.1.39" mime = "0.3.17" @@ -73,12 +74,12 @@ mime_guess = { version = "2.0.4", default-features = false } pkcs8 = "0.10.2" oxide-auth = "0.5.4" oxide-auth-async = "0.1.1" -oxide-auth-axum = "0.3.0" +oxide-auth-axum = "0.4.0" rust-embed = { version = "8.2.0", features = ["include-exclude"] } scoped-futures = "0.1.3" -serde = { version = "1.0.194", features = ["derive"] } +serde = { version = "1.0.195", features = ["derive"] } serde_urlencoded = "0.7.1" -simd-json = "0.13.4" +simd-json = "0.13.6" speedy-uuid = { path = "../lib/speedy-uuid" } strum = { version = "0.25.0", features = ["derive", "phf"] } tempfile = "3.9.0" @@ -87,7 +88,7 @@ time = "0.3.31" tokio = { version = "1.35.1", features = ["full"] } tokio-util = { version = "0.7.10", features = ["compat"] } tower-x-clacks-overhead = { path = "../lib/tower-x-clacks-overhead" } -tower-http = { version = "0.4.4", features = [ +tower-http = { version = "0.5.0", features = [ "catch-panic", "cors", "fs", @@ -98,12 +99,12 @@ tracing = "0.1.40" typed-builder = "0.18.0" url = "2.5.0" utoipa = { version = "4.1.0", features = ["axum_extras", "uuid"] } -utoipa-swagger-ui = { version = "4.0.0", features = ["axum"] } +utoipa-swagger-ui = { version = "5.0.0", features = ["axum"] } # --- Optional dependencies --- # "graphql" feature -async-graphql = { version = "6.0.11", default-features = false, features = [ +async-graphql = { version = "7.0.0", default-features = false, features = [ "playground", "tempfile", "time", @@ -111,7 +112,7 @@ async-graphql = { version = "6.0.11", default-features = false, features = [ "unblock", "uuid", ], optional = true } -async-graphql-axum = { version = "6.0.11", optional = true } +async-graphql-axum = { version = "7.0.0", optional = true } # "mastodon-api" feature kitsune-mastodon = { path = "../crates/kitsune-mastodon", optional = true } diff --git a/kitsune/src/http/extractor/auth.rs b/kitsune/src/http/extractor/auth.rs index 7d00a644a..298260ba7 100644 --- a/kitsune/src/http/extractor/auth.rs +++ b/kitsune/src/http/extractor/auth.rs @@ -3,8 +3,9 @@ use async_trait::async_trait; use axum::{ extract::FromRequestParts, response::{IntoResponse, Response}, - RequestPartsExt, TypedHeader, + RequestPartsExt, }; +use axum_extra::TypedHeader; use diesel::{ExpressionMethods, JoinOnDsl, QueryDsl, SelectableHelper}; use diesel_async::RunQueryDsl; use headers::{authorization::Bearer, Authorization}; diff --git a/kitsune/src/http/extractor/json.rs b/kitsune/src/http/extractor/json.rs index 40b3a48c6..d575445ba 100644 --- a/kitsune/src/http/extractor/json.rs +++ b/kitsune/src/http/extractor/json.rs @@ -1,9 +1,8 @@ use askama_axum::IntoResponse; use async_trait::async_trait; -use axum::{extract::FromRequest, response::Response, BoxError}; +use axum::{body::Body, extract::FromRequest, response::Response}; use bytes::{Buf, BufMut, Bytes, BytesMut}; use http::{header, HeaderMap, HeaderValue, Request, StatusCode}; -use hyper::body::HttpBody; use serde::{de::DeserializeOwned, Serialize}; use std::ops::{Deref, DerefMut}; @@ -12,17 +11,14 @@ use std::ops::{Deref, DerefMut}; pub struct Json(pub T); #[async_trait] -impl FromRequest for Json +impl FromRequest for Json where T: DeserializeOwned, S: Send + Sync, - B: HttpBody + Send + 'static, - ::Data: Send, - ::Error: Into, { type Rejection = Response; - async fn from_request(req: Request, state: &S) -> Result { + async fn from_request(req: Request, state: &S) -> Result { if json_content_type(req.headers()) { let bytes = Bytes::from_request(req, state) .await diff --git a/kitsune/src/http/extractor/mod.rs b/kitsune/src/http/extractor/mod.rs index d816c39be..0fe4d48ff 100644 --- a/kitsune/src/http/extractor/mod.rs +++ b/kitsune/src/http/extractor/mod.rs @@ -4,8 +4,9 @@ use axum::{ body::Body, extract::FromRequest, response::{IntoResponse, Response}, - Form, RequestExt, TypedHeader, + Form, RequestExt, }; +use axum_extra::TypedHeader; use headers::ContentType; use http::StatusCode; use mime::Mime; @@ -27,7 +28,7 @@ mod signed_activity; pub struct AgnosticForm(pub T); #[async_trait] -impl FromRequest for AgnosticForm +impl FromRequest for AgnosticForm where S: Send + Sync, T: DeserializeOwned + Send + 'static, diff --git a/kitsune/src/http/extractor/signed_activity.rs b/kitsune/src/http/extractor/signed_activity.rs index 71adbd5dc..1eee3c539 100644 --- a/kitsune/src/http/extractor/signed_activity.rs +++ b/kitsune/src/http/extractor/signed_activity.rs @@ -14,7 +14,7 @@ use const_oid::db::rfc8410::ID_ED_25519; use diesel::{ExpressionMethods, QueryDsl, SelectableHelper}; use diesel_async::RunQueryDsl; use http::{request::Parts, StatusCode}; -use hyper::body::HttpBody; +use http_body_util::BodyExt; use kitsune_core::{error::HttpError, traits::fetcher::AccountFetchOptions}; use kitsune_db::{model::account::Account, schema::accounts, PgPool}; use kitsune_http_signatures::{ @@ -48,10 +48,7 @@ impl FromRequest for SignedActivity { .await .map_err(IntoResponse::into_response)?; - let (mut parts, body) = req - .with_limited_body() - .expect("[Bug] Payload size of inbox not limited") - .into_parts(); + let (mut parts, body) = req.with_limited_body().into_parts(); parts.uri = original_uri; let activity: Activity = match body.collect().await { diff --git a/kitsune/src/http/graphql/mutation/mod.rs b/kitsune/src/http/graphql/mutation/mod.rs index 8e6e65628..d0f55adcb 100644 --- a/kitsune/src/http/graphql/mutation/mod.rs +++ b/kitsune/src/http/graphql/mutation/mod.rs @@ -16,7 +16,7 @@ mod user; /// Saves the file into a user-configured subdirectory and returns a full URL to the file fn handle_upload( ctx: &Context<'_>, - file: &Upload, + file: Upload, description: Option, ) -> Result> + Send + 'static>> { let user_data = ctx.user_data()?; diff --git a/kitsune/src/http/graphql/mutation/user.rs b/kitsune/src/http/graphql/mutation/user.rs index bc636e7e4..7458be193 100644 --- a/kitsune/src/http/graphql/mutation/user.rs +++ b/kitsune/src/http/graphql/mutation/user.rs @@ -28,12 +28,12 @@ impl UserMutation { account_update = account_update.note(note); } - if let Some(ref avatar) = avatar { + if let Some(avatar) = avatar { let media_attachment = handle_upload(ctx, avatar, None)?; account_update = account_update.avatar(media_attachment); } - if let Some(ref header) = header { + if let Some(header) = header { let media_attachment = handle_upload(ctx, header, None)?; account_update = account_update.header(media_attachment); } diff --git a/kitsune/src/http/handler/media.rs b/kitsune/src/http/handler/media.rs index 395eaf329..9a406a071 100644 --- a/kitsune/src/http/handler/media.rs +++ b/kitsune/src/http/handler/media.rs @@ -1,12 +1,11 @@ use crate::{error::Result, state::Zustand}; use axum::{ - body::HttpBody, + body::Body, extract::{Path, State}, response::{IntoResponse, Response}, routing, Router, }; use http::header::CONTENT_TYPE; -use hyper::Body; use kitsune_service::attachment::AttachmentService; use speedy_uuid::Uuid; @@ -19,7 +18,7 @@ async fn get( Ok(( [(CONTENT_TYPE, attachment.content_type)], - Body::wrap_stream(stream).boxed(), + Body::from_stream(stream), ) .into_response()) } diff --git a/kitsune/src/http/handler/oauth/authorize.rs b/kitsune/src/http/handler/oauth/authorize.rs index dbd3783ee..cd413f47d 100644 --- a/kitsune/src/http/handler/oauth/authorize.rs +++ b/kitsune/src/http/handler/oauth/authorize.rs @@ -171,13 +171,13 @@ pub async fn post( // TODO: Bad because no expiration. Either encode an expiration into the cookie and make this basically a shitty JWT // or store session IDs instead that are stored in a TTL data structure (these would need to be either storable in-memory or in Redis; similar to OIDC data) - let user_id_cookie = Cookie::build("user_id", user.id.to_string()) + let user_id_cookie = Cookie::build(("user_id", user.id.to_string())) .same_site(SameSite::Strict) .expires(Expiration::Session) .secure(true); Ok(Either::E1(( - cookies.add(user_id_cookie.finish()), + cookies.add(user_id_cookie), Redirect::to(redirect_to), ))) } diff --git a/kitsune/src/http/handler/public.rs b/kitsune/src/http/handler/public.rs index 9b0e590ef..f9d2da2f5 100644 --- a/kitsune/src/http/handler/public.rs +++ b/kitsune/src/http/handler/public.rs @@ -1,5 +1,5 @@ -use axum::{extract::Path, routing, Router, TypedHeader}; -use axum_extra::either::Either; +use axum::{extract::Path, routing, Router}; +use axum_extra::{either::Either, TypedHeader}; use headers::ContentType; use http::StatusCode; use rust_embed::RustEmbed; diff --git a/kitsune/src/http/handler/users/inbox.rs b/kitsune/src/http/handler/users/inbox.rs index a5a48b9ce..251942d74 100644 --- a/kitsune/src/http/handler/users/inbox.rs +++ b/kitsune/src/http/handler/users/inbox.rs @@ -360,7 +360,8 @@ pub async fn post( State(federation_filter): State, SignedActivity(author, activity): SignedActivity, ) -> Result<()> { - increment_counter!("received_activities"); + let counter = counter!("received_activities"); + counter.increment(1); if !federation_filter .is_entity_allowed(&activity) diff --git a/kitsune/src/http/handler/well_known/webfinger.rs b/kitsune/src/http/handler/well_known/webfinger.rs index 2396e8b41..a6d42ee5c 100644 --- a/kitsune/src/http/handler/well_known/webfinger.rs +++ b/kitsune/src/http/handler/well_known/webfinger.rs @@ -73,9 +73,10 @@ mod tests { Json, }; use axum_extra::either::Either; + use bytes::Bytes; use diesel_async::{AsyncConnection, AsyncPgConnection, RunQueryDsl}; use http::{Request, Response, StatusCode}; - use hyper::Body; + use http_body_util::Empty; use kitsune_activitypub::Fetcher; use kitsune_cache::NoopCache; use kitsune_config::instance::FederationFilterConfiguration; @@ -102,8 +103,10 @@ mod tests { use tempfile::TempDir; use tower::service_fn; - async fn handle(_req: Request) -> Result, Infallible> { - Ok::<_, Infallible>(Response::new(Body::empty())) + async fn handle( + _req: Request, + ) -> Result>, Infallible> { + Ok::<_, Infallible>(Response::new(Empty::new())) } fn build_account_service( diff --git a/kitsune/src/http/middleware.rs b/kitsune/src/http/middleware.rs index 04c717693..ba47d7b16 100644 --- a/kitsune/src/http/middleware.rs +++ b/kitsune/src/http/middleware.rs @@ -1,3 +1,4 @@ +use axum::body::Body; use axum::{ middleware::Next, response::{IntoResponse, Response}, @@ -6,21 +7,18 @@ use axum::{ use bytes::Buf; use headers::{ContentType, HeaderMapExt}; use http::{Request, StatusCode}; -use hyper::{body::HttpBody, Body}; +use http_body_util::BodyExt; use simd_json::OwnedValue; /// Some clients send their OAuth credentials as JSON payloads. This against the OAuth2 RFC but alas, we want high compatibility with Mastodon clients /// /// This middleware deserialises the body into its DOM representation if the header "Content-Type" is set to "application/json" and reencodes it into the URL-encoded version -pub async fn json_to_urlencoded(req: Request, next: Next) -> Response { +pub async fn json_to_urlencoded(req: Request, next: Next) -> Response { if req.headers().typed_get::() != Some(ContentType::json()) { return next.run(req).await; } - let Ok(req) = req.with_limited_body() else { - panic!("[Bug] Body is not limited. Please fix IMMEDIATELY! (annoy the devs)"); - }; - let (parts, body) = req.into_parts(); + let (parts, body) = req.with_limited_body().into_parts(); let json_value = match body .collect() diff --git a/kitsune/src/http/mod.rs b/kitsune/src/http/mod.rs index 8df141310..5e87e578e 100644 --- a/kitsune/src/http/mod.rs +++ b/kitsune/src/http/mod.rs @@ -10,6 +10,7 @@ use cursiv::CsrfLayer; use kitsune_config::server; use miette::{Context, IntoDiagnostic}; use std::time::Duration; +use tokio::net::TcpListener; use tower_http::{ catch_panic::CatchPanicLayer, cors::CorsLayer, @@ -105,10 +106,10 @@ pub fn create_router( pub async fn run(state: Zustand, server_config: server::Configuration) -> miette::Result<()> { let router = create_router(state, &server_config)?; - axum::Server::bind(&([0, 0, 0, 0], server_config.port).into()) - .serve(router.into_make_service()) + let listener = TcpListener::bind(("0.0.0.0", server_config.port)) .await .into_diagnostic()?; + axum::serve(listener, router).await.into_diagnostic()?; Ok(()) } diff --git a/kitsune/src/http/openapi.rs b/kitsune/src/http/openapi.rs index cb788f024..fb4ff14ce 100644 --- a/kitsune/src/http/openapi.rs +++ b/kitsune/src/http/openapi.rs @@ -30,10 +30,12 @@ impl Modify for SecurityAddon { #[derive(ToSchema)] #[schema(as = SmolStr)] +#[allow(dead_code)] // Otherwise `utoipa::ToSchema` can't correctly infer the type struct SmolStrPolyfill(String); #[derive(ToSchema)] #[schema(as = Timestamp)] +#[allow(dead_code)] // Otherwise `utoipa::ToSchema` can't correctly infer the type struct TimestampPolyfill(String); #[derive(OpenApi)] diff --git a/lib/athena/Cargo.toml b/lib/athena/Cargo.toml index 6a0a45454..11db80ca5 100644 --- a/lib/athena/Cargo.toml +++ b/lib/athena/Cargo.toml @@ -22,8 +22,8 @@ redis = { version = "0.24.0", default-features = false, features = [ "tokio-rustls-comp", ] } retry-policies = "0.2.1" -serde = { version = "1.0.194", features = ["derive"] } -simd-json = "0.13.4" +serde = { version = "1.0.195", features = ["derive"] } +simd-json = "0.13.6" smol_str = "0.2.0" speedy-uuid = { path = "../speedy-uuid", features = ["redis", "serde"] } thiserror = "1.0.56" diff --git a/lib/cursiv/Cargo.toml b/lib/cursiv/Cargo.toml index b09bb44f8..848b7b4b6 100644 --- a/lib/cursiv/Cargo.toml +++ b/lib/cursiv/Cargo.toml @@ -9,7 +9,7 @@ aliri_braid = "0.4.0" blake3 = "1.5.0" cookie = { version = "0.18.0", features = ["percent-encode"] } hex-simd = "0.8.0" -http = "0.2.11" +http = "1.0.0" pin-project-lite = "0.2.13" rand = "0.8.5" tower = { version = "0.4.13", default-features = false } @@ -17,7 +17,7 @@ zeroize = { version = "1.7.0", features = ["derive"] } # `axum` feature async-trait = { version = "0.1.77", optional = true } -axum-core = { version = "0.3.4", optional = true } +axum-core = { version = "0.4.2", optional = true } [dev-dependencies] futures = { version = "0.3.30", default-features = false, features = [ diff --git a/lib/http-compat/Cargo.toml b/lib/http-compat/Cargo.toml new file mode 100644 index 000000000..776c613d5 --- /dev/null +++ b/lib/http-compat/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "http-compat" +authors.workspace = true +edition.workspace = true +version.workspace = true + +[dependencies] +http02 = { package = "http", version = "0.2.11" } +http1 = { package = "http", version = "1.0.0" } + +[lints] +workspace = true diff --git a/lib/http-compat/src/lib.rs b/lib/http-compat/src/lib.rs new file mode 100644 index 000000000..0df98df32 --- /dev/null +++ b/lib/http-compat/src/lib.rs @@ -0,0 +1,8 @@ +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 new file mode 100644 index 000000000..2656d59c2 --- /dev/null +++ b/lib/http-compat/src/v0_2.rs @@ -0,0 +1,74 @@ +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 new file mode 100644 index 000000000..59734ecba --- /dev/null +++ b/lib/http-compat/src/v1.rs @@ -0,0 +1,64 @@ +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!(), + } + } +} diff --git a/lib/speedy-uuid/Cargo.toml b/lib/speedy-uuid/Cargo.toml index a90ef108e..242486cd2 100644 --- a/lib/speedy-uuid/Cargo.toml +++ b/lib/speedy-uuid/Cargo.toml @@ -5,13 +5,13 @@ edition.workspace = true version.workspace = true [dependencies] -async-graphql = { version = "6.0.11", default-features = false, optional = true } +async-graphql = { version = "7.0.0", default-features = false, optional = true } diesel = { version = "2.1.4", features = [ "postgres_backend", "uuid", ], optional = true } redis = { version = "0.24.0", default-features = false, optional = true } -serde = { version = "1.0.194", optional = true } +serde = { version = "1.0.195", optional = true } thiserror = "1.0.56" uuid = { version = "1.6.1", features = ["fast-rng", "v7"] } uuid-simd = { version = "0.8.0", features = ["unstable", "uuid"] } diff --git a/lib/tower-x-clacks-overhead/Cargo.toml b/lib/tower-x-clacks-overhead/Cargo.toml index 3e11a94bc..1b2fa9763 100644 --- a/lib/tower-x-clacks-overhead/Cargo.toml +++ b/lib/tower-x-clacks-overhead/Cargo.toml @@ -5,7 +5,7 @@ edition.workspace = true version.workspace = true [dependencies] -http = "0.2.11" +http = "1.0.0" pin-project-lite = "0.2.13" tower-layer = "0.3.2" tower-service = "0.3.2"