From 608530e8ed76e1264530e14bb683a3079496f0f4 Mon Sep 17 00:00:00 2001 From: Daniel Tschan Date: Mon, 11 Nov 2024 17:43:27 +0100 Subject: [PATCH 1/2] Update to Hyper 1.5 --- Cargo.lock | 828 +++++++++++++++++++++++++++++++++++----------------- Cargo.toml | 13 +- src/main.rs | 221 +++++++++----- 3 files changed, 712 insertions(+), 350 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1715e57..3daaef7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,35 +2,104 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] [[package]] name = "base64" -version = "0.13.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytes" -version = "1.1.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "cc" -version = "1.0.73" +version = "1.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -40,22 +109,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ - "libc", - "num-integer", + "android-tzdata", + "iana-time-zone", + "js-sys", "num-traits", - "time", - "winapi", + "wasm-bindgen", + "windows-targets", ] [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -63,17 +133,79 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] [[package]] name = "fastrand" -version = "1.7.0" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" + +[[package]] +name = "flate2" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ - "instant", + "crc32fast", + "miniz_oxide", ] [[package]] @@ -99,9 +231,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "futures" -version = "0.3.21" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -114,9 +246,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.21" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -124,15 +256,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.21" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -141,15 +273,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.21" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.21" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -158,21 +290,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -186,17 +318,33 @@ dependencies = [ "slab", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + [[package]] name = "h2" -version = "0.3.12" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62eeb471aa3e3c9197aa4bfeabfe02982f6dc96f750486c0bb0009ac58b26d2b" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http", "indexmap", "slab", @@ -207,33 +355,40 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "libc", + "digest", ] [[package]] name = "hmac-sha1" -version = "0.1.3" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1333fad8d94b82cab989da428b0b36a3435db3870d85e971a1d6dc0a8576722" +checksum = "6b05da5b9e5d4720bfb691eebb2b9d42da3570745da71eac8a1f5bb7e59aab88" dependencies = [ + "hmac", "sha1", ] [[package]] name = "http" -version = "0.2.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -242,36 +397,47 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.4" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", "pin-project-lite", ] [[package]] name = "httparse" -version = "1.6.0" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.17" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043f0e083e9901b6cc658a77d1eb86f4fc650bbb977a4337dd63192826aa85dd" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", "http", @@ -280,116 +446,155 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", + "http-body-util", "hyper", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", ] [[package]] -name = "indexmap" -version = "1.8.0" +name = "hyper-util" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ - "autocfg", - "hashbrown", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", ] [[package]] -name = "instant" -version = "0.1.12" +name = "iana-time-zone" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ - "cfg-if", + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown", ] [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] -name = "lazy_static" -version = "1.4.0" +name = "js-sys" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +dependencies = [ + "wasm-bindgen", +] [[package]] name = "libc" -version = "0.2.119" +version = "0.2.162" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.6" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ + "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if", -] +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.4.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "mio" +name = "miniz_oxide" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", + "adler2", ] [[package]] -name = "miow" -version = "0.3.7" +name = "mio" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ - "winapi", + "hermit-abi", + "libc", + "wasi", + "windows-sys 0.52.0", ] [[package]] name = "native-tls" -version = "0.2.8" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -401,64 +606,56 @@ dependencies = [ "tempfile", ] -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi", -] - -[[package]] -name = "num-integer" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -dependencies = [ - "autocfg", - "num-traits", -] - [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] -name = "num_cpus" -version = "1.13.1" +name = "object" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ - "hermit-abi", - "libc", + "memchr", ] [[package]] name = "once_cell" -version = "1.10.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl" -version = "0.10.38" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags", "cfg-if", "foreign-types", "libc", "once_cell", + "openssl-macros", "openssl-sys", ] +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "openssl-probe" version = "0.1.5" @@ -467,11 +664,10 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.72" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ - "autocfg", "cc", "libc", "pkg-config", @@ -480,9 +676,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -490,22 +686,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.1" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-targets", ] [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -515,44 +711,54 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.24" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.15" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.2.11" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags", ] [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustix" +version = "0.38.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" dependencies = [ - "winapi", + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", ] [[package]] @@ -561,36 +767,36 @@ version = "0.1.0" dependencies = [ "base64", "chrono", + "flate2", "futures", "hmac-sha1", + "http-body-util", "hyper", "hyper-tls", - "signal-hook", - "signal-hook-tokio", + "hyper-util", "tokio", ] [[package]] name = "schannel" -version = "0.1.19" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ - "lazy_static", - "winapi", + "windows-sys 0.59.0", ] [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.6.1" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags", "core-foundation", @@ -601,9 +807,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -611,124 +817,108 @@ dependencies = [ [[package]] name = "sha1" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" - -[[package]] -name = "signal-hook" -version = "0.3.13" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "libc", - "signal-hook-registry", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] -name = "signal-hook-registry" -version = "1.4.0" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "signal-hook-tokio" -version = "0.3.1" +name = "signal-hook-registry" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213241f76fb1e37e27de3b6aa1b068a2c333233b59cca6634f634b80a27ecf1e" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ - "futures-core", "libc", - "signal-hook", - "tokio", ] [[package]] name = "slab" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.4.4" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "winapi", + "windows-sys 0.52.0", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" -version = "1.0.86" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] name = "tempfile" -version = "3.3.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi", - "winapi", + "once_cell", + "rustix", + "windows-sys 0.59.0", ] [[package]] name = "tokio" -version = "1.17.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ + "backtrace", "bytes", "libc", - "memchr", "mio", - "num_cpus", - "once_cell", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "winapi", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "1.7.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", @@ -737,9 +927,9 @@ dependencies = [ [[package]] name = "tokio-native-tls" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", "tokio", @@ -747,55 +937,59 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.9" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", "futures-sink", - "log", "pin-project-lite", "tokio", ] [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.32" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.23" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] -name = "unicode-xid" -version = "0.2.2" +name = "typenum" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "vcpkg" @@ -803,83 +997,169 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] [[package]] name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "winapi" -version = "0.3.9" +name = "wasm-bindgen" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "quote", + "wasm-bindgen-macro-support", ] [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +name = "wasm-bindgen-macro-support" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "windows-sys" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] [[package]] name = "windows-sys" -version = "0.32.0" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ + "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", + "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", + "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[package]] name = "windows_aarch64_msvc" -version = "0.32.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.32.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.32.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.32.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.32.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/Cargo.toml b/Cargo.toml index d79b083..1191a6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,14 +6,15 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -base64 = "0.13.0" +base64 = "0" chrono = "0" +flate2 = "1.0.34" futures = "0.3.21" -hmac-sha1 = "0.1.3" -hyper = { version = "0.14", features = ["full"] } -hyper-tls = "0.5.0" -signal-hook = "0.3.13" -signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"] } +hmac-sha1 = "0" +http-body-util = "0.1.2" +hyper = { version = "1", features = ["full"] } +hyper-tls = "0" +hyper-util = { version = "0.1.10", features = ["client", "client-legacy", "http1"] } tokio = { version = "1", features = ["full"] } [profile.release] diff --git a/src/main.rs b/src/main.rs index 992007f..845da9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,26 @@ -use std::convert::Infallible; use std::error::Error; use std::process::exit; +use std::{convert::Infallible, net::SocketAddr}; use chrono::Utc; -use hmacsha1::hmac_sha1; -use hyper::header::HeaderValue; -use hyper::service::{make_service_fn, service_fn}; -use hyper::{Body, Request, Response, Server, Client, StatusCode, body}; +use futures::stream::{self, StreamExt}; +use hmac_sha1::hmac_sha1; +use http_body_util::{combinators::BoxBody, BodyExt, BodyStream, Empty, Full, StreamBody}; +use hyper::{ + body::{Body, Bytes, Frame, Incoming}, + header::HeaderValue, + server::conn::http1, + service::service_fn, + Request, Response, StatusCode, +}; +//use hyper::service::{make_service_fn, service_fn}; +//use hyper::{body, Body, Client, Request, Response, Server, StatusCode}; use hyper_tls::HttpsConnector; -use signal_hook_tokio::Signals; -use signal_hook::consts::signal::*; -use futures::stream::{StreamExt, self}; +use hyper_util::{ + client::legacy::Client, + rt::{TokioExecutor, TokioIo, TokioTimer}, +}; +use tokio::net::TcpListener; // type Result = std::result::Result>; @@ -27,28 +37,65 @@ use futures::stream::{StreamExt, self}; // -H "Authorization: AWS ${s3_key}:${signature}" \ // https://${host}${resource} -async fn proxy_handler(mut request: Request) -> Result, Box> { +fn full>(chunk: T) -> BoxBody { + Full::new(chunk.into()) + .map_err(|never| match never {}) + .boxed() +} + +async fn proxy_handler( + mut request: Request, +) -> Result, Box> { //let mut res = Response::new(Body::empty()); //let header_access_key = request.headers_mut().remove("Access-Key"); - let s3_host = request.headers_mut().remove("S3-Host").ok_or("400 Missing required header 'S3-Host'!")?. - to_str().map_err(|_| "400 Invalid characters in header 'S3-Host'!")?.to_owned(); - let access_key = request.headers_mut().remove("Access-Key").ok_or("400 Missing required header 'Access-Key'!")?. - to_str().map_err(|_| "400 Invalid characters in header 'Access-Key'!")?.to_owned(); - let secret_key = request.headers_mut().remove("Secret-Key").ok_or("400 Missing required header 'Secret-Key'!")?. - to_str().map_err(|_| "400 Invalid characters in header 'Secret-Key'!")?.to_owned(); - - let content_type = request.headers_mut().entry("content-type").or_insert("application/octet_stream".parse()?). - to_str().map_err(|_| "400 Invalid characters in header 'Content-Type'!")?.to_owned(); + let s3_host = request + .headers_mut() + .remove("S3-Host") + .ok_or("400 Missing required header 'S3-Host'!")? + .to_str() + .map_err(|_| "400 Invalid characters in header 'S3-Host'!")? + .to_owned(); + let access_key = request + .headers_mut() + .remove("Access-Key") + .ok_or("400 Missing required header 'Access-Key'!")? + .to_str() + .map_err(|_| "400 Invalid characters in header 'Access-Key'!")? + .to_owned(); + let secret_key = request + .headers_mut() + .remove("Secret-Key") + .ok_or("400 Missing required header 'Secret-Key'!")? + .to_str() + .map_err(|_| "400 Invalid characters in header 'Secret-Key'!")? + .to_owned(); + let request_encoding = request + .headers_mut() + .remove("Request-Encoding") + .unwrap_or("".parse()?) + .to_str() + .map_err(|_| "400 Invalid characters in header 'Request-Encoding'!")? + .to_owned(); + + let content_type = request + .headers_mut() + .entry("content-type") + .or_insert("application/octet_stream".parse()?) + .to_str() + .map_err(|_| "400 Invalid characters in header 'Content-Type'!")? + .to_owned(); request.headers_mut().insert("host", s3_host.parse()?); let date = Utc::now().format("%a, %d %b %Y %T %z").to_string(); request.headers_mut().insert("Date", date.parse()?); //request.headers_mut().insert("Date", HeaderValue::from_str(&date).unwrap()); - let signature = format!("{}\n\n{}\n{}\n{}", - request.method(), - content_type, - date, - request.uri().path()); + let signature = format!( + "{}\n\n{}\n{}\n{}", + request.method(), + content_type, + date, + request.uri().path() + ); //let mut mac = Hmac::::new_from_slice(secret_key.as_bytes()); //mac.update(signature.as_bytes()); let signature_hash = hmac_sha1(secret_key.as_bytes(), signature.as_bytes()); @@ -57,7 +104,9 @@ async fn proxy_handler(mut request: Request) -> Result, Box // let authorization = format!("AWS {}:{}", String::from_utf8_lossy(access_key.as_bytes()), base64::encode(signature_hash)); let authorization = format!("AWS {}:{}", access_key, base64::encode(signature_hash)); - request.headers_mut().insert("Authorization", authorization.parse()?); + request + .headers_mut() + .insert("Authorization", authorization.parse()?); //request. // let url = format!("{}{}", String::from_utf8_lossy(s3_host.as_bytes()), request.uri().path()); @@ -66,8 +115,10 @@ async fn proxy_handler(mut request: Request) -> Result, Box *request.uri_mut() = url.parse()?; let https = HttpsConnector::new(); - let client = Client::builder().build::<_, hyper::Body>(https); - println!("{:?}", request); + let client = Client::builder(TokioExecutor::new()).build::<_, Incoming>(https); + //let stream = request.into_parts() + //let request = request.body_mut() = Body::wrap_stream(Gz::new( + //println!("{:?}", request); let response = client.request(request).await; println!("{:?}", response); @@ -75,76 +126,106 @@ async fn proxy_handler(mut request: Request) -> Result, Box Ok(response?) //Ok(Response::new(Body::from("Hello World!"))) //Ok(Response::new(request.into_body())) - } -async fn proxy_handler_wrapper(request: Request) -> Result, Infallible> { - match proxy_handler(request).await { - Ok(mut response) => { - if response.status().is_client_error() || response.status().is_server_error() { - let prefix = "Upstream: "; - let suffix = "\r\n"; - let (parts, body) = response.into_parts(); - let stream = Body::from(prefix).chain(body).chain(Body::from(suffix)); - response = Response::from_parts(parts, Body::wrap_stream(stream)); - - // Update Content-Length header to factor in added prefix and suffix - if let Some(length) = response.headers().get("Content-Length") { - let mut length = length.to_str().unwrap_or("").parse::().unwrap_or(0); - if length > 0 { - length += prefix.len() + suffix.len(); - response.headers_mut().insert("Content-Length", HeaderValue::from(length)); +// fn full>(chunk: T) -> BoxBody { +// Full::new(chunk.into()) +// .map_err(|never| match never {}) +// .boxed() +// } + +async fn proxy_handler_wrapper( + request: Request, +) -> Result>, hyper::Error> { + match proxy_handler(request).await { + Ok(response) => { + let (mut parts, body) = response.into_parts(); + if parts.status.is_client_error() || parts.status.is_server_error() { + // println!("{:?}", body); + let prefix = "Upstream: "; + let suffix = "\r\n"; + //let (parts, body) = response.into_parts(); + //let stream = Body::from(prefix).chain(body).chain(Body::from(suffix)); + let stream = BodyStream::new(full(prefix)); + //let stream = Full::new(prefix.into()).into_data_stream(); + //let stream2 = body.into_data_stream(); + let stream2 = BodyStream::new(body); + //let stream3 = Full::new(suffix.into()).into_data_stream(); + let stream = stream.chain(stream2); + //response = Response::from_parts(parts, Body::wrap_stream(stream)); + let body = BoxBody::new(StreamBody::new(stream)); + + // Update Content-Length header to factor in added prefix and suffix + if let Some(length) = parts.headers.get("Content-Length") { + let mut length = length.to_str().unwrap_or("").parse::().unwrap_or(0); + if length > 0 { + length += prefix.len() + suffix.len(); + parts + .headers + .insert("Content-Length", HeaderValue::from(length)); + } } + Ok(Response::from_parts(parts, body)) + } else { + Ok(Response::from_parts(parts, body.boxed())) } } - - Ok(response) - } - Err(error) => { - println!("Error: {}", error); - let status: StatusCode = error.to_string()[0..3].parse().unwrap_or(StatusCode::INTERNAL_SERVER_ERROR); - Ok(Response::builder().status(status).body(Body::from(format!("S3-Proxy: {}\n", error))).unwrap()) + Err(error) => { + println!("Error: {}", error); + let status: StatusCode = error.to_string()[0..3] + .parse() + .unwrap_or(StatusCode::INTERNAL_SERVER_ERROR); + let response = Response::builder() + .status(status) + .body(full(format!("S3-Proxy: {}\n", error)).boxed()) + .unwrap(); + Ok(response) + } } - } -} - -async fn shutdown_signal(status: &mut i32) { - let mut signals = Signals::new(&[SIGTERM, SIGINT, SIGQUIT]).unwrap(); - let handle = signals.handle(); - - *status = signals.next().await.unwrap() + 128; - //println!("\n{}", signal); - - handle.close(); - - //Ok(()) } #[tokio::main] pub async fn main() -> Result<(), Box> { // For every connection, we must make a `Service` to handle all // incoming HTTP requests on said connection. - let make_svc = make_service_fn(|_conn| { + /* let make_svc = make_service_fn(|_conn| { // This is the `Service` that will handle the connection. // `service_fn` is a helper to convert a function that // returns a Response into a `Service`. async { Ok::<_, Infallible>(service_fn(proxy_handler_wrapper)) } - }); + }); */ - let addr = ([0, 0, 0, 0], 8080).into(); + let addr: SocketAddr = ([0, 0, 0, 0], 8080).into(); - let server = Server::bind(&addr).serve(make_svc); + //let server = Server::bind(&addr).serve(make_svc); println!("Listening on http://{}", addr); - let mut status: i32 = 0; + /* let mut status: i32 = 0; let graceful = server.with_graceful_shutdown(shutdown_signal(&mut status)); if let Err(e) = graceful.await { eprintln!("server error: {}", e); - } + } */ // println!("{:?}", graceful); // server.await?; - exit(status); + let listener = TcpListener::bind(addr).await?; + loop { + let (tcp, _) = listener.accept().await?; + let io = TokioIo::new(tcp); + + tokio::task::spawn(async move { + // Handle the connection from the client using HTTP1 and pass any + // HTTP requests received on that connection to the `hello` function + if let Err(err) = http1::Builder::new() + .timer(TokioTimer::new()) + .serve_connection(io, service_fn(proxy_handler_wrapper)) + .await + { + println!("Error serving connection: {:?}", err); + } + }); + } + //exit(status); //Ok(()) } From ee12c0de883e0465860a6d1763f48643b002eea5 Mon Sep 17 00:00:00 2001 From: Daniel Tschan Date: Sat, 23 Nov 2024 17:03:51 +0100 Subject: [PATCH 2/2] Add compression support for uploads --- Cargo.lock | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 6 +- README.md | 10 +- src/main.rs | 222 +++++++++++++++++++++-------------------- 4 files changed, 404 insertions(+), 111 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3daaef7..f656352 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,15 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -32,6 +41,19 @@ dependencies = [ "libc", ] +[[package]] +name = "async-compression" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cb8f1d480b0ea3783ab015936d2a55c87e219676f0c0b7dec61494043f21857" +dependencies = [ + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -165,6 +187,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "digest" version = "0.10.7" @@ -534,6 +565,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" version = "0.2.162" @@ -562,6 +599,15 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "memchr" version = "2.7.4" @@ -606,6 +652,22 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-traits" version = "0.2.19" @@ -674,6 +736,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking_lot" version = "0.12.3" @@ -715,6 +783,12 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "proc-macro2" version = "1.0.89" @@ -742,6 +816,50 @@ dependencies = [ "bitflags", ] +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -765,9 +883,9 @@ dependencies = [ name = "s3-proxy" version = "0.1.0" dependencies = [ + "async-compression", "base64", "chrono", - "flate2", "futures", "hmac-sha1", "http-body-util", @@ -775,6 +893,10 @@ dependencies = [ "hyper-tls", "hyper-util", "tokio", + "tokio-util", + "tracing", + "tracing-logfmt", + "tracing-subscriber", ] [[package]] @@ -815,6 +937,26 @@ dependencies = [ "libc", ] +[[package]] +name = "serde" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sha1" version = "0.10.6" @@ -826,6 +968,15 @@ dependencies = [ "digest", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "1.3.0" @@ -896,6 +1047,47 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tokio" version = "1.41.1" @@ -960,10 +1152,23 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" version = "0.1.32" @@ -971,6 +1176,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-logfmt" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1f47d22deb79c3f59fcf2a1f00f60cbdc05462bf17d1cd356c1fefa3f444bd" +dependencies = [ + "time", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] @@ -991,6 +1238,12 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" @@ -1073,6 +1326,28 @@ version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-core" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index 1191a6e..4f20155 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +async-compression = { version = "0.4.17", features = ["gzip", "tokio"] } base64 = "0" chrono = "0" -flate2 = "1.0.34" futures = "0.3.21" hmac-sha1 = "0" http-body-util = "0.1.2" @@ -16,6 +16,10 @@ hyper = { version = "1", features = ["full"] } hyper-tls = "0" hyper-util = { version = "0.1.10", features = ["client", "client-legacy", "http1"] } tokio = { version = "1", features = ["full"] } +tokio-util = { version = "0.7.12", features = ["io"] } +tracing = { version = "0.1.40", features = ["log"] } +tracing-logfmt = "0.3.5" +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } [profile.release] lto = true diff --git a/README.md b/README.md index ea1a8b1..50890ad 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # s3-proxy -Reverse Proxy signing requests for S3 object store. Allows to up- and download files to/from S3 buckets with curl only. +Reverse Proxy signing requests for S3 object store. Allows to up- and download files to/from S3 buckets with curl only. Optionally compresses the file while uploading it to S3. ## Installation on OpenShift @@ -20,9 +20,11 @@ Only the `curl` tool is needed to use this proxy. ## Usage ```sh -curl -sS -H S3-Host: -H Access-Key: -H Secret-Key: https:/// +curl -sS -H S3-Host: -H Access-Key: -H Secret-Key: -H Compress-File: https:/// ``` +Currently the only supported compression method is `gzip`. No compression is applied if no `Compress-File` header is set. + ## Example Upload Java Heap Dumps to S3, especially useful in Kubernetes Pods: @@ -30,10 +32,10 @@ Upload Java Heap Dumps to S3, especially useful in Kubernetes Pods: ```sh JAVA_TOOL_OPTIONS: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/dump.hprof - -XX:OnOutOfMemoryError="gzip /tmp/dump.hprof && - curl -T /tmp/dump.hprof.gz + -XX:OnOutOfMemoryError="curl -T /tmp/dump.hprof -H S3-Host:s3-objects.example.org -H Access-Key:${S3_ACCESS_KEY} -H Secret-Key:${S3_SECRET_KEY} + -H Compress-File:gzip https://s3-proxy.example.org/java-dumps/dump_$(cat /run/secrets/kubernetes.io/serviceaccount/namespace)_${HOSTNAME}.hprof.gz" ``` diff --git a/src/main.rs b/src/main.rs index 845da9d..7892909 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,41 +1,30 @@ use std::error::Error; -use std::process::exit; -use std::{convert::Infallible, net::SocketAddr}; +use std::io; +use std::net::SocketAddr; +use async_compression::tokio::bufread::GzipEncoder; +use base64::prelude::*; use chrono::Utc; -use futures::stream::{self, StreamExt}; +use futures::stream::StreamExt; +use futures::TryStreamExt; use hmac_sha1::hmac_sha1; -use http_body_util::{combinators::BoxBody, BodyExt, BodyStream, Empty, Full, StreamBody}; +use http_body_util::{combinators::BoxBody, BodyExt, BodyStream, Full, StreamBody}; use hyper::{ - body::{Body, Bytes, Frame, Incoming}, - header::HeaderValue, + body::{Bytes, Frame, Incoming}, server::conn::http1, service::service_fn, Request, Response, StatusCode, }; -//use hyper::service::{make_service_fn, service_fn}; -//use hyper::{body, Body, Client, Request, Response, Server, StatusCode}; use hyper_tls::HttpsConnector; use hyper_util::{ client::legacy::Client, rt::{TokioExecutor, TokioIo, TokioTimer}, }; use tokio::net::TcpListener; - -// type Result = std::result::Result>; - -// resource="/${bucket}/${file}" -// content_type="application/octet-stream" -// date=`date -R --utc` -// _signature="PUT\n\n${content_type}\ nown${date}\n${resource}" -// signature=`echo -en ${_signature} | openssl sha1 -hmac ${s3_secret} -binary | base64` - -// curl -X PUT -T "${file}" \ -// -H "Host: ${host}" \ -// -H "Date: ${date}" \ -// -H "Content-Type: ${content_type}" \ -// -H "Authorization: AWS ${s3_key}:${signature}" \ -// https://${host}${resource} +use tokio_util::io::{ReaderStream, StreamReader}; +use tracing::{error, info, Span}; +use tracing_logfmt; +use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry}; fn full>(chunk: T) -> BoxBody { Full::new(chunk.into()) @@ -46,9 +35,6 @@ fn full>(chunk: T) -> BoxBody { async fn proxy_handler( mut request: Request, ) -> Result, Box> { - //let mut res = Response::new(Body::empty()); - - //let header_access_key = request.headers_mut().remove("Access-Key"); let s3_host = request .headers_mut() .remove("S3-Host") @@ -70,14 +56,13 @@ async fn proxy_handler( .to_str() .map_err(|_| "400 Invalid characters in header 'Secret-Key'!")? .to_owned(); - let request_encoding = request + let compress_file = request .headers_mut() - .remove("Request-Encoding") + .remove("Compress-File") .unwrap_or("".parse()?) .to_str() - .map_err(|_| "400 Invalid characters in header 'Request-Encoding'!")? + .map_err(|_| "400 Invalid characters in header 'Compress-File'!")? .to_owned(); - let content_type = request .headers_mut() .entry("content-type") @@ -85,10 +70,12 @@ async fn proxy_handler( .to_str() .map_err(|_| "400 Invalid characters in header 'Content-Type'!")? .to_owned(); + request.headers_mut().insert("host", s3_host.parse()?); + let date = Utc::now().format("%a, %d %b %Y %T %z").to_string(); request.headers_mut().insert("Date", date.parse()?); - //request.headers_mut().insert("Date", HeaderValue::from_str(&date).unwrap()); + let signature = format!( "{}\n\n{}\n{}\n{}", request.method(), @@ -96,82 +83,116 @@ async fn proxy_handler( date, request.uri().path() ); - //let mut mac = Hmac::::new_from_slice(secret_key.as_bytes()); - //mac.update(signature.as_bytes()); let signature_hash = hmac_sha1(secret_key.as_bytes(), signature.as_bytes()); - println!("{:?}", signature); - println!("{}", base64::encode(signature_hash)); - // let authorization = format!("AWS {}:{}", String::from_utf8_lossy(access_key.as_bytes()), base64::encode(signature_hash)); - let authorization = format!("AWS {}:{}", access_key, base64::encode(signature_hash)); + let authorization = format!( + "AWS {}:{}", + access_key, + BASE64_STANDARD.encode(signature_hash) + ); request .headers_mut() .insert("Authorization", authorization.parse()?); - //request. - // let url = format!("{}{}", String::from_utf8_lossy(s3_host.as_bytes()), request.uri().path()); let url = format!("https://{}{}", s3_host, request.uri().path()); - println!("{}", url); *request.uri_mut() = url.parse()?; let https = HttpsConnector::new(); - let client = Client::builder(TokioExecutor::new()).build::<_, Incoming>(https); - //let stream = request.into_parts() - //let request = request.body_mut() = Body::wrap_stream(Gz::new( - //println!("{:?}", request); - let response = client.request(request).await; - - println!("{:?}", response); + let response = if request.method() == "PUT" && compress_file == "gzip" { + let (mut parts, body) = request.into_parts(); + parts.headers.remove("Content-Length"); + let stream = body + .map_err(|e| io::Error::new(io::ErrorKind::Other, e)) + .into_data_stream(); + let stream_reader = StreamReader::new(stream); + let encoder = GzipEncoder::new(stream_reader); + let stream = ReaderStream::new(encoder).map_ok(Frame::data); + let body = StreamBody::new(stream); + let request = Request::from_parts(parts, body); + let client = Client::builder(TokioExecutor::new()).build(https); + client.request(request).await + } else { + let client = Client::builder(TokioExecutor::new()).build(https); + client.request(request).await + }; Ok(response?) - //Ok(Response::new(Body::from("Hello World!"))) - //Ok(Response::new(request.into_body())) } -// fn full>(chunk: T) -> BoxBody { -// Full::new(chunk.into()) -// .map_err(|never| match never {}) -// .boxed() -// } +fn client_ip(request: &Request, addr: Option) -> String { + request + .headers() + .get("x-forwarded-for") + .and_then(|h| h.to_str().ok()) + .map(String::from) + .unwrap_or_else(|| { + addr.map(|a| a.ip().to_string()) + .unwrap_or_else(|| "-".to_string()) + }) +} + +/* fn log_request(client_ip: &str, ) -> Span { + let remote_addr = client_ip(request, addr); + + info_span!( + "", + remote_addr = remote_addr, + method = request.method().to_string(), + path = request.uri().path(), + status = field::Empty, + size = field::Empty + ) +} */ + +fn log_response(client_ip: &str, method: &str, path: &str, response: &Response) { + let span = Span::current(); + let status = response.status().as_u16(); + span.record("status", status); + + let size = response + .headers() + .get(hyper::header::CONTENT_LENGTH) + .and_then(|length| length.to_str().ok()) + .unwrap_or("-"); + span.record("size", size); + + info!( + remote_addr = client_ip, + method = method, + path = path, + status = status, + size = size, + ); +} async fn proxy_handler_wrapper( request: Request, + addr: SocketAddr, ) -> Result>, hyper::Error> { + let client_ip = client_ip(&request, Some(addr)); + let method = request.method().to_string(); + let path = request.uri().path().to_string(); match proxy_handler(request).await { Ok(response) => { let (mut parts, body) = response.into_parts(); if parts.status.is_client_error() || parts.status.is_server_error() { - // println!("{:?}", body); + parts.headers.remove("Content-Length"); let prefix = "Upstream: "; let suffix = "\r\n"; - //let (parts, body) = response.into_parts(); - //let stream = Body::from(prefix).chain(body).chain(Body::from(suffix)); - let stream = BodyStream::new(full(prefix)); - //let stream = Full::new(prefix.into()).into_data_stream(); - //let stream2 = body.into_data_stream(); - let stream2 = BodyStream::new(body); - //let stream3 = Full::new(suffix.into()).into_data_stream(); - let stream = stream.chain(stream2); - //response = Response::from_parts(parts, Body::wrap_stream(stream)); - let body = BoxBody::new(StreamBody::new(stream)); - - // Update Content-Length header to factor in added prefix and suffix - if let Some(length) = parts.headers.get("Content-Length") { - let mut length = length.to_str().unwrap_or("").parse::().unwrap_or(0); - if length > 0 { - length += prefix.len() + suffix.len(); - parts - .headers - .insert("Content-Length", HeaderValue::from(length)); - } - } - Ok(Response::from_parts(parts, body)) + let stream = BodyStream::new(full(prefix)) + .chain(BodyStream::new(body)) + .chain(BodyStream::new(full(suffix))); + let body = StreamBody::new(stream); + let response = Response::from_parts(parts, BodyExt::boxed(body)); + log_response(&client_ip, &method, &path, &response); + Ok(response) } else { - Ok(Response::from_parts(parts, body.boxed())) + let response = Response::from_parts(parts, body.boxed()); + log_response(&client_ip, &method, &path, &response); + Ok(response) } } Err(error) => { - println!("Error: {}", error); let status: StatusCode = error.to_string()[0..3] .parse() .unwrap_or(StatusCode::INTERNAL_SERVER_ERROR); @@ -179,6 +200,7 @@ async fn proxy_handler_wrapper( .status(status) .body(full(format!("S3-Proxy: {}\n", error)).boxed()) .unwrap(); + log_response(&client_ip, &method, &path, &response); Ok(response) } } @@ -186,46 +208,36 @@ async fn proxy_handler_wrapper( #[tokio::main] pub async fn main() -> Result<(), Box> { - // For every connection, we must make a `Service` to handle all - // incoming HTTP requests on said connection. - /* let make_svc = make_service_fn(|_conn| { - // This is the `Service` that will handle the connection. - // `service_fn` is a helper to convert a function that - // returns a Response into a `Service`. - async { Ok::<_, Infallible>(service_fn(proxy_handler_wrapper)) } - }); */ - - let addr: SocketAddr = ([0, 0, 0, 0], 8080).into(); + // Initialize logging with logfmt format and env-filter + let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")); - //let server = Server::bind(&addr).serve(make_svc); + let subscriber = Registry::default() + .with(env_filter) + .with(tracing_logfmt::Builder::new() + .with_target(false) + .layer()); + tracing::subscriber::set_global_default(subscriber)?; - println!("Listening on http://{}", addr); + let addr: SocketAddr = ([0, 0, 0, 0], 8080).into(); - /* let mut status: i32 = 0; - let graceful = server.with_graceful_shutdown(shutdown_signal(&mut status)); - if let Err(e) = graceful.await { - eprintln!("server error: {}", e); - } */ - // println!("{:?}", graceful); - // server.await?; + info!(port = 8080, "Starting server"); let listener = TcpListener::bind(addr).await?; loop { - let (tcp, _) = listener.accept().await?; + let (tcp, addr) = listener.accept().await?; let io = TokioIo::new(tcp); tokio::task::spawn(async move { - // Handle the connection from the client using HTTP1 and pass any - // HTTP requests received on that connection to the `hello` function if let Err(err) = http1::Builder::new() .timer(TokioTimer::new()) - .serve_connection(io, service_fn(proxy_handler_wrapper)) + .serve_connection( + io, + service_fn(move |req| proxy_handler_wrapper(req, addr)), + ) .await { - println!("Error serving connection: {:?}", err); + error!(error = ?err, "Error serving connection"); } }); } - //exit(status); - //Ok(()) }