From 57cd45da4b30ddd0f1ad8db1c9ba86bffa166922 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 May 2024 17:21:38 +0000 Subject: [PATCH 01/28] Bump serenity from 0.11.7 to 0.12.1 Bumps [serenity](https://github.com/serenity-rs/serenity) from 0.11.7 to 0.12.1. - [Release notes](https://github.com/serenity-rs/serenity/releases) - [Changelog](https://github.com/serenity-rs/serenity/blob/current/CHANGELOG.md) - [Commits](https://github.com/serenity-rs/serenity/compare/v0.11.7...v0.12.1) --- updated-dependencies: - dependency-name: serenity dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 189 +++++++++++++++++++---------------- tremor-connectors/Cargo.toml | 2 +- 2 files changed, 104 insertions(+), 87 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d9df576b2..cab3e8928a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -246,6 +246,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +dependencies = [ + "serde", +] + [[package]] name = "ascii-canvas" version = "3.0.0" @@ -532,7 +541,7 @@ dependencies = [ "futures-core", "futures-io", "rustls 0.18.1", - "webpki 0.21.4", + "webpki", "webpki-roots 0.20.0", ] @@ -547,22 +556,6 @@ dependencies = [ "syn 2.0.58", ] -[[package]] -name = "async-tungstenite" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b71b31561643aa8e7df3effe284fa83ab1a840e52294c5f4bd7bfd8b2becbb" -dependencies = [ - "futures-io", - "futures-util", - "log", - "pin-project-lite 0.2.14", - "tokio", - "tokio-rustls 0.23.4", - "tungstenite 0.17.3", - "webpki-roots 0.22.6", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -594,7 +587,7 @@ dependencies = [ "serde", "serde_urlencoded 0.6.1", "url", - "webpki 0.21.4", + "webpki", "webpki-roots 0.19.0", "wildmatch", ] @@ -3250,7 +3243,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" dependencies = [ - "arrayvec", + "arrayvec 0.5.2", "bitflags 1.3.2", "cfg-if", "ryu", @@ -4797,7 +4790,7 @@ dependencies = [ "log", "ring 0.16.20", "sct 0.6.1", - "webpki 0.21.4", + "webpki", ] [[package]] @@ -4810,31 +4803,33 @@ dependencies = [ "log", "ring 0.16.20", "sct 0.6.1", - "webpki 0.21.4", + "webpki", ] [[package]] name = "rustls" -version = "0.20.9" +version = "0.21.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" +checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" dependencies = [ "log", - "ring 0.16.20", + "ring 0.17.8", + "rustls-webpki 0.101.7", "sct 0.7.1", - "webpki 0.22.4", ] [[package]] name = "rustls" -version = "0.21.11" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", "ring 0.17.8", - "rustls-webpki", - "sct 0.7.1", + "rustls-pki-types", + "rustls-webpki 0.102.3", + "subtle", + "zeroize", ] [[package]] @@ -4858,6 +4853,12 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + [[package]] name = "rustls-webpki" version = "0.101.7" @@ -4868,6 +4869,17 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "rustls-webpki" +version = "0.102.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +dependencies = [ + "ring 0.17.8", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "rustversion" version = "1.0.15" @@ -4976,6 +4988,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "serde", + "zeroize", +] + [[package]] name = "security-framework" version = "2.10.0" @@ -5142,29 +5164,29 @@ dependencies = [ [[package]] name = "serenity" -version = "0.11.7" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a7a89cef23483fc9d4caf2df41e6d3928e18aada84c56abd237439d929622c6" +checksum = "c64da29158bb55d70677cacd4f4f8eab1acef005fb830d9c3bea411b090e96a9" dependencies = [ + "arrayvec 0.7.4", "async-trait", - "async-tungstenite", "base64 0.21.7", - "bitflags 1.3.2", + "bitflags 2.5.0", "bytes", - "cfg-if", "dashmap", "flate2", "futures", - "mime", + "fxhash", "mime_guess", "parking_lot 0.12.1", "percent-encoding", "reqwest", + "secrecy", "serde", - "serde-value", "serde_json", "time 0.3.34", "tokio", + "tokio-tungstenite 0.21.0", "tracing", "typemap_rev", "url", @@ -5195,17 +5217,6 @@ dependencies = [ "syn 2.0.58", ] -[[package]] -name = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - [[package]] name = "sha1" version = "0.6.1" @@ -6085,27 +6096,27 @@ checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ "rustls 0.19.1", "tokio", - "webpki 0.21.4", + "webpki", ] [[package]] name = "tokio-rustls" -version = "0.23.4" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.20.9", + "rustls 0.21.11", "tokio", - "webpki 0.22.4", ] [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls 0.21.11", + "rustls 0.22.4", + "rustls-pki-types", "tokio", ] @@ -6132,6 +6143,22 @@ dependencies = [ "tungstenite 0.20.1", ] +[[package]] +name = "tokio-tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +dependencies = [ + "futures-util", + "log", + "rustls 0.22.4", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.25.0", + "tungstenite 0.21.0", + "webpki-roots 0.26.1", +] + [[package]] name = "tokio-util" version = "0.6.10" @@ -6497,7 +6524,7 @@ dependencies = [ "tokio", "tokio-rustls 0.24.1", "tokio-stream", - "tokio-tungstenite", + "tokio-tungstenite 0.20.1", "tremor-codec", "tremor-common", "tremor-config", @@ -6909,38 +6936,38 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.17.3" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ - "base64 0.13.1", "byteorder", "bytes", + "data-encoding", "http 0.2.12", "httparse", "log", "rand 0.8.5", - "rustls 0.20.9", - "sha-1", + "sha1 0.10.6", "thiserror", "url", "utf-8", - "webpki 0.22.4", ] [[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 0.2.12", + "http 1.1.0", "httparse", "log", "rand 0.8.5", + "rustls 0.22.4", + "rustls-pki-types", "sha1 0.10.6", "thiserror", "url", @@ -6978,9 +7005,9 @@ dependencies = [ [[package]] name = "typemap_rev" -version = "0.1.5" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5b74f0a24b5454580a79abb6994393b09adf0ab8070f15827cb666255de155" +checksum = "74b08b0c1257381af16a5c3605254d529d3e7e109f3c62befc5d168968192998" [[package]] name = "typenum" @@ -7365,23 +7392,13 @@ dependencies = [ "untrusted 0.7.1", ] -[[package]] -name = "webpki" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" -dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", -] - [[package]] name = "webpki-roots" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739" dependencies = [ - "webpki 0.21.4", + "webpki", ] [[package]] @@ -7390,23 +7407,23 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" dependencies = [ - "webpki 0.21.4", + "webpki", ] [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki 0.22.4", -] +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.25.4" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] [[package]] name = "which" diff --git a/tremor-connectors/Cargo.toml b/tremor-connectors/Cargo.toml index 911472f6b8..362c4f8f53 100644 --- a/tremor-connectors/Cargo.toml +++ b/tremor-connectors/Cargo.toml @@ -107,7 +107,7 @@ tokio-tungstenite = { version = "0.20", optional = true, default-features = fals ] } # discord -serenity = { version = "0.11", optional = true, default-features = false, features = [ +serenity = { version = "0.12", optional = true, default-features = false, features = [ "client", "gateway", "rustls_backend", From cc3c66fddd12292125db6fe2c55ffce716de064c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 04:55:44 +0000 Subject: [PATCH 02/28] Bump hyper from 0.14.27 to 1.2.0 Bumps [hyper](https://github.com/hyperium/hyper) from 0.14.27 to 1.2.0. - [Release notes](https://github.com/hyperium/hyper/releases) - [Changelog](https://github.com/hyperium/hyper/blob/master/CHANGELOG.md) - [Commits](https://github.com/hyperium/hyper/compare/v0.14.27...v1.2.0) --- updated-dependencies: - dependency-name: hyper dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Cargo.lock | 822 ++++++++++++++++++++++++++++++++--------------------- Cargo.toml | 96 +++++++ 2 files changed, 587 insertions(+), 331 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cab3e8928a..f42bc1c015 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,7 +95,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom 0.2.14", + "getrandom 0.2.15", "once_cell", "version_check", "zerocopy", @@ -127,9 +127,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "android-tzdata" @@ -154,47 +154,48 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -202,9 +203,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" [[package]] name = "apache-avro" @@ -218,7 +219,7 @@ dependencies = [ "lazy_static", "libflate", "log", - "num-bigint 0.4.4", + "num-bigint 0.4.5", "quad-rand", "rand 0.8.5", "regex-lite", @@ -277,22 +278,22 @@ dependencies = [ [[package]] name = "async-channel" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" +checksum = "136d4d23bcc79e27423727b36823d86233aad06dfea531837b038394d11e9928" dependencies = [ "concurrent-queue", "event-listener 5.3.0", - "event-listener-strategy 0.5.1", + "event-listener-strategy 0.5.2", "futures-core", "pin-project-lite 0.2.14", ] [[package]] name = "async-compression" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07dbbf24db18d609b1462965249abdf49129ccad073ec257da372adc83259c60" +checksum = "4e9eabd7a98fe442131a17c316bd9349c43695e49e730c3c8e12cfb5f4da2693" dependencies = [ "flate2", "futures-core", @@ -314,14 +315,13 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f98c37cf288e302c16ef6c8472aad1e034c6c84ce5ea7b8101c98eb4a802fee" +checksum = "b10202063978b3351199d68f8b22c4e47e4b1b822f8d43fd862d5ea8c006b29a" dependencies = [ - "async-lock 3.3.0", "async-task", "concurrent-queue", - "fastrand 2.0.2", + "fastrand 2.1.0", "futures-lite 2.3.0", "slab", ] @@ -332,7 +332,7 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ - "async-channel 2.2.0", + "async-channel 2.2.1", "async-executor", "async-io 2.3.2", "async-lock 3.3.0", @@ -390,8 +390,8 @@ dependencies = [ "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.6.0", - "rustix 0.38.32", + "polling 3.7.0", + "rustix 0.38.34", "slab", "tracing", "windows-sys 0.52.0", @@ -430,37 +430,37 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.32", + "rustix 0.38.34", "windows-sys 0.48.0", ] [[package]] name = "async-recursion" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] name = "async-signal" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" +checksum = "afe66191c335039c7bb78f99dc7520b0cbb166b3a1cb33a03f53d8a1c6f2afda" dependencies = [ "async-io 2.3.2", - "async-lock 2.8.0", + "async-lock 3.3.0", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.32", + "rustix 0.38.34", "signal-hook-registry", "slab", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -523,14 +523,14 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] name = "async-task" -version = "4.7.0" +version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-tls" @@ -553,7 +553,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -605,18 +605,20 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "aws-config" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2a89e0000cde82447155d64eeb71720b933b4396a6fbbebad3f8b4f88ca7b54" +checksum = "baaa0be6ee7d90b775ae6ccb6d2ba182b91219ec2001f92338773a094246af1d" dependencies = [ "aws-credential-types", "aws-runtime", + "aws-sdk-sso", + "aws-sdk-ssooidc", "aws-sdk-sts", "aws-smithy-async", "aws-smithy-http", @@ -626,13 +628,16 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand 2.0.2", + "fastrand 2.1.0", + "hex", "http 0.2.12", - "hyper", - "time 0.3.34", + "hyper 0.14.28", + "ring 0.17.8", + "time 0.3.36", "tokio", "tracing", "url", + "zeroize", ] [[package]] @@ -649,9 +654,9 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4963ac9ff2d33a4231b3806c1c69f578f221a9cabb89ad2bde62ce2b442c8a7" +checksum = "785da4a15e7b166b505fd577e4560c7a7cd8fbdf842eb1336cbcbf8944ce56f1" dependencies = [ "aws-credential-types", "aws-sigv4", @@ -662,7 +667,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand 2.0.2", + "fastrand 2.1.0", "http 0.2.12", "http-body 0.4.6", "percent-encoding", @@ -673,9 +678,9 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "1.23.0" +version = "1.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4576ae7eb91e4d0ca76a3b443c3be979322fc01836cad7908534ae507fa41d99" +checksum = "7bc5ce518d4b8d16e0408de7bdf1b3097cec61a7daa979750a208f8d9934386d" dependencies = [ "ahash", "aws-credential-types", @@ -692,7 +697,7 @@ dependencies = [ "aws-smithy-xml", "aws-types", "bytes", - "fastrand 2.0.2", + "fastrand 2.1.0", "hex", "hmac 0.12.1", "http 0.2.12", @@ -706,11 +711,55 @@ dependencies = [ "url", ] +[[package]] +name = "aws-sdk-sso" +version = "1.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93157de9fa13c2c9c444cb07a925dbacfea7ef5deb55b578ff3cb6013109fe8e" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes", + "http 0.2.12", + "once_cell", + "regex-lite", + "tracing", +] + +[[package]] +name = "aws-sdk-ssooidc" +version = "1.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d969918da100c459a97d00f17d484d7b2fcb276f1eb6d63ef659209355d06188" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes", + "http 0.2.12", + "once_cell", + "regex-lite", + "tracing", +] + [[package]] name = "aws-sdk-sts" -version = "1.20.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30acd58272fd567e4853c5075d838be1626b59057e0249c9be5a1a7eb13bf70f" +checksum = "08cc4fc825d57299cb9762990473851614941a3430bb93e43242399983722baf" dependencies = [ "aws-credential-types", "aws-runtime", @@ -731,9 +780,9 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d6f29688a4be9895c0ba8bef861ad0c0dac5c15e9618b9b7a6c233990fc263" +checksum = "58b56f1cbe6fd4d0c2573df72868f20ab1c125ca9c9dbce17927a463433a2e57" dependencies = [ "aws-credential-types", "aws-smithy-eventstream", @@ -753,7 +802,7 @@ dependencies = [ "ring 0.17.8", "sha2 0.10.8", "subtle", - "time 0.3.34", + "time 0.3.36", "tracing", "zeroize", ] @@ -803,9 +852,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.60.7" +version = "0.60.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f10fa66956f01540051b0aa7ad54574640f748f9839e843442d99b970d3aff9" +checksum = "4a7de001a1b9a25601016d8057ea16e31a45fdca3751304c8edf4ad72e706c08" dependencies = [ "aws-smithy-eventstream", "aws-smithy-runtime-api", @@ -843,35 +892,35 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.3.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de34bcfa1fb3c82a80e252a753db34a6658e07f23d3a5b3fc96919518fa7a3f5" +checksum = "c9ac79e9f3a4d576f3cd4a470a0275b138d9e7b11b1cd514a6858ae0a79dd5bb" dependencies = [ "aws-smithy-async", "aws-smithy-http", "aws-smithy-runtime-api", "aws-smithy-types", "bytes", - "fastrand 2.0.2", - "h2", + "fastrand 2.1.0", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "http-body 1.0.0", - "hyper", + "hyper 0.14.28", "hyper-rustls", "once_cell", "pin-project-lite 0.2.14", "pin-utils", - "rustls 0.21.11", + "rustls 0.21.12", "tokio", "tracing", ] [[package]] name = "aws-smithy-runtime-api" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cc56a5c96ec741de6c5e6bf1ce6948be969d6506dfa9c39cffc284e31e4979b" +checksum = "04ec42c2f5c0e7796a2848dde4d9f3bf8ce12ccbb3d5aa40c52fa0cdd61a1c47" dependencies = [ "aws-smithy-async", "aws-smithy-types", @@ -886,9 +935,9 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abe14dceea1e70101d38fbf2a99e6a34159477c0fb95e68e05c66bd7ae4c3729" +checksum = "baf98d97bba6ddaba180f1b1147e202d8fe04940403a95a3f826c790f931bbd1" dependencies = [ "base64-simd", "bytes", @@ -905,16 +954,16 @@ dependencies = [ "pin-utils", "ryu", "serde", - "time 0.3.34", + "time 0.3.36", "tokio", - "tokio-util 0.7.10", + "tokio-util 0.7.11", ] [[package]] name = "aws-smithy-xml" -version = "0.60.7" +version = "0.60.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "872c68cf019c0e4afc5de7753c4f7288ce4b71663212771bf5e4542eb9346ca9" +checksum = "d123fbc2a4adc3c301652ba8e149bf4bc1d1725affb9784eb20c953ace06bf55" dependencies = [ "xmlparser", ] @@ -987,9 +1036,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64-simd" @@ -1072,18 +1121,16 @@ dependencies = [ [[package]] name = "blocking" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" +checksum = "495f7104e962b7356f0aeb34247aca1fe7d2e783b346582db7f2904cb5717e88" dependencies = [ - "async-channel 2.2.0", + "async-channel 2.2.1", "async-lock 3.3.0", "async-task", - "fastrand 2.0.2", "futures-io", "futures-lite 2.3.0", "piper", - "tracing", ] [[package]] @@ -1206,12 +1253,13 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.92" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" dependencies = [ "jobserver", "libc", + "once_cell", ] [[package]] @@ -1222,16 +1270,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -1296,7 +1344,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25c0a9fb70c2c2cc2a520aa259b1d1345650046a07df1b6da1d3cefcd327f43e" dependencies = [ "cidr", - "num-bigint 0.4.4", + "num-bigint 0.4.5", "num-traits", ] @@ -1343,9 +1391,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.1" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "885e4d7d5af40bfb99ae6f9433e292feac98d452dcb3ec3d25dfe7552b77da8c" +checksum = "dd79504325bf38b10165b02e89b4347300f855f273c4cb30c4a3209e6583275e" dependencies = [ "clap", ] @@ -1359,7 +1407,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -1437,15 +1485,15 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "combine" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ "bytes", "memchr", @@ -1453,9 +1501,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ "crossbeam-utils", ] @@ -1491,9 +1539,9 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "const_fn" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" +checksum = "373e9fafaa20882876db20562275ff58d50e0caa2590077fe7ce7bef90211d0d" [[package]] name = "constant_time_eq" @@ -1805,18 +1853,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "lock_api", "once_cell", - "parking_lot_core 0.9.9", + "parking_lot_core 0.9.10", "serde", ] [[package]] name = "data-encoding" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "deadpool" @@ -2044,9 +2092,9 @@ dependencies = [ [[package]] name = "ena" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" dependencies = [ "log", ] @@ -2059,9 +2107,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] @@ -2075,7 +2123,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -2187,9 +2235,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332f51cb23d20b0de8458b86580878211da09bcd4503cb579c225b3d124cabb3" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" dependencies = [ "event-listener 5.3.0", "pin-project-lite 0.2.14", @@ -2206,9 +2254,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "fenster" @@ -2258,9 +2306,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -2384,7 +2432,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.0.2", + "fastrand 2.1.0", "futures-core", "futures-io", "parking", @@ -2399,7 +2447,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -2484,9 +2532,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -2614,7 +2662,26 @@ dependencies = [ "indexmap 2.2.6", "slab", "tokio", - "tokio-util 0.7.10", + "tokio-util 0.7.11", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.1.0", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util 0.7.11", "tracing", ] @@ -2634,7 +2701,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8588661a8607108a5ca69cab034063441a0413a0b041c13618a7dd348021ef6f" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] @@ -2646,18 +2713,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -2894,20 +2952,41 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "httparse", "httpdate", "itoa 1.0.11", "pin-project-lite 0.2.14", - "socket2 0.5.6", + "socket2 0.5.7", "tokio", "tower-service", "tracing", "want", ] +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa 1.0.11", + "pin-project-lite 0.2.14", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -2916,9 +2995,9 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper", + "hyper 0.14.28", "log", - "rustls 0.21.11", + "rustls 0.21.12", "rustls-native-certs", "tokio", "tokio-rustls 0.24.1", @@ -2930,7 +3009,7 @@ 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 0.2.14", "tokio", "tokio-io-timeout", @@ -2943,7 +3022,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.28", "native-tls", "tokio", "tokio-native-tls", @@ -3031,7 +3110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -3087,7 +3166,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.6", + "socket2 0.5.7", "widestring", "windows-sys 0.48.0", "winreg", @@ -3110,6 +3189,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.10.5" @@ -3142,9 +3227,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.28" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -3316,15 +3401,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libflate" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7d5654ae1795afc7ff76f4365c2c8791b0feb18e8996a96adad8ffd7c3b2bf" +checksum = "45d9dfdc14ea4ef0900c1cddbc8dcd553fbaacd8a4a282cf4018ae9dd04fb21e" dependencies = [ "adler32", "core2", @@ -3335,12 +3420,12 @@ dependencies = [ [[package]] name = "libflate_lz77" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5f52fb8c451576ec6b79d3f4deb327398bc05bbdbd99021a6e77a4c855d524" +checksum = "e6e0d73b369f386f1c44abd9c570d5318f55ccde816ff4b562fa452e5182863d" dependencies = [ "core2", - "hashbrown 0.13.2", + "hashbrown 0.14.5", "rle-decode-fast", ] @@ -3392,9 +3477,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -3432,7 +3517,7 @@ dependencies = [ "log", "log-mdc", "once_cell", - "parking_lot 0.12.1", + "parking_lot 0.12.2", "rand 0.8.5", "serde", "serde-value", @@ -3450,7 +3535,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -3650,20 +3735,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -3685,9 +3769,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -3802,7 +3886,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -3877,12 +3961,12 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", - "parking_lot_core 0.9.9", + "parking_lot_core 0.9.10", ] [[package]] @@ -3901,22 +3985,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall 0.5.1", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] name = "parse-zoneinfo" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" +checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" dependencies = [ "regex", ] @@ -3934,9 +4018,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pbkdf2" @@ -3969,9 +4053,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", "indexmap 2.2.6", @@ -4047,7 +4131,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -4075,7 +4159,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" dependencies = [ "atomic-waker", - "fastrand 2.0.2", + "fastrand 2.1.0", "futures-io", ] @@ -4141,15 +4225,15 @@ dependencies = [ [[package]] name = "polling" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" +checksum = "645493cf344456ef24219d02a768cf1fb92ddf8c92161679ae3d91b91a637be3" dependencies = [ "cfg-if", "concurrent-queue", "hermit-abi 0.3.9", "pin-project-lite 0.2.14", - "rustix 0.38.32", + "rustix 0.38.34", "tracing", "windows-sys 0.52.0", ] @@ -4217,9 +4301,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -4317,9 +4401,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -4334,6 +4418,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "qwal" +version = "0.1.0" +source = "git+https://github.com/tremor-rs/qwal#8191a4940d7a56f0a237c58e410fd4d779d2dca7" +dependencies = [ + "byteorder", + "tokio", +] + [[package]] name = "rand" version = "0.7.3" @@ -4393,7 +4486,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.14", + "getrandom 0.2.15", ] [[package]] @@ -4489,35 +4582,44 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags 2.5.0", +] + [[package]] name = "redox_users" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ - "getrandom 0.2.14", + "getrandom 0.2.15", "libredox", "thiserror", ] [[package]] name = "ref-cast" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4846d4c50d1721b1a3bef8af76924eef20d5e723647333798c1b519b3a9473f" +checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" +checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -4567,10 +4669,10 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper", + "hyper 0.14.28", "hyper-rustls", "hyper-tls", "ipnet", @@ -4582,7 +4684,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite 0.2.14", - "rustls 0.21.11", + "rustls 0.21.12", "rustls-native-certs", "rustls-pemfile", "serde", @@ -4593,7 +4695,7 @@ dependencies = [ "tokio", "tokio-native-tls", "tokio-rustls 0.24.1", - "tokio-util 0.7.10", + "tokio-util 0.7.11", "tower-service", "url", "wasm-bindgen", @@ -4648,7 +4750,7 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.14", + "getrandom 0.2.15", "libc", "spin 0.9.8", "untrusted 0.9.0", @@ -4663,9 +4765,9 @@ checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" [[package]] name = "rmp" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddb316f4b9cae1a3e89c02f1926d557d1142d0d2e684b038c11c1b77705229a" +checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4" dependencies = [ "byteorder", "num-traits", @@ -4674,9 +4776,9 @@ dependencies = [ [[package]] name = "rmp-serde" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938a142ab806f18b88a97b0dea523d39e0fd730a064b035726adcfc58a8a5188" +checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db" dependencies = [ "byteorder", "rmp", @@ -4716,7 +4818,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19599f60a688b5160247ee9c37a6af8b0c742ee8b160c5b44acc0f0eb265a59f" dependencies = [ "csv", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "itertools 0.11.0", "lazy_static", "protobuf", @@ -4731,9 +4833,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc_version" @@ -4750,7 +4852,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.22", + "semver 1.0.23", ] [[package]] @@ -4769,9 +4871,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.32" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", @@ -4808,9 +4910,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.11" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring 0.17.8", @@ -4882,9 +4984,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" +checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" [[package]] name = "rusty-fork" @@ -4900,9 +5002,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "safetensors" @@ -4923,6 +5025,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scc" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ad2bbb0ae5100a07b7a6f2ed7ab5fd0045551a4c507989b7a620046ea3efdc" +dependencies = [ + "sdd", +] + [[package]] name = "schannel" version = "0.1.23" @@ -4974,6 +5085,12 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "sdd" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b84345e4c9bd703274a082fb80caaa99b7612be48dfaa1dd9266577ec412309d" + [[package]] name = "sec1" version = "0.3.0" @@ -5000,11 +5117,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", "core-foundation", "core-foundation-sys", "libc", @@ -5013,9 +5130,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", @@ -5032,9 +5149,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "semver-parser" @@ -5044,9 +5161,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" dependencies = [ "serde_derive", ] @@ -5063,13 +5180,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -5083,9 +5200,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.115" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa 1.0.11", "ryu", @@ -5178,13 +5295,13 @@ dependencies = [ "futures", "fxhash", "mime_guess", - "parking_lot 0.12.1", + "parking_lot 0.12.2", "percent-encoding", "reqwest", "secrecy", "serde", "serde_json", - "time 0.3.34", + "time 0.3.36", "tokio", "tokio-tungstenite 0.21.0", "tracing", @@ -5194,27 +5311,27 @@ dependencies = [ [[package]] name = "serial_test" -version = "3.0.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ad9342b3aaca7cb43c45c097dd008d4907070394bd0751a0aa8817e5a018d" +checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" dependencies = [ - "dashmap", "futures", - "lazy_static", "log", - "parking_lot 0.12.1", + "once_cell", + "parking_lot 0.12.2", + "scc", "serial_test_derive", ] [[package]] name = "serial_test_derive" -version = "3.0.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93fb4adc70021ac1b47f7d45e8cc4169baaa7ea58483bc5b721d19a26202212" +checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -5285,9 +5402,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -5316,12 +5433,12 @@ dependencies = [ [[package]] name = "simd-json" -version = "0.13.9" +version = "0.13.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b84c23a1066e1d650ebc99aa8fb9f8ed0ab96fd36e2e836173c92fc9fb29bc" +checksum = "570c430b3d902ea083097e853263ae782dfe40857d93db019a12356c8e8143fa" dependencies = [ "ahash", - "getrandom 0.2.14", + "getrandom 0.2.15", "halfbrown", "lexical-core 0.8.5", "once_cell", @@ -5355,7 +5472,7 @@ dependencies = [ "proc-macro2", "quote", "simd-json", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -5454,9 +5571,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -5556,7 +5673,7 @@ checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ "new_debug_unreachable", "once_cell", - "parking_lot 0.12.1", + "parking_lot 0.12.2", "phf_shared 0.10.0", "precomputed-hash", ] @@ -5598,7 +5715,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -5618,7 +5735,7 @@ dependencies = [ "cfg-if", "encoding_rs", "futures-util", - "getrandom 0.2.14", + "getrandom 0.2.15", "http-client", "http-types", "log", @@ -5722,9 +5839,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -5809,8 +5926,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", - "fastrand 2.0.2", - "rustix 0.38.32", + "fastrand 2.1.0", + "rustix 0.38.34", "windows-sys 0.52.0", ] @@ -5852,7 +5969,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -5863,7 +5980,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", "test-case-core", ] @@ -5886,22 +6003,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" +checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" +checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -5952,9 +6069,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa 1.0.11", @@ -5962,7 +6079,7 @@ dependencies = [ "powerfmt", "serde", "time-core", - "time-macros 0.2.17", + "time-macros 0.2.18", ] [[package]] @@ -5983,9 +6100,9 @@ dependencies = [ [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -6049,10 +6166,10 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot 0.12.1", + "parking_lot 0.12.2", "pin-project-lite 0.2.14", "signal-hook-registry", - "socket2 0.5.6", + "socket2 0.5.7", "tokio-macros", "windows-sys 0.48.0", ] @@ -6075,7 +6192,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -6105,7 +6222,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.11", + "rustls 0.21.12", "tokio", ] @@ -6175,16 +6292,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite 0.2.14", "tokio", - "tracing", ] [[package]] @@ -6216,10 +6332,10 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", @@ -6274,7 +6390,7 @@ dependencies = [ "rand 0.8.5", "slab", "tokio", - "tokio-util 0.7.10", + "tokio-util 0.7.11", "tower-layer", "tower-service", "tracing", @@ -6312,7 +6428,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -6442,7 +6558,7 @@ dependencies = [ name = "tremor-common" version = "0.13.0-rc.23" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "beef", "futures", "lazy_static", @@ -6473,7 +6589,7 @@ dependencies = [ "async-compression", "async-stream", "async-trait", - "base64 0.22.0", + "base64 0.22.1", "beef", "bimap", "bytes", @@ -6494,19 +6610,19 @@ dependencies = [ "hostname", "http 0.2.12", "http-types", - "hyper", + "hyper 0.14.28", "hyper-rustls", "indexmap 2.2.6", "lazy_static", "log", "mime", "proptest", - "qwal", + "qwal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.8.5", "rdkafka", "rdkafka-sys", "reqwest", - "rustls 0.21.11", + "rustls 0.21.12", "rustls-native-certs", "rustls-pemfile", "serde", @@ -6516,7 +6632,7 @@ dependencies = [ "simd-json", "simd-json-derive", "sled", - "socket2 0.5.6", + "socket2 0.5.7", "tempfile", "test-case", "testcontainers", @@ -6546,7 +6662,7 @@ name = "tremor-connectors-aws" version = "0.13.0-rc.23" dependencies = [ "anyhow", - "async-channel 2.2.0", + "async-channel 2.2.1", "async-trait", "aws-config", "aws-credential-types", @@ -6585,7 +6701,7 @@ dependencies = [ "googapis", "gouth", "http 0.2.12", - "hyper", + "hyper 0.14.28", "hyper-rustls", "log", "prost", @@ -6759,27 +6875,60 @@ name = "tremor-runtime" version = "0.13.0-rc.23" dependencies = [ "anyhow", + "async-channel 2.2.1", "async-trait", + "aws-config", + "aws-sdk-s3", + "aws-smithy-http", + "aws-types", + "cron", + "elasticsearch", "env_logger", "error-chain", "futures", + "googapis", + "gouth", + "grok", "halfbrown", - "hashbrown 0.14.3", + "hashbrown 0.14.5", + "hdrhistogram", + "http 0.2.12", + "hyper 1.3.1", + "hyper-rustls", "indexmap 2.2.6", + "itoa 1.0.11", + "lexical", "log", + "mime", "num_cpus", "port_scanner", "pretty_assertions", "proptest", + "prost", + "prost-types", + "qwal 0.1.0 (git+https://github.com/tremor-rs/qwal)", + "rdkafka", + "rdkafka-sys", "regex", + "reqwest", + "rustls 0.21.12", + "rustls-native-certs", + "rustls-pemfile", + "ryu", "serde", "serde_yaml", + "serenity", "serial_test", "simd-json", "simd-json-derive", + "simdutf8", + "sled", "tempfile", "tokio", + "tokio-rustls 0.24.1", "tokio-stream", + "tokio-tungstenite", + "tonic", "tremor-codec", "tremor-common", "tremor-config", @@ -6789,11 +6938,15 @@ dependencies = [ "tremor-connectors-otel", "tremor-influx", "tremor-interceptor", + "tremor-otelapis", "tremor-pipeline", "tremor-script", "tremor-system", "tremor-value", + "trust-dns-resolver", + "uuid", "value-trait", + "xz2", ] [[package]] @@ -6868,7 +7021,7 @@ dependencies = [ name = "tremor-value" version = "0.13.0-rc.23" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "beef", "float-cmp", "getopts", @@ -6918,7 +7071,7 @@ dependencies = [ "ipconfig", "lru-cache", "once_cell", - "parking_lot 0.12.1", + "parking_lot 0.12.2", "rand 0.8.5", "resolv-conf", "smallvec", @@ -6991,7 +7144,7 @@ checksum = "f03ca4cb38206e2bef0700092660bb74d696f808514dae47fa1467cbfe26e96e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -7068,9 +7221,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "unicode-xid" @@ -7151,15 +7304,15 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ - "getrandom 0.2.14", + "getrandom 0.2.15", "serde", ] [[package]] name = "value-bag" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74797339c3b98616c009c7c3eb53a0ce41e85c8ec66bd3db96ed132d20cfdee8" +checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101" dependencies = [ "value-bag-serde1", "value-bag-sval2", @@ -7167,9 +7320,9 @@ dependencies = [ [[package]] name = "value-bag-serde1" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc35703541cbccb5278ef7b589d79439fc808ff0b5867195a3230f9a47421d39" +checksum = "ccacf50c5cb077a9abb723c5bcb5e0754c1a433f1e1de89edc328e2760b6328b" dependencies = [ "erased-serde", "serde", @@ -7178,9 +7331,9 @@ dependencies = [ [[package]] name = "value-bag-sval2" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "285b43c29d0b4c0e65aad24561baee67a1b69dc9be9375d4a85138cbf556f7f8" +checksum = "1785bae486022dfb9703915d42287dcb284c1ee37bd1080eeba78cc04721285b" dependencies = [ "sval", "sval_buffer", @@ -7314,7 +7467,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", "wasm-bindgen-shared", ] @@ -7348,7 +7501,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7434,7 +7587,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.32", + "rustix 0.38.34", ] [[package]] @@ -7467,11 +7620,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -7486,7 +7639,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -7504,7 +7657,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -7524,17 +7677,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -7545,9 +7699,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -7557,9 +7711,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -7569,9 +7723,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -7581,9 +7741,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -7593,9 +7753,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -7605,9 +7765,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -7617,9 +7777,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" @@ -7648,7 +7808,7 @@ checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", "linux-raw-sys 0.4.13", - "rustix 0.38.32", + "rustix 0.38.34", ] [[package]] @@ -7674,22 +7834,22 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.61", ] [[package]] @@ -7714,7 +7874,7 @@ dependencies = [ "hmac 0.12.1", "pbkdf2", "sha1 0.10.6", - "time 0.3.34", + "time 0.3.36", "zstd 0.11.2+zstd.1.5.2", ] diff --git a/Cargo.toml b/Cargo.toml index caebad6572..eb71aabafd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,6 +75,102 @@ simd-json-derive = "0.13" value-trait = "0.8" +# blaster / blackhole# codecs +hdrhistogram = "7" +xz2 = "0.1" + +# http +hyper = { version = "1.2", features = ["full"] } +hyper-rustls = { version = "0.24", features = ["http2"] } +mime = "0.3" +# elasticsearch +elasticsearch = { version = "=8.5.0-alpha.1", default-features = false, features = [ + "rustls-tls", +] } + + +# for tcp & ws +tokio-rustls = "0.24" +async-channel = "2.1" +rustls = "0.21" +rustls-pemfile = "1" +rustls-native-certs = "0.6" +tokio-tungstenite = "0.20" + +# dns +trust-dns-resolver = { version = "0.23" } + +rdkafka = { version = "0.36", features = [ + "cmake-build", + "libz-static", + "tokio", +], default-features = false } + +# tracking the version rdkafka depends on +rdkafka-sys = { version = "4.6", features = [ + "cmake-build", + "libz-static", +], default-features = false } + +# crononome +cron = "0.12" + +# logstash grok patterns +grok = "2" + +# discord +serenity = { version = "0.11", default-features = false, features = [ + "client", + "gateway", + "rustls_backend", + "model", + "cache", +] } + +# kv +sled = "0.34" + +# opentelemetry +tonic = { version = "0.6.1", default-features = false, features = [ + "transport", + "tls", +] } +prost = "0.9.0" +prost-types = "0.9.0" +# This is related to https://github.com/tremor-rs/tremor-runtime/issues/1688 the otel API's need to +# be updated together with tonic +tremor-otelapis = { version = "=0.2.4" } + +# aws-s3 +aws-sdk-s3 = { version = "1.4", features = ["behavior-version-latest"] } +aws-types = "1" +aws-config = "1" +aws-smithy-http = "0.60" + +# gcp +googapis = { version = "0.6", default-features = false, features = [ + "google-pubsub-v1", + "google-cloud-bigquery-storage-v1", + "google-logging-v2", + "google-storage-v2", +] } +gouth = { version = "0.2" } +http = "0.2" +reqwest = { version = "0.11", default-features = false, features = [ + "rustls-tls", + "rustls-tls-native-roots", +] } + +# http +uuid = { version = "1.6", features = ["v4"] } + +# wal +qwal = { git = "https://github.com/tremor-rs/qwal" } +itoa = "1" +ryu = "1" +lexical = "6" +simdutf8 = "0.1" + [dev-dependencies] port_scanner = "0.1" env_logger = "0.11" From 80ed063c39e21a3e848a52c88bf36c44d017cb99 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Mon, 29 Apr 2024 15:40:43 +0200 Subject: [PATCH 03/28] Update deps and patch impacted http/tcp/ws connectors with hyper et al upgrade Signed-off-by: Darach Ennis --- Cargo.lock | 302 ++++++++++++++++++--- tremor-connectors/Cargo.toml | 39 ++- tremor-connectors/src/impls.rs | 1 + tremor-connectors/src/impls/http.rs | 2 +- tremor-connectors/src/impls/http/client.rs | 36 +-- tremor-connectors/src/impls/http/meta.rs | 9 +- tremor-connectors/src/impls/http/server.rs | 114 ++++---- tremor-connectors/src/impls/http/utils.rs | 90 ++++++ tremor-connectors/src/impls/tcp/client.rs | 4 +- tremor-connectors/src/impls/ws/client.rs | 4 +- tremor-connectors/src/utils/tls.rs | 226 ++++----------- tremor-connectors/tests/http/client.rs | 63 ++--- tremor-connectors/tests/http/server.rs | 70 +++-- 13 files changed, 605 insertions(+), 355 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f42bc1c015..2a71b9735f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -541,7 +541,7 @@ dependencies = [ "futures-core", "futures-io", "rustls 0.18.1", - "webpki", + "webpki 0.21.4", "webpki-roots 0.20.0", ] @@ -556,6 +556,22 @@ dependencies = [ "syn 2.0.61", ] +[[package]] +name = "async-tungstenite" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1b71b31561643aa8e7df3effe284fa83ab1a840e52294c5f4bd7bfd8b2becbb" +dependencies = [ + "futures-io", + "futures-util", + "log", + "pin-project-lite 0.2.14", + "tokio", + "tokio-rustls 0.23.4", + "tungstenite 0.17.3", + "webpki-roots 0.22.6", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -587,7 +603,7 @@ dependencies = [ "serde", "serde_urlencoded 0.6.1", "url", - "webpki", + "webpki 0.21.4", "webpki-roots 0.19.0", "wildmatch", ] @@ -907,7 +923,7 @@ dependencies = [ "http-body 0.4.6", "http-body 1.0.0", "hyper 0.14.28", - "hyper-rustls", + "hyper-rustls 0.24.2", "once_cell", "pin-project-lite 0.2.14", "pin-utils", @@ -1432,7 +1448,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "hostname", + "hostname 0.3.1", "lazy_static", "log", "lz4", @@ -2827,6 +2843,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "hostname" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9c7c7c8ac16c798734b8a24560c1362120597c40d5e1459f09498f8f6c8f2ba" +dependencies = [ + "cfg-if", + "libc", + "windows", +] + [[package]] name = "http" version = "0.2.12" @@ -2998,11 +3025,29 @@ dependencies = [ "hyper 0.14.28", "log", "rustls 0.21.12", - "rustls-native-certs", + "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.24.1", ] +[[package]] +name = "hyper-rustls" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "908bb38696d7a037a01ebcc68a00634112ac2bbf8ca74e30a2c3d2f4f021302b" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.3.1", + "hyper-util", + "rustls 0.23.5", + "rustls-native-certs 0.7.0", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", +] + [[package]] name = "hyper-timeout" version = "0.4.1" @@ -3028,6 +3073,26 @@ dependencies = [ "tokio-native-tls", ] +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.3.1", + "pin-project-lite 0.2.14", + "socket2 0.5.7", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.60" @@ -4673,7 +4738,7 @@ dependencies = [ "http 0.2.12", "http-body 0.4.6", "hyper 0.14.28", - "hyper-rustls", + "hyper-rustls 0.24.2", "hyper-tls", "ipnet", "js-sys", @@ -4685,8 +4750,8 @@ dependencies = [ "percent-encoding", "pin-project-lite 0.2.14", "rustls 0.21.12", - "rustls-native-certs", - "rustls-pemfile", + "rustls-native-certs 0.6.3", + "rustls-pemfile 1.0.4", "serde", "serde_json", "serde_urlencoded 0.7.1", @@ -4712,7 +4777,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ - "hostname", + "hostname 0.3.1", "quick-error", ] @@ -4892,7 +4957,7 @@ dependencies = [ "log", "ring 0.16.20", "sct 0.6.1", - "webpki", + "webpki 0.21.4", ] [[package]] @@ -4905,7 +4970,19 @@ dependencies = [ "log", "ring 0.16.20", "sct 0.6.1", - "webpki", + "webpki 0.21.4", +] + +[[package]] +name = "rustls" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" +dependencies = [ + "log", + "ring 0.16.20", + "sct 0.7.1", + "webpki 0.22.4", ] [[package]] @@ -4934,6 +5011,20 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls" +version = "0.23.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afabcee0551bd1aa3e18e5adbf2c0544722014b899adb31bd186ec638d3da97e" +dependencies = [ + "once_cell", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki 0.102.3", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" version = "0.6.3" @@ -4941,7 +5032,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pemfile 1.0.4", + "schannel", + "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.1.2", + "rustls-pki-types", "schannel", "security-framework", ] @@ -4955,6 +5059,16 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.1", + "rustls-pki-types", +] + [[package]] name = "rustls-pki-types" version = "1.7.0" @@ -5279,6 +5393,36 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "serenity" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a7a89cef23483fc9d4caf2df41e6d3928e18aada84c56abd237439d929622c6" +dependencies = [ + "async-trait", + "async-tungstenite", + "base64 0.21.7", + "bitflags 1.3.2", + "bytes", + "cfg-if", + "dashmap", + "flate2", + "futures", + "mime", + "mime_guess", + "parking_lot 0.12.2", + "percent-encoding", + "reqwest", + "serde", + "serde-value", + "serde_json", + "time 0.3.36", + "tokio", + "tracing", + "typemap_rev 0.1.5", + "url", +] + [[package]] name = "serenity" version = "0.12.1" @@ -5305,7 +5449,7 @@ dependencies = [ "tokio", "tokio-tungstenite 0.21.0", "tracing", - "typemap_rev", + "typemap_rev 0.3.0", "url", ] @@ -5334,6 +5478,17 @@ dependencies = [ "syn 2.0.61", ] +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + [[package]] name = "sha1" version = "0.6.1" @@ -6213,7 +6368,18 @@ checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ "rustls 0.19.1", "tokio", - "webpki", + "webpki 0.21.4", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls 0.20.9", + "tokio", + "webpki 0.22.4", ] [[package]] @@ -6237,6 +6403,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.5", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.15" @@ -6604,14 +6781,18 @@ dependencies = [ "event-listener 5.3.0", "file-mode", "futures", + "futures-core", "gouth", "halfbrown", "hdrhistogram", - "hostname", - "http 0.2.12", + "hostname 0.4.0", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "http-types", - "hyper 0.14.28", - "hyper-rustls", + "hyper 1.3.1", + "hyper-rustls 0.27.1", + "hyper-util", "indexmap 2.2.6", "lazy_static", "log", @@ -6622,12 +6803,12 @@ dependencies = [ "rdkafka", "rdkafka-sys", "reqwest", - "rustls 0.21.12", - "rustls-native-certs", - "rustls-pemfile", + "rustls 0.23.5", + "rustls-native-certs 0.7.0", + "rustls-pemfile 2.1.2", "serde", "serde_yaml", - "serenity", + "serenity 0.12.1", "serial_test", "simd-json", "simd-json-derive", @@ -6637,8 +6818,9 @@ dependencies = [ "test-case", "testcontainers", "thiserror", + "tide", "tokio", - "tokio-rustls 0.24.1", + "tokio-rustls 0.26.0", "tokio-stream", "tokio-tungstenite 0.20.1", "tremor-codec", @@ -6702,7 +6884,7 @@ dependencies = [ "gouth", "http 0.2.12", "hyper 0.14.28", - "hyper-rustls", + "hyper-rustls 0.24.2", "log", "prost", "prost-types", @@ -6894,7 +7076,7 @@ dependencies = [ "hdrhistogram", "http 0.2.12", "hyper 1.3.1", - "hyper-rustls", + "hyper-rustls 0.24.2", "indexmap 2.2.6", "itoa 1.0.11", "lexical", @@ -6912,12 +7094,12 @@ dependencies = [ "regex", "reqwest", "rustls 0.21.12", - "rustls-native-certs", - "rustls-pemfile", + "rustls-native-certs 0.6.3", + "rustls-pemfile 1.0.4", "ryu", "serde", "serde_yaml", - "serenity", + "serenity 0.11.7", "serial_test", "simd-json", "simd-json-derive", @@ -6927,7 +7109,7 @@ dependencies = [ "tokio", "tokio-rustls 0.24.1", "tokio-stream", - "tokio-tungstenite", + "tokio-tungstenite 0.20.1", "tonic", "tremor-codec", "tremor-common", @@ -6970,7 +7152,7 @@ dependencies = [ "grok", "halfbrown", "hdrhistogram", - "hostname", + "hostname 0.3.1", "jumphash", "lalrpop", "lalrpop-util", @@ -7087,6 +7269,27 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "tungstenite" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" +dependencies = [ + "base64 0.13.1", + "byteorder", + "bytes", + "http 0.2.12", + "httparse", + "log", + "rand 0.8.5", + "rustls 0.20.9", + "sha-1", + "thiserror", + "url", + "utf-8", + "webpki 0.22.4", +] + [[package]] name = "tungstenite" version = "0.20.1" @@ -7156,6 +7359,12 @@ dependencies = [ "unsafe-any-ors", ] +[[package]] +name = "typemap_rev" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5b74f0a24b5454580a79abb6994393b09adf0ab8070f15827cb666255de155" + [[package]] name = "typemap_rev" version = "0.3.0" @@ -7545,13 +7754,23 @@ dependencies = [ "untrusted 0.7.1", ] +[[package]] +name = "webpki" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" +dependencies = [ + "ring 0.17.8", + "untrusted 0.9.0", +] + [[package]] name = "webpki-roots" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739" dependencies = [ - "webpki", + "webpki 0.21.4", ] [[package]] @@ -7560,7 +7779,16 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" dependencies = [ - "webpki", + "webpki 0.21.4", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki 0.22.4", ] [[package]] @@ -7633,6 +7861,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.5", +] + [[package]] name = "windows-core" version = "0.52.0" diff --git a/tremor-connectors/Cargo.toml b/tremor-connectors/Cargo.toml index 362c4f8f53..363c55d4cc 100644 --- a/tremor-connectors/Cargo.toml +++ b/tremor-connectors/Cargo.toml @@ -18,11 +18,11 @@ tremor-value = { path = "../tremor-value", version = "0.13.0-rc.23" } tremor-interceptor = { path = "../tremor-interceptor", version = "0.13.0-rc.23" } tremor-system = { path = "../tremor-system", version = "0.13.0-rc.23" } +tokio = { version = "1.34", default-features = false, features = ["test-util"] } beef = { version = "0.5", default-features = false } value-trait = { version = "0.8", default-features = false } futures = { version = "0.3", default-features = false } halfbrown = { version = "0.2", default-features = false } -tokio = { version = "1.34", default-features = false } simd-json = { version = "0.13", default-features = false } serde = { version = "1.0", default-features = false, features = ["derive"] } url = { version = "2.5", default-features = false } @@ -33,7 +33,7 @@ bimap = { version = "0.6", default-features = false, features = [ "serde", "std", ] } -hostname = { version = "0.3", default-features = false } +hostname = { version = "0.4", default-features = false } thiserror = { version = "1.0", default-features = false } anyhow = { version = "1.0", default-features = true } event-listener = { version = "5", default-features = false } @@ -46,21 +46,28 @@ simd-json-derive = { version = "0.13", optional = true, default-features = false uuid = { version = "1.6", optional = true, default-features = false, features = [ "v4", ] } -hyper = { version = "0.14", optional = true, default-features = false, features = [ +hyper = { version = "1.3.1", optional = true, default-features = false, features = [ "server", "http1", "http2", - "runtime", +] } +hyper-util = { version = "0.1.3", optional = true, default-features = false, features = [ + "http1", + "http2", + "client", + "client-legacy", + "tokio", + "server-auto", ] } async-stream = { version = "0.3", optional = true, default-features = false } gouth = { version = "0.2", optional = true, default-features = true } # tls -tokio-rustls = { version = "0.24", optional = true, default-features = false } -rustls = { version = "0.21", optional = true, default-features = false } -rustls-pemfile = { version = "1", optional = true, default-features = false } -rustls-native-certs = { version = "0.6", optional = true, default-features = false } +tokio-rustls = { version = "0.26", optional = true, default-features = false } +rustls = { version = "0.23.5", optional = true, default-features = false } +rustls-pemfile = { version = "2.1.2", optional = true, default-features = false } +rustls-native-certs = { version = "0.7", optional = true, default-features = false } # dns trust-dns-resolver = { version = "0.23", optional = true, default-features = false, features = [ @@ -74,13 +81,15 @@ elasticsearch = { version = "=8.5.0-alpha.1", optional = true, default-features ] } # http -http = { version = "0.2", optional = true, default-features = false } -hyper-rustls = { version = "0.24", optional = true, default-features = false, features = [ +http = { version = "1.1", optional = true, default-features = false } +hyper-rustls = { version = "0.27", optional = true, default-features = false, features = [ "rustls-native-certs", "http1", "http2", - "tokio-runtime", + "ring", ] } +http-body = { version = "1", optional = true, default-features = false } +http-body-util = { version = "0.1", optional = true, default-features = false } mime = { version = "0.3", optional = true, default-features = false } reqwest = { version = "0.11", optional = true, default-features = false, features = [ "rustls-tls", @@ -88,7 +97,7 @@ reqwest = { version = "0.11", optional = true, default-features = false, feature ] } base64 = { version = "0.22", optional = true, default-features = false } dashmap = { version = "5.5", optional = true, default-features = false } - +tide = { version = "0.16", optional = true, default-features = false } # TODO remove tide from TestHttpServer # kafka rdkafka = { version = "0.36", optional = true, features = [ "cmake-build", @@ -148,6 +157,7 @@ cron = { version = "0.12", optional = true, default-features = false } # udp socket2 = { version = "0.5", optional = true, default-features = false } +futures-core = "0.3.30" [dev-dependencies] serde_yaml = { version = "0.9", default-features = false } @@ -213,11 +223,14 @@ http = [ "dep:dashmap", "dep:gouth", "dep:http", + "dep:http-body", + "dep:http-body-util", "dep:hyper-rustls", + "dep:hyper-util", "dep:hyper", "dep:mime", + "dep:tide", "dep:reqwest", - "hyper/stream", "hyper/http1", "hyper/http2", "tls", diff --git a/tremor-connectors/src/impls.rs b/tremor-connectors/src/impls.rs index 5f27130191..174d45a3f9 100644 --- a/tremor-connectors/src/impls.rs +++ b/tremor-connectors/src/impls.rs @@ -70,6 +70,7 @@ pub mod stdio; /// tcp server and client connector impls #[cfg(feature = "tcp")] pub mod tcp; + /// udp connector impls #[cfg(feature = "udp")] pub mod udp; diff --git a/tremor-connectors/src/impls/http.rs b/tremor-connectors/src/impls/http.rs index 0874e0ef94..f625123a98 100644 --- a/tremor-connectors/src/impls/http.rs +++ b/tremor-connectors/src/impls/http.rs @@ -205,4 +205,4 @@ pub mod meta; /// HTTP server connect pub mod server; /// HTTP utils -pub(crate) mod utils; +pub mod utils; diff --git a/tremor-connectors/src/impls/http/client.rs b/tremor-connectors/src/impls/http/client.rs index 148372afc3..f3415723e9 100644 --- a/tremor-connectors/src/impls/http/client.rs +++ b/tremor-connectors/src/impls/http/client.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use super::utils::Body; use crate::{ errors::error_connector_def, impls::http::{ @@ -25,12 +26,12 @@ use crate::{ }; use either::Either; use halfbrown::HashMap; -use hyper::body::HttpBody; -use hyper::{ - client::{Client as HyperClient, HttpConnector}, - Method, -}; +use http_body_util::BodyExt; +use hyper::Method; use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; +use hyper_util::client::legacy::connect::HttpConnector; +use hyper_util::client::legacy::Client as HyperClient; +use hyper_util::rt::TokioExecutor; use serde::{Deserialize, Deserializer}; use std::{ sync::{ @@ -252,7 +253,7 @@ impl Source for HttpRequestSource { struct HttpRequestSink { request_counter: u64, - client: Option>>>, + client: Option, Body>>>, response_tx: Sender, reply_tx: ReplySender, config: Config, @@ -312,13 +313,13 @@ impl Sink for HttpRequestSink { .build() } else { HttpsConnectorBuilder::new() - .with_native_roots() + .with_native_roots()? .https_or_http() .enable_http1() .enable_http2() .build() }; - let client = HyperClient::builder().build(https); + let client = HyperClient::builder(TokioExecutor::new()).build(https); self.client = Some(Arc::new(client)); @@ -390,15 +391,18 @@ impl Sink for HttpRequestSink { .split('/') .map(ToString::to_string) .collect(); - match timeout(t, client.request(request)).await { - Ok(Ok(mut response)) => { - let mut data: Vec = Vec::new(); - while let Some(chunk) = response.data().await.transpose()? { - data.extend_from_slice(&chunk); - } + let response = client.request(request); + match timeout(t, response).await { + Ok(Ok(response)) => { + // let stream = response.into_body(); + // We know stream is a http_body::Body, so we can safely unwrap here + let response_meta = extract_response_meta(&response)?; + let headers = response.headers().clone(); + + let body = response.collect().await?; + let data = body.to_bytes().to_vec(); if let Some(response_tx) = response_tx { - let response_meta = extract_response_meta(&response)?; let mut meta = task_ctx.meta(literal!({ "request": req_meta, "request_id": request_id.get(), @@ -409,7 +413,7 @@ impl Sink for HttpRequestSink { meta.try_insert("correlation", corr_meta); } let codec_name = if let Some(mime_header) = - response.headers().get(hyper::header::CONTENT_TYPE) + headers.get(hyper::header::CONTENT_TYPE) { // https://static.wikia.nocookie.net/disney-fan-fiction/images/9/99/Nemo-Seagulls_.jpg/revision/latest?cb=20130722023815 let mime: mime::Mime = mime_header.to_str()?.parse()?; diff --git a/tremor-connectors/src/impls/http/meta.rs b/tremor-connectors/src/impls/http/meta.rs index 94ed08732a..fad8561185 100644 --- a/tremor-connectors/src/impls/http/meta.rs +++ b/tremor-connectors/src/impls/http/meta.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::impls::http::utils::Body; use crate::{ impls::http::{client, utils::RequestId}, sink::EventSerializer, @@ -22,7 +23,7 @@ use http::{ header::{self, HeaderName, ToStrError}, HeaderMap, Uri, }; -use hyper::{header::HeaderValue, Body, Method, Request, Response}; +use hyper::{header::HeaderValue, Method, Request, Response}; use mime::Mime; use tokio::sync::mpsc::{channel, Sender}; use tremor_config::NameWithConfig; @@ -168,7 +169,7 @@ impl HttpRequestBuilder { let (chunk_tx, mut chunk_rx) = channel(qsize()); let body = Body::wrap_stream(async_stream::stream! { while let Some(item) = chunk_rx.recv().await { - yield Ok::<_, std::convert::Infallible>(item); + yield Ok::<_, std::io::Error>(item); } }); let request = request.body(body)?; @@ -287,8 +288,8 @@ fn extract_headers(headers: &HeaderMap) -> Result, ToStrError> { .collect::, ToStrError>>() } /// Extract request metadata -pub(super) fn extract_request_meta( - request: &Request, +pub(super) fn extract_request_meta( + request: &Request, scheme: &'static str, ) -> Result, ToStrError> { // collect header values into an array for each header diff --git a/tremor-connectors/src/impls/http/server.rs b/tremor-connectors/src/impls/http/server.rs index dcc5a0f3de..5c2c6f88e1 100644 --- a/tremor-connectors/src/impls/http/server.rs +++ b/tremor-connectors/src/impls/http/server.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::impls::http::utils::Body; use crate::{ errors::error_connector_def, impls::http::{ @@ -21,30 +22,25 @@ use crate::{ sink::prelude::*, source::prelude::*, spawn_task, - utils::{ - mime::MimeCodecMap, - socket, - tls::{self, TLSServerConfig}, - }, + utils::{mime::MimeCodecMap, socket, tls::TLSServerConfig}, }; use dashmap::DashMap; use halfbrown::{Entry, HashMap}; use http::{header, Response}; use http::{header::HeaderName, StatusCode}; -use hyper::{ - body::to_bytes, - server::conn::{AddrIncoming, AddrStream}, - service::{make_service_fn, service_fn}, - Body, Request, -}; -use std::{convert::Infallible, net::ToSocketAddrs, sync::Arc}; +use hyper::body::Incoming; +use hyper::{service::service_fn, Request}; +use hyper_util::rt::TokioIo; +use std::{net::ToSocketAddrs, sync::Arc}; use tokio::{ + net::TcpListener, sync::{ mpsc::{channel, Receiver, Sender}, oneshot, }, task::JoinHandle, }; +use tokio_rustls::TlsAcceptor; use tremor_common::{ids::Id, url::Url}; use tremor_config::NameWithConfig; use tremor_script::ValueAndMeta; @@ -230,48 +226,73 @@ impl Source for HttpServerSource { // Server task - this is the main receive loop for http server instances self.server_task = Some(spawn_task(ctx.clone(), async move { if let Some(server_config) = tls_server_config { - let make_service = make_service_fn(move |_conn: &tls::Stream| { - // We have to clone the context to share it with each invocation of - // `make_service`. If your data doesn't implement `Clone` consider using - // an `std::sync::Arc`. - let server_context = server_context.clone(); + let incoming = TcpListener::bind(addr).await?; - async move { - // Create a `Service` for responding to the request. - let service = - service_fn(move |req| handle_request(server_context.clone(), req)); + let acceptor = TlsAcceptor::from(server_config); - // Return the service to hyper. - anyhow::Ok(service) - } - }); - let incoming = AddrIncoming::bind(&addr)?; - let listener = hyper::Server::builder(tls::Acceptor::new(server_config, incoming)) - .serve(make_service); - listener.await?; - } else { - let make_service = make_service_fn(move |_conn: &AddrStream| { + loop { // We have to clone the context to share it with each invocation of // `make_service`. If your data doesn't implement `Clone` consider using // an `std::sync::Arc`. let server_context = server_context.clone(); - // Create a `Service` for responding to the request. - let service = - service_fn(move |req| handle_request(server_context.clone(), req)); + let (tcp_stream, _remote_addr) = incoming.accept().await?; + + let tls_acceptor = acceptor.clone(); + tokio::spawn(async move { + let service = service_fn(move |req: Request| { + handle_request(server_context.clone(), req) + }); - // Return the service to hyper. - async move { Ok::<_, Infallible>(service) } - }); - let listener = hyper::Server::bind(&addr).serve(make_service); + let tls_stream = match tls_acceptor.accept(tcp_stream).await { + Ok(tls_stream) => tls_stream, + Err(err) => { + eprintln!("failed to perform tls handshake: {err:#}"); + return; + } + }; + + let io = TokioIo::new(tls_stream); + if let Err(err) = hyper::server::conn::http1::Builder::new() + .serve_connection(io, service) + .await + { + eprintln!("Error serving connection: {err}"); + } + }); + } + } else { + let listener = TcpListener::bind(addr).await?; info!( - "{ctx} Listening for HTTP requests on {}", + "{ctx} Listening for HTTP requests on {:?}", listener.local_addr() ); - listener.await?; + loop { + let (tcp_stream, _remote_addr) = listener.accept().await?; + info!("{ctx} Accepted connection from {:?}", _remote_addr); + + let io = TokioIo::new(tcp_stream); + + // We have to clone the context to share it with each invocation of + // `service_fn` inside the spawned task. + let server_context = server_context.clone(); + + tokio::task::spawn(async move { + let service = service_fn(move |req: Request| { + handle_request(server_context.clone(), req) + }); + + if let Err(err) = hyper::server::conn::http1::Builder::new() + .serve_connection(io, service) + .await + { + eprintln!("Error serving connection: {err}"); + } + }); + } }; - Ok(()) + // Ok(()) })); Ok(true) @@ -609,7 +630,7 @@ impl SinkResponse { // we can already send out the response and stream the rest of the chunks upon calling `append` let body = Body::wrap_stream(async_stream::stream! { while let Some(item) = chunk_rx.recv().await { - yield Ok::<_, Infallible>(item); + yield Ok::<_, std::io::Error>(item); } }); tx.send(response.body(body)?) @@ -683,7 +704,7 @@ struct RawRequestData { async fn handle_request( mut context: HttpServerState, - req: Request, + req: Request, ) -> http::Result> { // NOTE We wrap and crap as tide doesn't report donated route handler's errors let result = _handle_request(&mut context, req).await; @@ -703,14 +724,15 @@ async fn handle_request( async fn _handle_request( context: &mut HttpServerState, - req: Request, + req: Request, ) -> anyhow::Result> { + use http_body_util::BodyExt; let request_meta = extract_request_meta(&req, context.scheme)?; let content_type = content_type(Some(req.headers()))?.map(|mime| mime.essence_str().to_string()); - let body = req.into_body(); - let data: Vec = to_bytes(body).await?.to_vec(); // Vec::new(); + let body = req.collect().await?; + let data: Vec = body.to_bytes().to_vec(); // Dispatch let (response_tx, response_rx) = oneshot::channel(); diff --git a/tremor-connectors/src/impls/http/utils.rs b/tremor-connectors/src/impls/http/utils.rs index cef9c66f9b..c4311dea51 100644 --- a/tremor-connectors/src/impls/http/utils.rs +++ b/tremor-connectors/src/impls/http/utils.rs @@ -13,6 +13,96 @@ // limitations under the License. use either::Either; +use futures::Stream; +use hyper::body::Bytes; +use std::pin::Pin; +use std::task::Poll; + +/// A body of an HTTP request or response. +pub struct Body { + pub(crate) data: Pin, std::io::Error>> + Send>>, +} +unsafe impl Send for Body {} +unsafe impl Sync for Body {} + +impl std::fmt::Debug for Body { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Body").finish() + } +} + +impl Default for Body { + fn default() -> Self { + Self::empty() + } +} + +impl Body { + #[must_use] + /// Create a new body + pub fn new(data: Vec) -> Self { + Self { + data: Box::pin(futures::stream::once(async move { Ok(data) })), + } + } + + #[must_use] + /// Create an empty body + pub fn empty() -> Self { + Self { + data: Box::pin(futures::stream::empty()), + } + } + + pub(crate) fn wrap_stream( + stream: impl Stream, std::io::Error>> + Send + 'static, + ) -> Self { + Self { + data: Box::pin(stream), + } + } + + // #[cfg(test)] + /// Create a new body from a string. + /// This is a test-only function. + /// It is not recommended to use this function in production code. + /// Use `Body::new` instead. + /// # Errors + /// Returns an error if the string cannot be converted to bytes. + pub async fn to_bytes(mut self) -> Result, std::io::Error> { + use futures::StreamExt; + let mut bytes_vec = Vec::new(); + + let mut data = self.data.as_mut(); + // While there are items in the stream, append them to the bytes_vec. + while let Some(chunk) = data.next().await { + match chunk { + Ok(bytes) => { + bytes_vec.extend_from_slice(&bytes); + } + Err(e) => return Err(e), // Return early with the error. + } + } + + Ok(bytes_vec) + } +} + +impl http_body::Body for Body { + type Data = Bytes; + type Error = std::io::Error; + + fn poll_frame( + self: Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + ) -> Poll, Self::Error>>> { + let this = self.get_mut(); + this.data + .as_mut() + .poll_next(cx) + .map(|opt| opt.map(|res| res.map(|data| http_body::Frame::data(data.into())))) + } +} #[derive(Deserialize, Debug, Clone)] #[serde(transparent)] diff --git a/tremor-connectors/src/impls/tcp/client.rs b/tremor-connectors/src/impls/tcp/client.rs index 493b7272a8..5e5555e1f3 100644 --- a/tremor-connectors/src/impls/tcp/client.rs +++ b/tremor-connectors/src/impls/tcp/client.rs @@ -244,8 +244,8 @@ impl Sink for TcpClientSink { let tls_stream = tls_connector .connect( self.tls_domain - .as_ref() - .map_or_else(|| self.config.url.host_or_local(), String::as_str) + .clone() + .unwrap_or_else(|| self.config.url.host_or_local().to_string()) .try_into()?, stream, ) diff --git a/tremor-connectors/src/impls/ws/client.rs b/tremor-connectors/src/impls/ws/client.rs index 6c49617a40..e0e664ed7c 100644 --- a/tremor-connectors/src/impls/ws/client.rs +++ b/tremor-connectors/src/impls/ws/client.rs @@ -31,7 +31,7 @@ use crate::{ }; use either::Either; use futures::StreamExt; -use rustls::ServerName; +use rustls::pki_types::ServerName; use std::sync::Arc; use std::{net::SocketAddr, sync::atomic::AtomicBool}; use tokio::sync::mpsc::{channel, Receiver, Sender}; @@ -168,7 +168,7 @@ impl Sink for WsClientSink { if let Some(tls_connector) = self.tls_connector.as_ref() { // TLS // wrap it into arcmutex, because we need to clone it in order to close it properly - let server_name = ServerName::try_from(self.tls_domain.as_str())?; + let server_name = ServerName::try_from(self.tls_domain.clone())?; let tls_stream = tls_connector.connect(server_name, tcp_stream).await?; let (ws_stream, _http_response) = client_async(self.config.url.as_str(), tls_stream).await?; diff --git a/tremor-connectors/src/utils/tls.rs b/tremor-connectors/src/utils/tls.rs index 99b1ca271e..b930529c25 100644 --- a/tremor-connectors/src/utils/tls.rs +++ b/tremor-connectors/src/utils/tls.rs @@ -14,25 +14,13 @@ //! TLS utilities -use futures::Future; -use hyper::server::{ - accept::Accept, - conn::{AddrIncoming, AddrStream}, -}; -use rustls::{Certificate, ClientConfig, PrivateKey, RootCertStore, ServerConfig}; +use rustls::pki_types::{CertificateDer, PrivateKeyDer}; +use rustls::{ClientConfig, RootCertStore, ServerConfig}; use rustls_native_certs::load_native_certs; -use rustls_pemfile::{certs, pkcs8_private_keys, rsa_private_keys, Item}; -use std::{ - io::{self, BufReader}, - net::SocketAddr, - pin::Pin, - task::{ready, Context, Poll}, -}; -use std::{ - path::{Path, PathBuf}, - sync::Arc, -}; -use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; +use rustls_pemfile::{pkcs8_private_keys, rsa_private_keys, Item}; +use std::fs::File; +use std::io::{self, BufReader}; +use std::{path::PathBuf, sync::Arc}; use tokio_rustls::TlsConnector; lazy_static::lazy_static! { @@ -41,7 +29,7 @@ lazy_static::lazy_static! { // ALLOW: this is expected to panic if we cannot load system certificates for cert in load_native_certs().expect("Unable to load system TLS certificates.") { roots - .add(&Certificate(cert.0)) + .add(cert) // ALLOW: this is expected to panic if we cannot load system certificates .expect("Unable to add root TLS certificate to RootCertStore"); } @@ -74,12 +62,14 @@ impl TLSServerConfig { /// # Errors /// if the cert or key is invalid pub fn to_server_config(&self) -> Result { - let certs = load_certs(&self.cert)?; + let cert = &self.cert; + let key = &self.key; + let certs = load_certs(cert)?; - let key = load_keys(&self.key)?; + let key = load_keys(key)?; let server_config = ServerConfig::builder() - .with_safe_defaults() + // .with_safe_defaults() .with_no_client_auth() // set this server to use one cert together with the loaded private key .with_single_cert(certs, key)?; @@ -167,22 +157,20 @@ impl TLSClientConfig { let mut reader = BufReader::new(certfile); let cert = rustls_pemfile::read_one(&mut reader)?.and_then(|item| match item { - Item::X509Certificate(cert) => Some(Certificate(cert)), + Item::X509Certificate(cert) => Some(cert), _ => None, }); - cert.and_then(|cert| roots.add(&cert).ok()) + cert.and_then(|cert| roots.add(cert).ok()) .ok_or_else(|| Error::InvalidCertificate(cafile.to_string_lossy().to_string()))?; roots } else { SYSTEM_ROOT_CERTS.clone() }; - let tls_config = ClientConfig::builder() - .with_safe_defaults() - .with_root_certificates(roots); + let tls_config = ClientConfig::builder().with_root_certificates(roots); // load client certificate stuff - if let (Some(cert), Some(key)) = (self.cert.as_ref(), self.key.as_ref()) { + if let (Some(cert), Some(key)) = (&self.cert, &self.key) { let cert = load_certs(cert)?; let key = load_keys(key)?; Ok(tls_config.with_client_auth_cert(cert, key)?) @@ -216,167 +204,57 @@ pub enum Error { } /// Load the passed certificates file -fn load_certs(path: &Path) -> Result, Error> { - let certfile = tremor_common::file::open(path)?; +fn load_certs<'x>(path: &PathBuf) -> Result>, Error> { + let certfile = File::open(path)?; let mut reader = BufReader::new(certfile); - certs(&mut reader) - .map_err(|_| Error::InvalidCertificate(path.to_string_lossy().to_string())) - .and_then(|certs| { - if certs.is_empty() { - Err(Error::CertificateNotFound( - path.to_string_lossy().to_string(), - )) - } else { - Ok(certs.into_iter().map(Certificate).collect()) - } + + let certs = rustls_pemfile::certs(&mut reader) + .map_while(|cert| match cert { + Ok(cert) => Some(cert), + Err(_e) => None, }) + .collect::>(); + + if certs.is_empty() { + return Err(Error::InvalidCertificate( + path.to_string_lossy().to_string(), + )); + } + + Ok(certs) } /// Load the passed private key file -fn load_keys(path: &Path) -> Result { +fn load_keys<'x>(path: &PathBuf) -> Result, Error> { // prefer to load pkcs8 keys // this will only error if we have invalid pkcs8 key base64 or we couldnt read the file. - let keyfile = tremor_common::file::open(path)?; + let keyfile = tremor_common::file::open(&path)?; let mut reader = BufReader::new(keyfile); - let certs = pkcs8_private_keys(&mut reader) - .map_err(|_e| Error::InvalidPrivateKey(path.to_string_lossy().to_string()))?; - let mut keys: Vec = certs.into_iter().map(PrivateKey).collect(); + let mut keys: Vec = pkcs8_private_keys(&mut reader) + // .map_err(|_e| Error::InvalidPrivateKey(path.to_string_lossy().to_string()))?; + .map_while(|key| match key { + Ok(key) => Some(PrivateKeyDer::Pkcs8(key)), + Err(_e) => None, + }) + .collect(); // only attempt to load as RSA keys if file has no pkcs8 keys if keys.is_empty() { - let keyfile = tremor_common::file::open(path)?; + let keyfile = tremor_common::file::open(&path)?; let mut reader = BufReader::new(keyfile); keys = rsa_private_keys(&mut reader) - .map_err(|_e| Error::InvalidPrivateKey(path.to_string_lossy().to_string()))? - .into_iter() - .map(PrivateKey) + .map_while(|key| match key { + Ok(key) => Some(PrivateKeyDer::Pkcs1(key)), + Err(_e) => None, + }) .collect(); } - keys.into_iter() - .next() + keys.pop() .ok_or_else(|| Error::InvalidPrivateKey(path.to_string_lossy().to_string())) } -// This is a copy of https://github.com/rustls/hyper-rustls/blob/main/examples/server.rs -// for some reason they don't provide it as part of the library -enum State { - Handshaking(tokio_rustls::Accept), - Streaming(tokio_rustls::server::TlsStream), -} - -/// `tokio_rustls::server::TlsStream` doesn't expose constructor methods, -/// so we have to `TlsAcceptor::accept` and handshake to have access to it -/// `TlsStream` implements AsyncRead/AsyncWrite handshaking `tokio_rustls::Accept` first -pub struct Stream { - state: State, -} - -impl Stream { - fn new(stream: AddrStream, config: Arc) -> Self { - let accept = tokio_rustls::TlsAcceptor::from(config).accept(stream); - Self { - state: State::Handshaking(accept), - } - } - /// Get the remote address of the stream - pub fn remote_addr(&self) -> Option { - match self.state { - State::Handshaking(ref accept) => accept - .get_ref() - .map(hyper::server::conn::AddrStream::remote_addr), - State::Streaming(ref stream) => Some(stream.get_ref().0.remote_addr()), - } - } -} - -impl AsyncRead for Stream { - fn poll_read( - self: Pin<&mut Self>, - cx: &mut Context, - buf: &mut ReadBuf, - ) -> Poll> { - let pin = self.get_mut(); - match pin.state { - State::Handshaking(ref mut accept) => match ready!(Pin::new(accept).poll(cx)) { - Ok(mut stream) => { - let result = Pin::new(&mut stream).poll_read(cx, buf); - pin.state = State::Streaming(stream); - result - } - Err(err) => Poll::Ready(Err(err)), - }, - State::Streaming(ref mut stream) => Pin::new(stream).poll_read(cx, buf), - } - } -} - -impl AsyncWrite for Stream { - fn poll_write( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &[u8], - ) -> Poll> { - let pin = self.get_mut(); - match pin.state { - State::Handshaking(ref mut accept) => match ready!(Pin::new(accept).poll(cx)) { - Ok(mut stream) => { - let result = Pin::new(&mut stream).poll_write(cx, buf); - pin.state = State::Streaming(stream); - result - } - Err(err) => Poll::Ready(Err(err)), - }, - State::Streaming(ref mut stream) => Pin::new(stream).poll_write(cx, buf), - } - } - - fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - match self.state { - State::Handshaking(_) => Poll::Ready(Ok(())), - State::Streaming(ref mut stream) => Pin::new(stream).poll_flush(cx), - } - } - - fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - match self.state { - State::Handshaking(_) => Poll::Ready(Ok(())), - State::Streaming(ref mut stream) => Pin::new(stream).poll_shutdown(cx), - } - } -} - -/// Acceptor for TLS connections -pub struct Acceptor { - config: Arc, - incoming: AddrIncoming, -} - -impl Acceptor { - /// Create a new Acceptor - pub fn new(config: Arc, incoming: AddrIncoming) -> Acceptor { - Acceptor { config, incoming } - } -} - -impl Accept for Acceptor { - type Conn = Stream; - type Error = io::Error; - - fn poll_accept( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - ) -> Poll>> { - let pin = self.get_mut(); - match ready!(Pin::new(&mut pin.incoming).poll_accept(cx)) { - Some(Ok(sock)) => Poll::Ready(Some(Ok(Stream::new(sock, pin.config.clone())))), - Some(Err(e)) => Poll::Ready(Some(Err(e))), - None => Poll::Ready(None), - } - } -} - #[cfg(test)] mod tests { @@ -387,7 +265,7 @@ mod tests { fn load_certs_invalid() -> anyhow::Result<()> { let mut file = tempfile::NamedTempFile::new()?; file.write_all(b"Brueghelflinsch\n")?; - let path = file.into_temp_path(); + let path = file.into_temp_path().to_path_buf(); assert!(load_certs(&path).is_err()); Ok(()) } @@ -395,7 +273,7 @@ mod tests { #[test] fn load_certs_empty() -> anyhow::Result<()> { let file = tempfile::NamedTempFile::new()?; - let path = file.into_temp_path(); + let path = file.into_temp_path().to_path_buf(); assert!(load_certs(&path).is_err()); Ok(()) } @@ -406,7 +284,7 @@ mod tests { file.write_all( b"-----BEGIN PRIVATE KEY-----\nStrumpfenpfart\n-----END PRIVATE KEY-----\n", )?; - let path = file.into_temp_path(); + let path = file.into_temp_path().to_path_buf(); assert!(load_keys(&path).is_err()); Ok(()) } @@ -414,13 +292,15 @@ mod tests { #[test] fn load_keys_empty() -> anyhow::Result<()> { let file = tempfile::NamedTempFile::new()?; - let path = file.into_temp_path(); + let path = file.into_temp_path().to_path_buf(); assert!(load_keys(&path).is_err()); Ok(()) } #[test] fn client_config() -> anyhow::Result<()> { + use std::path::Path; + use tremor_connectors_test_helpers::setup_for_tls; setup_for_tls(); diff --git a/tremor-connectors/tests/http/client.rs b/tremor-connectors/tests/http/client.rs index db76117229..8f6aab9ac5 100644 --- a/tremor-connectors/tests/http/client.rs +++ b/tremor-connectors/tests/http/client.rs @@ -12,21 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -use anyhow::{anyhow, Result}; +use anyhow::Result; +use http_body_util::BodyExt; +use hyper::body::Incoming; use hyper::StatusCode; -use hyper::{ - body::to_bytes, - server::conn::AddrStream, - service::{make_service_fn, service_fn}, - Body, Response, -}; -use std::{ - convert::Infallible, - net::{SocketAddr, ToSocketAddrs}, -}; +use hyper::{service::service_fn, Response}; +use hyper_util::rt::TokioIo; +use log::error; +use std::net::SocketAddr; +use tokio::net::TcpListener; use tokio::task::{spawn, JoinHandle}; use tremor_common::url::HttpDefaults; use tremor_common::url::Url; +use tremor_connectors::impls::http::utils::Body; use tremor_connectors::{ harness::Harness, impls::http::{self as http_impl, meta::content_type}, @@ -52,20 +50,19 @@ struct TestHttpServer { async fn fake_server_dispatch( _addr: SocketAddr, - reqest: hyper::Request, + req: hyper::Request, ) -> std::result::Result, Box> { let mut res = Response::builder().status(StatusCode::OK); - let ct = content_type(Some(reqest.headers()))?; - let body = reqest.into_body(); - let data: Vec = to_bytes(body).await?.to_vec(); - + let ct = content_type(Some(req.headers()))?; + let body = req.collect().await?; + let data: Vec = body.to_bytes().to_vec(); res = res.header( hyper::header::CONTENT_TYPE, ct.unwrap_or(mime::TEXT_PLAIN).to_string(), ); - - Ok(res.body(Body::from(data))?) + let body = Body::new(data); + Ok(res.body(body)?) } impl TestHttpServer { @@ -76,6 +73,7 @@ impl TestHttpServer { let host = url.host().expect("no host").to_string(); let port = url.port().expect("no port"); + let addr = format!("{}:{}", host, port).parse::()?; if "https" == url.scheme() { todo!(); // let cert_file = "./tests/localhost.cert"; @@ -98,27 +96,20 @@ impl TestHttpServer { // error!("Error listening on {url}: {e}"); // } } else { - let make_service = make_service_fn(move |conn: &AddrStream| { - // We have to clone the context to share it with each invocation of - // `make_service`. If your data doesn't implement `Clone` consider using - // an `std::sync::Arc`. + let listener = TcpListener::bind(addr).await?; + let (tcp_stream, _remote_addr) = listener.accept().await?; + let io = TokioIo::new(tcp_stream); - // You can grab the address of the incoming connection like so. - let addr = conn.remote_addr(); - - // Create a `Service` for responding to the request. + tokio::task::spawn(async move { let service = service_fn(move |req| fake_server_dispatch(addr, req)); - // Return the service to hyper. - async move { Ok::<_, Infallible>(service) } - }); - let addr = (host, port) - .to_socket_addrs()? - .next() - .ok_or(anyhow!("no address"))?; - - let listener = hyper::Server::bind(&addr).serve(make_service); - listener.await?; + if let Err(err) = hyper::server::conn::http1::Builder::new() + .serve_connection(io, service) + .await + { + error!("Error serving connection: {err}"); + } + }) }; Ok(()) })); diff --git a/tremor-connectors/tests/http/server.rs b/tremor-connectors/tests/http/server.rs index 24a074995a..40cb2d792c 100644 --- a/tremor-connectors/tests/http/server.rs +++ b/tremor-connectors/tests/http/server.rs @@ -13,14 +13,16 @@ // limitations under the License. use anyhow::{anyhow, Result}; use http::StatusCode; -use hyper::body::HttpBody; -use hyper::{body::to_bytes, Body, Request, Response}; +use http_body_util::BodyExt; +use hyper::{body::Incoming, Request, Response}; use hyper_rustls::HttpsConnectorBuilder; +use hyper_util::{client::legacy::Client, rt::TokioExecutor}; use std::{ path::PathBuf, time::{Duration, Instant}, }; use tokio::time::timeout; +use tremor_connectors::impls::http::utils::Body; use tremor_connectors::{ harness::Harness, impls::http::{meta::content_type, server}, @@ -42,7 +44,7 @@ async fn handle_req( handle_req_fn: F, mut connector: Harness, is_batch: bool, -) -> Result> +) -> Result> where F: Fn(&ValueAndMeta<'_>) -> ValueAndMeta<'static> + Send + 'static, { @@ -65,11 +67,15 @@ where anyhow::Ok(()) }); - let response = timeout( - Duration::from_secs(5), - hyper::client::Client::new().request(req), - ) - .await??; + + let transport = HttpsConnectorBuilder::new() + .with_native_roots()? + .https_or_http() + .enable_http1() + .enable_http2() + .build(); + let client = Client::builder(TokioExecutor::new()).build(transport); + let response = timeout(Duration::from_secs(5), client.request(req)).await??; handle.abort(); Ok(response) } @@ -145,7 +151,8 @@ async fn http_server_test_basic() -> Result<()> { .headers() .get("content-type") .map(|a| a.as_bytes().to_vec()); - let mut body = to_bytes(result.into_body()).await?.to_vec(); + let body = result.collect().await?; + let mut body = body.to_bytes().to_vec(); let body = simd_json::from_slice::(&mut body)?.into_static(); assert_eq!(Some(b"application/json; charset=UTF-8".to_vec()), h); assert_eq!( @@ -173,11 +180,12 @@ async fn http_server_test_query() -> Result<()> { // and return the request meta and body as a json (codec picked up from connector config) let (connector, url, port) = harness_dflt("http").await?; let req_url = format!("{url}path/path/path?query=yes&another"); + let body_bytes = "snot, badger".bytes().collect::>(); let req = Request::builder() .method("PATCH") .uri(req_url.clone()) .header("content-type", "text/plain") - .body(Body::from("snot, badger"))?; + .body(Body::new(body_bytes))?; let result = handle_req( req, @@ -214,7 +222,8 @@ async fn http_server_test_query() -> Result<()> { .iter() .map(|h| String::from_utf8_lossy(h.as_bytes()).to_string()) .collect(); - let mut body = to_bytes(result.into_body()).await?.to_vec(); + let body = result.collect().await?; + let mut body = body.to_bytes().to_vec(); let body = simd_json::from_slice::(&mut body)?.into_static(); assert_eq!(Some("application/json".to_string()), h1); assert_eq!(vec!["foo".to_string(), "bar".to_string()], h2); @@ -225,8 +234,9 @@ async fn http_server_test_query() -> Result<()> { "protocol": "http", "uri": "/path/path/path?query=yes&another", "headers": { - "content-length": ["12"], + // "content-length": ["12"], "content-type": ["text/plain"], + "transfer-encoding": ["chunked"], "host": [format!("localhost:{port}")], }, "method": "PATCH", @@ -237,6 +247,7 @@ async fn http_server_test_query() -> Result<()> { ); Ok(()) } + #[tokio::test(flavor = "multi_thread")] async fn http_server_test_chunked() -> Result<()> { // TODO: test batched event with chunked encoding @@ -248,7 +259,7 @@ async fn http_server_test_chunked() -> Result<()> { hyper::header::CONTENT_TYPE, mime::APPLICATION_OCTET_STREAM.to_string(), ) - .body(Body::from("A".repeat(1024)))?; + .body(Body::new("A".repeat(1024).into_bytes()))?; let result = handle_req( req, @@ -316,7 +327,8 @@ async fn http_server_test_chunked() -> Result<()> { .get(hyper::header::TRANSFER_ENCODING) .map(http::HeaderValue::as_bytes) ); - let body = to_bytes(result.into_body()).await?.to_vec(); + let body = result.collect().await?; + let body = body.to_bytes().to_vec(); assert_eq!(b"chunk_01|chunk_02|chunk_03|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", body.as_slice()); Ok(()) @@ -382,21 +394,20 @@ async fn https_server_test() -> Result<()> { None, ) .to_client_config()?; + let transport = HttpsConnectorBuilder::new() .with_tls_config(tls_config) + // .with_native_roots()? .https_or_http() .enable_http1() .enable_http2() .build(); - - // HttpsConnector::from((HttpConnector::new(), Arc::new(tls_config))).; - - let client = hyper::Client::builder().build(transport); + let client = Client::builder(TokioExecutor::new()).build(transport); let req = hyper::Request::builder() .method("DELETE") .uri(&url) - .body(hyper::Body::empty())?; + .body(Body::empty())?; let one_sec = Duration::from_secs(1); let mut response = timeout(one_sec, client.request(req)).await; @@ -407,17 +418,17 @@ async fn https_server_test() -> Result<()> { let req = hyper::Request::builder() .method("DELETE") .uri(&url) - .body(hyper::Body::empty())?; + .body(Body::empty())?; if start.elapsed() > max_timeout { return Err(anyhow!("Timeout waiting for HTTPS server to boot up: {e}")); } response = timeout(one_sec, client.request(req)).await; } - let mut response = response??; - let mut data: Vec = Vec::new(); - while let Some(chunk) = response.data().await.transpose()? { - data.extend_from_slice(&chunk); - } + let response = response??; + let status = response.status(); + let headers = response.headers().clone(); + let body = response.collect().await?; + let data = body.to_bytes().to_vec(); let body = String::from_utf8(data)?; let body = serde_yaml::from_str::(&body)?; let expected = serde_yaml::from_str::(&format!( @@ -429,18 +440,17 @@ meta: headers: host: - localhost:{port} + transfer-encoding: + - chunked method: DELETE value: null "# ))?; assert_eq!(expected, body); - assert_eq!(StatusCode::OK, response.status()); + assert_eq!(StatusCode::OK, status); assert_eq!( Some("application/yaml; charset=UTF-8"), - response - .headers() - .get("content-type") - .and_then(|c| c.to_str().ok()) + headers.get("content-type").and_then(|c| c.to_str().ok()) ); handle.abort(); Ok(()) From 3b5bc02691c2b22a1e520c10989cd13f4b0b6ce7 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Wed, 8 May 2024 16:56:43 +0200 Subject: [PATCH 04/28] Refactor to remove http Body and fix unit and integration tests accordingly Signed-off-by: Darach Ennis --- tremor-connectors/Cargo.toml | 9 +- tremor-connectors/src/impls/http/client.rs | 47 +++++---- tremor-connectors/src/impls/http/meta.rs | 44 +++++--- tremor-connectors/src/impls/http/server.rs | 117 ++++++++++++--------- tremor-connectors/src/impls/http/utils.rs | 97 +++-------------- tremor-connectors/tests/http/client.rs | 57 +++++++--- tremor-connectors/tests/http/server.rs | 24 ++--- 7 files changed, 198 insertions(+), 197 deletions(-) diff --git a/tremor-connectors/Cargo.toml b/tremor-connectors/Cargo.toml index 363c55d4cc..0ce824eb73 100644 --- a/tremor-connectors/Cargo.toml +++ b/tremor-connectors/Cargo.toml @@ -18,7 +18,10 @@ tremor-value = { path = "../tremor-value", version = "0.13.0-rc.23" } tremor-interceptor = { path = "../tremor-interceptor", version = "0.13.0-rc.23" } tremor-system = { path = "../tremor-system", version = "0.13.0-rc.23" } -tokio = { version = "1.34", default-features = false, features = ["test-util"] } +tokio = { version = "1.34", default-features = false, features = [ + "full", + "test-util", +] } beef = { version = "0.5", default-features = false } value-trait = { version = "0.8", default-features = false } futures = { version = "0.3", default-features = false } @@ -97,7 +100,7 @@ reqwest = { version = "0.11", optional = true, default-features = false, feature ] } base64 = { version = "0.22", optional = true, default-features = false } dashmap = { version = "5.5", optional = true, default-features = false } -tide = { version = "0.16", optional = true, default-features = false } # TODO remove tide from TestHttpServer + # kafka rdkafka = { version = "0.36", optional = true, features = [ "cmake-build", @@ -170,6 +173,7 @@ bytes = "1.0" tempfile = { version = "3.8", default-features = false } env_logger = "0.11" tremor-connectors-test-helpers = { path = "../tremor-connectors-test-helpers", version = "0.13.0-rc.23" } +tide = { version = "0.16", default-features = false } # TODO remove tide from TestHttpServer [features] default = [ @@ -229,7 +233,6 @@ http = [ "dep:hyper-util", "dep:hyper", "dep:mime", - "dep:tide", "dep:reqwest", "hyper/http1", "hyper/http2", diff --git a/tremor-connectors/src/impls/http/client.rs b/tremor-connectors/src/impls/http/client.rs index f3415723e9..e6c9323aac 100644 --- a/tremor-connectors/src/impls/http/client.rs +++ b/tremor-connectors/src/impls/http/client.rs @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::utils::Body; use crate::{ errors::error_connector_def, impls::http::{ auth::Auth, meta::{extract_request_meta, extract_response_meta, HttpRequestBuilder}, - utils::{Header, RequestId}, + utils::{Body, Header, RequestId}, }, sink::{concurrency_cap::ConcurrencyCap, prelude::*}, source::prelude::*, @@ -26,7 +25,7 @@ use crate::{ }; use either::Either; use halfbrown::HashMap; -use http_body_util::BodyExt; +use http_body_util::{BodyExt, BodyStream}; use hyper::Method; use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; use hyper_util::client::legacy::connect::HttpConnector; @@ -253,7 +252,7 @@ impl Source for HttpRequestSource { struct HttpRequestSink { request_counter: u64, - client: Option, Body>>>, + client: Option, BodyStream>>>, response_tx: Sender, reply_tx: ReplySender, config: Config, @@ -369,6 +368,14 @@ impl Sink for HttpRequestSink { HttpRequestBuilder::new(request_id, http_meta, &self.codec_map, &self.config), "Error turning event into an HTTP Request", )?; + + for (value, meta) in event.value_meta_iter() { + ctx.bail_err( + builder.append(value, meta, ingest_ns, serializer).await, + "Error serializing event into request body", + )?; + } + let codec_map = self.codec_map.clone(); let request = builder.take_request()?; @@ -394,24 +401,11 @@ impl Sink for HttpRequestSink { let response = client.request(request); match timeout(t, response).await { Ok(Ok(response)) => { - // let stream = response.into_body(); - // We know stream is a http_body::Body, so we can safely unwrap here let response_meta = extract_response_meta(&response)?; - let headers = response.headers().clone(); - let body = response.collect().await?; - let data = body.to_bytes().to_vec(); + let headers = response.headers(); if let Some(response_tx) = response_tx { - let mut meta = task_ctx.meta(literal!({ - "request": req_meta, - "request_id": request_id.get(), - "response": response_meta - })); - - if let Some(corr_meta) = correlation_meta { - meta.try_insert("correlation", corr_meta); - } let codec_name = if let Some(mime_header) = headers.get(hyper::header::CONTENT_TYPE) { @@ -423,6 +417,23 @@ impl Sink for HttpRequestSink { None }; let codec_overwrite = codec_name.cloned(); + + let body = response.collect().await?; + let data = body.to_bytes().to_vec(); + let content_length = data.len() as u64; + + // response_meta.try_insert("content-length", dbg!(content_length)); + let mut meta = task_ctx.meta(literal!({ + "request": req_meta, + "request_id": request_id.get(), + "response": response_meta, + "content-length": content_length, + })); + + if let Some(corr_meta) = correlation_meta { + meta.try_insert("correlation", corr_meta); + } + let reply = SourceReply::Data { origin_uri, data, diff --git a/tremor-connectors/src/impls/http/meta.rs b/tremor-connectors/src/impls/http/meta.rs index fad8561185..2bea2ef7b0 100644 --- a/tremor-connectors/src/impls/http/meta.rs +++ b/tremor-connectors/src/impls/http/meta.rs @@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::impls::http::utils::Body; use crate::{ - impls::http::{client, utils::RequestId}, + impls::http::{client, utils::Body, utils::RequestId}, sink::EventSerializer, utils::mime::MimeCodecMap, }; @@ -23,13 +22,16 @@ use http::{ header::{self, HeaderName, ToStrError}, HeaderMap, Uri, }; +use http_body_util::BodyStream; use hyper::{header::HeaderValue, Method, Request, Response}; use mime::Mime; -use tokio::sync::mpsc::{channel, Sender}; +use tokio::sync::mpsc::{channel, Receiver, Sender}; use tremor_config::NameWithConfig; use tremor_system::qsize; use tremor_value::prelude::*; +use super::utils::body_from_bytes; + /// HTTP Connector Errors #[derive(Debug, thiserror::Error)] pub enum Error { @@ -42,14 +44,19 @@ pub enum Error { /// Request already consumed #[error("Request already consumed")] RequestAlreadyConsumed, + /// Response already consumed + #[error("Response already consumed")] + ResponseAlreadyConsumed, } /// Utility for building an HTTP request from a possibly batched event /// and some configuration values pub(crate) struct HttpRequestBuilder { request_id: RequestId, - request: Option>, + builder: Option, + //request: Option>>, chunk_tx: Sender>, + chunk_rx: Receiver>, codec_overwrite: Option, } @@ -166,20 +173,15 @@ impl HttpRequestBuilder { request = request.header(hyper::header::AUTHORIZATION, auth_header); } - let (chunk_tx, mut chunk_rx) = channel(qsize()); - let body = Body::wrap_stream(async_stream::stream! { - while let Some(item) = chunk_rx.recv().await { - yield Ok::<_, std::io::Error>(item); - } - }); - let request = request.body(body)?; + let (chunk_tx, chunk_rx) = channel::>(qsize()); // extract headers // determine content-type, override codec and chunked encoding Ok(Self { request_id, - request: Some(request), + builder: Some(request), chunk_tx, + chunk_rx, codec_overwrite, }) } @@ -210,8 +212,20 @@ impl HttpRequestBuilder { Ok(()) } - pub(super) fn take_request(&mut self) -> Result, Error> { - self.request.take().ok_or(Error::RequestAlreadyConsumed) + pub(super) fn take_request(&mut self) -> Result>, Error> { + let mut data = Vec::new(); + + // drain the channel + while let Ok(chunk) = self.chunk_rx.try_recv() { + data.extend(chunk); + } + + let builder = self.builder.take().ok_or(Error::RequestAlreadyConsumed)?; + let body_stream = BodyStream::new(body_from_bytes(data)); + let request = builder + .body(body_stream) + .map_err(|_| Error::RequestAlreadyConsumed)?; + Ok(request) } /// Finalize and send the response. /// In the chunked case we have already sent it before. @@ -344,8 +358,10 @@ mod test { )?; let config = client::Config::new(&c)?; + dbg!("got here 0"); let mut b = HttpRequestBuilder::new(request_id, meta, &codec_map, &config)?; + dbg!("got here 1"); let r = b.take_request()?; b.finalize(&mut s).await?; assert_eq!(r.headers().get_all("pie").iter().count(), 1); diff --git a/tremor-connectors/src/impls/http/server.rs b/tremor-connectors/src/impls/http/server.rs index 5c2c6f88e1..c9ce0ce4e4 100644 --- a/tremor-connectors/src/impls/http/server.rs +++ b/tremor-connectors/src/impls/http/server.rs @@ -12,12 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::impls::http::utils::Body; use crate::{ errors::error_connector_def, impls::http::{ meta::{consolidate_mime, content_type, extract_request_meta, HeaderValueValue}, - utils::RequestId, + utils::{body_from_bytes, empty_body, Body, RequestId}, }, sink::prelude::*, source::prelude::*, @@ -28,6 +27,7 @@ use dashmap::DashMap; use halfbrown::{Entry, HashMap}; use http::{header, Response}; use http::{header::HeaderName, StatusCode}; +use http_body_util::BodyStream; use hyper::body::Incoming; use hyper::{service::service_fn, Request}; use hyper_util::rt::TokioIo; @@ -119,7 +119,7 @@ pub(crate) struct HttpServer { config: Config, origin_uri: EventOriginUri, tls_server_config: Option, - inflight: Arc>>>, + inflight: Arc>>>>, codec_map: MimeCodecMap, } @@ -171,7 +171,7 @@ impl Connector for HttpServer { struct HttpServerSource { url: Url, origin_uri: EventOriginUri, - inflight: Arc>>>, + inflight: Arc>>>>, request_counter: u64, request_rx: Receiver, request_tx: Sender, @@ -247,7 +247,7 @@ impl Source for HttpServerSource { let tls_stream = match tls_acceptor.accept(tcp_stream).await { Ok(tls_stream) => tls_stream, Err(err) => { - eprintln!("failed to perform tls handshake: {err:#}"); + error!("failed to perform tls handshake: {err:#}"); return; } }; @@ -257,7 +257,7 @@ impl Source for HttpServerSource { .serve_connection(io, service) .await { - eprintln!("Error serving connection: {err}"); + error!("Error serving connection: {err}"); } }); } @@ -292,7 +292,6 @@ impl Source for HttpServerSource { }); } }; - // Ok(()) })); Ok(true) @@ -368,7 +367,7 @@ impl Source for HttpServerSource { } struct HttpServerSink { - inflight: Arc>>>, + inflight: Arc>>>>, codec_map: MimeCodecMap, } @@ -377,7 +376,7 @@ impl HttpServerSink { const ERROR_MSG_APPEND_RESPONSE: &'static str = "Error appending batched data to HTTP response"; fn new( - inflight: Arc>>>, + inflight: Arc>>>>, codec_map: MimeCodecMap, ) -> Self { Self { @@ -420,18 +419,17 @@ impl Sink for HttpServerSink { if let Some(rid) = http_meta.get_u64("request_id").map(RequestId::new) { match response_map.entry(rid) { Entry::Vacant(k) => { - if let Some((rid, sender)) = self.inflight.remove(&rid) { + if let Some(_snot) = self.inflight.get(&rid) { debug!("{ctx} Building response for request_id {rid}"); - let mut response = ctx.bail_err( - SinkResponse::build(rid, sender, http_meta, &self.codec_map), - Self::ERROR_MSG_EXTRACT_VALUE, - )?; + let srm = SinkResponse::build(rid, http_meta, &self.codec_map); + let mut sr = ctx.bail_err(srm, Self::ERROR_MSG_EXTRACT_VALUE)?; ctx.bail_err( - response.append(value, meta, ingest_ns, serializer).await, + sr.append(value, meta, ingest_ns, serializer).await, Self::ERROR_MSG_APPEND_RESPONSE, )?; - k.insert(response); + + k.insert(sr); } else { warn!( "{ctx} No request context found for `request_id`: {rid}. Dropping response." @@ -455,15 +453,10 @@ impl Sink for HttpServerSink { match response_map.entry(rid) { Entry::Vacant(k) => { - if let Some((rid, sender)) = self.inflight.remove(&rid) { + if let Some(_badger) = self.inflight.get(&rid) { debug!("{ctx} Building response for request_id {rid}"); let mut response = ctx.bail_err( - SinkResponse::build( - rid, - sender, - http_meta, - &self.codec_map, - ), + SinkResponse::build(rid, http_meta, &self.codec_map), Self::ERROR_MSG_EXTRACT_VALUE, )?; @@ -471,6 +464,7 @@ impl Sink for HttpServerSink { response.append(value, meta, ingest_ns, serializer).await, Self::ERROR_MSG_APPEND_RESPONSE, )?; + k.insert(response); } else { warn!("{ctx} No request context found for Request id: {rid}. Dropping response."); @@ -490,15 +484,10 @@ impl Sink for HttpServerSink { for rid in (min..=max).map(RequestId::new) { match response_map.entry(rid) { Entry::Vacant(k) => { - if let Some((rid, sender)) = self.inflight.remove(&rid) { + if let Some(_badger) = self.inflight.get(&rid) { debug!("{ctx} Building response for request_id {rid}"); let mut response = ctx.bail_err( - SinkResponse::build( - rid, - sender, - http_meta, - &self.codec_map, - ), + SinkResponse::build(rid, http_meta, &self.codec_map), Self::ERROR_MSG_EXTRACT_VALUE, )?; @@ -508,6 +497,7 @@ impl Sink for HttpServerSink { .await, Self::ERROR_MSG_APPEND_RESPONSE, )?; + k.insert(response); } else { warn!("{ctx} No request context found for Request id: {rid}. Dropping response."); @@ -537,13 +527,24 @@ impl Sink for HttpServerSink { error!("{ctx} No request context found for event."); return Ok(SinkReply::FAIL); } - for (rid, response) in response_map { - debug!("{ctx} Sending response for request_id {rid}"); - ctx.swallow_err( - response.finalize(serializer).await, - &format!("Error sending response for request_id {rid}"), - ); + + // drain inlflight and response_map so we can send the responses + for (rid, mut response) in response_map { + let request = self.inflight.remove(&rid); + if let Some((_rid, sender)) = request { + let wire_response = response.take_response()?; + sender + .send(wire_response) + .map_err(|_| anyhow::anyhow!("failed to send response for request_id {rid}"))?; + ctx.swallow_err( + response.finalize(serializer).await, + &format!("Error sending response for request_id {rid}"), + ); + } else { + warn!("{ctx} No request context found for Request id: {rid}. Dropping response."); + } } + Ok(SinkReply::NONE) } @@ -566,13 +567,14 @@ impl Sink for HttpServerSink { struct SinkResponse { request_id: RequestId, chunk_tx: Sender>, + chunk_rx: Receiver>, codec_overwrite: Option, + builder: Option, } impl SinkResponse { fn build( request_id: RequestId, - tx: oneshot::Sender>, http_meta: Option<&Value>, codec_map: &MimeCodecMap, ) -> anyhow::Result { @@ -625,20 +627,14 @@ impl SinkResponse { response = response.header(header::CONTENT_TYPE, ct.to_string()); } } - let (chunk_tx, mut chunk_rx) = channel(qsize()); + let (chunk_tx, chunk_rx) = channel::>(qsize()); - // we can already send out the response and stream the rest of the chunks upon calling `append` - let body = Body::wrap_stream(async_stream::stream! { - while let Some(item) = chunk_rx.recv().await { - yield Ok::<_, std::io::Error>(item); - } - }); - tx.send(response.body(body)?) - .map_err(|_| anyhow::anyhow!("failed to send response"))?; Ok(Self { request_id, chunk_tx, + chunk_rx, codec_overwrite, + builder: Some(response), }) } @@ -668,6 +664,27 @@ impl SinkResponse { Ok(()) } + pub(super) fn take_response( + &mut self, + ) -> Result>, super::meta::Error> { + let mut data = Vec::new(); + + // drain the channel + while let Ok(chunk) = self.chunk_rx.try_recv() { + data.extend(chunk); + } + + let builder = self + .builder + .take() + .ok_or(super::meta::Error::ResponseAlreadyConsumed)?; + let body_stream = BodyStream::new(body_from_bytes(data)); + let response = builder + .body(body_stream) + .map_err(|_| super::meta::Error::ResponseAlreadyConsumed)?; + Ok(response) + } + /// Consume self and finalize and send the response. /// In the chunked case we have already sent it before. async fn finalize(mut self, serializer: &mut EventSerializer) -> anyhow::Result<()> { @@ -699,13 +716,13 @@ struct RawRequestData { // metadata about the request, not the ready event meta, still needs to be wrapped request_meta: Value<'static>, content_type: Option, - response_channel: oneshot::Sender>, + response_channel: oneshot::Sender>>, } async fn handle_request( mut context: HttpServerState, req: Request, -) -> http::Result> { +) -> http::Result>> { // NOTE We wrap and crap as tide doesn't report donated route handler's errors let result = _handle_request(&mut context, req).await; match result { @@ -717,7 +734,7 @@ async fn handle_request( ); Response::builder() .status(StatusCode::INTERNAL_SERVER_ERROR) - .body(Body::empty()) + .body(BodyStream::new(empty_body())) } } } @@ -725,7 +742,7 @@ async fn handle_request( async fn _handle_request( context: &mut HttpServerState, req: Request, -) -> anyhow::Result> { +) -> anyhow::Result>> { use http_body_util::BodyExt; let request_meta = extract_request_meta(&req, context.scheme)?; let content_type = diff --git a/tremor-connectors/src/impls/http/utils.rs b/tremor-connectors/src/impls/http/utils.rs index c4311dea51..0b50e93e54 100644 --- a/tremor-connectors/src/impls/http/utils.rs +++ b/tremor-connectors/src/impls/http/utils.rs @@ -13,95 +13,24 @@ // limitations under the License. use either::Either; -use futures::Stream; +use http_body_util::Full; use hyper::body::Bytes; -use std::pin::Pin; -use std::task::Poll; -/// A body of an HTTP request or response. -pub struct Body { - pub(crate) data: Pin, std::io::Error>> + Send>>, -} -unsafe impl Send for Body {} -unsafe impl Sync for Body {} - -impl std::fmt::Debug for Body { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Body").finish() - } -} +/// We re-use Full from `http_body_util` crate which is a wrapper around +/// `hyper::body::Bytes` and implements `http_body::Body` trait. This +/// avoids introducing our own Body type +pub type Body = Full; -impl Default for Body { - fn default() -> Self { - Self::empty() - } +/// An empty body +#[must_use] +pub fn empty_body() -> Body { + Full::new(Bytes::new()) } -impl Body { - #[must_use] - /// Create a new body - pub fn new(data: Vec) -> Self { - Self { - data: Box::pin(futures::stream::once(async move { Ok(data) })), - } - } - - #[must_use] - /// Create an empty body - pub fn empty() -> Self { - Self { - data: Box::pin(futures::stream::empty()), - } - } - - pub(crate) fn wrap_stream( - stream: impl Stream, std::io::Error>> + Send + 'static, - ) -> Self { - Self { - data: Box::pin(stream), - } - } - - // #[cfg(test)] - /// Create a new body from a string. - /// This is a test-only function. - /// It is not recommended to use this function in production code. - /// Use `Body::new` instead. - /// # Errors - /// Returns an error if the string cannot be converted to bytes. - pub async fn to_bytes(mut self) -> Result, std::io::Error> { - use futures::StreamExt; - let mut bytes_vec = Vec::new(); - - let mut data = self.data.as_mut(); - // While there are items in the stream, append them to the bytes_vec. - while let Some(chunk) = data.next().await { - match chunk { - Ok(bytes) => { - bytes_vec.extend_from_slice(&bytes); - } - Err(e) => return Err(e), // Return early with the error. - } - } - - Ok(bytes_vec) - } -} - -impl http_body::Body for Body { - type Data = Bytes; - type Error = std::io::Error; - - fn poll_frame( - self: Pin<&mut Self>, - cx: &mut std::task::Context<'_>, - ) -> Poll, Self::Error>>> { - let this = self.get_mut(); - this.data - .as_mut() - .poll_next(cx) - .map(|opt| opt.map(|res| res.map(|data| http_body::Frame::data(data.into())))) - } +/// Create a new body from bytes +#[must_use] +pub fn body_from_bytes(bytes: Vec) -> Body { + Full::new(Bytes::from(bytes)) } #[derive(Deserialize, Debug, Clone)] diff --git a/tremor-connectors/tests/http/client.rs b/tremor-connectors/tests/http/client.rs index 8f6aab9ac5..f8e513cca5 100644 --- a/tremor-connectors/tests/http/client.rs +++ b/tremor-connectors/tests/http/client.rs @@ -19,12 +19,13 @@ use hyper::StatusCode; use hyper::{service::service_fn, Response}; use hyper_util::rt::TokioIo; use log::error; -use std::net::SocketAddr; +use rand::{seq::SliceRandom, thread_rng}; +use std::net::ToSocketAddrs; use tokio::net::TcpListener; use tokio::task::{spawn, JoinHandle}; use tremor_common::url::HttpDefaults; use tremor_common::url::Url; -use tremor_connectors::impls::http::utils::Body; +use tremor_connectors::impls::http::utils::{body_from_bytes, Body}; use tremor_connectors::{ harness::Harness, impls::http::{self as http_impl, meta::content_type}, @@ -44,12 +45,28 @@ pub(crate) async fn find_free_tcp_endpoint_str() -> Result { Ok(format!("localhost:{port}")) // NOTE we use localhost rather than an IP for cmopat with TLS } +fn host_to_sockaddr(hostport: &str) -> Result { + let mut rng = thread_rng(); + let socket_addrs: Vec<_> = hostport + .to_socket_addrs() + .map_err(|e| e.to_string())? + .collect(); + + if socket_addrs.is_empty() { + Err("No addresses found.".to_string()) + } else { + socket_addrs + .choose(&mut rng) // Might be multihomed + .cloned() + .ok_or_else(|| "Random selection failed.".to_string()) + } +} + struct TestHttpServer { acceptor: Option>>, } async fn fake_server_dispatch( - _addr: SocketAddr, req: hyper::Request, ) -> std::result::Result, Box> { let mut res = Response::builder().status(StatusCode::OK); @@ -61,7 +78,8 @@ async fn fake_server_dispatch( hyper::header::CONTENT_TYPE, ct.unwrap_or(mime::TEXT_PLAIN).to_string(), ); - let body = Body::new(data); + + let body = body_from_bytes(data); Ok(res.body(body)?) } @@ -70,10 +88,10 @@ impl TestHttpServer { let mut instance = TestHttpServer { acceptor: None }; instance.acceptor = Some(spawn(async move { let url: Url = Url::parse(&raw_url)?; - let host = url.host().expect("no host").to_string(); - let port = url.port().expect("no port"); - - let addr = format!("{}:{}", host, port).parse::()?; + let host = url.host_str().unwrap_or("localhost"); + let port = url.port().unwrap_or(666); + let hostport = format!("{host}:{port}"); + let addr = host_to_sockaddr(&hostport).unwrap(); if "https" == url.scheme() { todo!(); // let cert_file = "./tests/localhost.cert"; @@ -101,7 +119,7 @@ impl TestHttpServer { let io = TokioIo::new(tcp_stream); tokio::task::spawn(async move { - let service = service_fn(move |req| fake_server_dispatch(addr, req)); + let service = service_fn(fake_server_dispatch); if let Err(err) = hyper::server::conn::http1::Builder::new() .serve_connection(io, service) @@ -152,6 +170,7 @@ async fn rtt( harness.start().await?; harness.wait_for_connected().await?; harness.consume_initial_sink_contraflow().await?; + harness.send_to_sink(event).await?; let event = harness.out()?.get_event().await; let event = match event { @@ -397,9 +416,8 @@ async fn http_client_request_override_headers() -> Result<()> { ); }); - assert_with_response_headers!(res, meta, { - assert_eq!(Some(&literal!(["2"])), meta.get("content-length")); - }); + let length = res.meta().get("http_client").unwrap().get("content-length"); + assert_eq!(Some(&literal!(2)), length); assert_eq!(Value::from("42"), res.value()); Ok(()) @@ -446,13 +464,16 @@ async fn http_client_request_override_content_type() -> Result<()> { }); assert_with_response_headers!(res, meta, { - assert_eq!(Some(&literal!(["24"])), meta.get("content-length")); + // assert_eq!(Some(&literal!(["24"])), meta.get("content-length")); - NOTE - changes in hyper from 0.14 - 1x - see below for alternate assert_eq!( Some(&literal!(["application/json"])), meta.get("content-type") ); }); + let length = res.meta().get("http_client").unwrap().get("content-length"); + assert_eq!(Some(&literal!(24)), length); + assert_eq!( literal!([ {"snot": "badger"}, @@ -504,7 +525,7 @@ async fn http_client_request_auth_none() -> Result<()> { }); assert_with_response_headers!(res, meta, { - assert_eq!(Some(&literal!(["17"])), meta.get("content-length")); + // assert_eq!(Some(&literal!(["17"])), meta.get("content-length")); NOTE - changes in hyper from 0.14 - 1x - see below for alternate // the server mirrors the request content-type assert_eq!( Some(&literal!(["application/json"])), @@ -512,6 +533,9 @@ async fn http_client_request_auth_none() -> Result<()> { ); }); + let length = res.meta().get("http_client").unwrap().get("content-length"); + assert_eq!(Some(&literal!(17)), length); + assert_eq!( literal!({ "snot": "badger" @@ -579,13 +603,16 @@ async fn http_client_request_auth_basic() -> Result<()> { }); assert_with_response_headers!(res, meta, { - assert_eq!(Some(&literal!(["17"])), meta.get("content-length")); + // assert_eq!(Some(&literal!(["17"])), res.meta().get("content-length")); assert_eq!( Some(&literal!(["application/json"])), meta.get("content-type") ); }); + let length = res.meta().get("http_client").unwrap().get("content-length"); + assert_eq!(Some(&literal!(17)), length); + assert_eq!(literal!({"snot": "badger"}), res.value()); Ok(()) } diff --git a/tremor-connectors/tests/http/server.rs b/tremor-connectors/tests/http/server.rs index 40cb2d792c..77771ee637 100644 --- a/tremor-connectors/tests/http/server.rs +++ b/tremor-connectors/tests/http/server.rs @@ -22,7 +22,7 @@ use std::{ time::{Duration, Instant}, }; use tokio::time::timeout; -use tremor_connectors::impls::http::utils::Body; +use tremor_connectors::impls::http::utils::{empty_body, Body}; use tremor_connectors::{ harness::Harness, impls::http::{meta::content_type, server}, @@ -64,7 +64,6 @@ where connector.send_to_sink(event).await?; } let (_out, _err) = connector.stop().await?; - anyhow::Ok(()) }); @@ -119,7 +118,7 @@ async fn http_server_test_basic() -> Result<()> { let req = Request::builder() .method("GET") .uri(url.as_str()) - .body(Body::empty())?; + .body(empty_body())?; result = handle_req( req, |req_data| { @@ -146,7 +145,7 @@ async fn http_server_test_basic() -> Result<()> { } let result = result?; - assert_eq!(StatusCode::CREATED, result.status()); + let status = result.status(); let h = result .headers() .get("content-type") @@ -154,7 +153,9 @@ async fn http_server_test_basic() -> Result<()> { let body = result.collect().await?; let mut body = body.to_bytes().to_vec(); let body = simd_json::from_slice::(&mut body)?.into_static(); + assert_eq!(Some(b"application/json; charset=UTF-8".to_vec()), h); + assert_eq!(StatusCode::CREATED, status); assert_eq!( literal!({ "meta": { @@ -185,7 +186,7 @@ async fn http_server_test_query() -> Result<()> { .method("PATCH") .uri(req_url.clone()) .header("content-type", "text/plain") - .body(Body::new(body_bytes))?; + .body(Body::new(body_bytes.into()))?; let result = handle_req( req, @@ -200,7 +201,7 @@ async fn http_server_test_query() -> Result<()> { "status": 400, "headers": { "some-other-header": ["foo", "bar"], - "content-type": "application/json" + "content-type": "application/json", } } } @@ -234,9 +235,8 @@ async fn http_server_test_query() -> Result<()> { "protocol": "http", "uri": "/path/path/path?query=yes&another", "headers": { - // "content-length": ["12"], + "content-length": ["12"], "content-type": ["text/plain"], - "transfer-encoding": ["chunked"], "host": [format!("localhost:{port}")], }, "method": "PATCH", @@ -259,7 +259,7 @@ async fn http_server_test_chunked() -> Result<()> { hyper::header::CONTENT_TYPE, mime::APPLICATION_OCTET_STREAM.to_string(), ) - .body(Body::new("A".repeat(1024).into_bytes()))?; + .body(Body::new("A".repeat(1024).into()))?; let result = handle_req( req, @@ -407,7 +407,7 @@ async fn https_server_test() -> Result<()> { let req = hyper::Request::builder() .method("DELETE") .uri(&url) - .body(Body::empty())?; + .body(empty_body())?; let one_sec = Duration::from_secs(1); let mut response = timeout(one_sec, client.request(req)).await; @@ -418,7 +418,7 @@ async fn https_server_test() -> Result<()> { let req = hyper::Request::builder() .method("DELETE") .uri(&url) - .body(Body::empty())?; + .body(empty_body())?; if start.elapsed() > max_timeout { return Err(anyhow!("Timeout waiting for HTTPS server to boot up: {e}")); } @@ -440,8 +440,6 @@ meta: headers: host: - localhost:{port} - transfer-encoding: - - chunked method: DELETE value: null "# From 845500a993dfff1d4b541b6c69201c509983dab7 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Wed, 8 May 2024 18:04:25 +0200 Subject: [PATCH 05/28] Remove superfluous comment line Signed-off-by: Darach Ennis --- tremor-connectors/src/impls/http/client.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tremor-connectors/src/impls/http/client.rs b/tremor-connectors/src/impls/http/client.rs index e6c9323aac..fde1a61d95 100644 --- a/tremor-connectors/src/impls/http/client.rs +++ b/tremor-connectors/src/impls/http/client.rs @@ -422,7 +422,6 @@ impl Sink for HttpRequestSink { let data = body.to_bytes().to_vec(); let content_length = data.len() as u64; - // response_meta.try_insert("content-length", dbg!(content_length)); let mut meta = task_ctx.meta(literal!({ "request": req_meta, "request_id": request_id.get(), From 6bfdd09801a99a2b06b9ae13f38ac6b6e33e3fa4 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Wed, 8 May 2024 18:19:59 +0200 Subject: [PATCH 06/28] Obey deps check Signed-off-by: Darach Ennis --- Cargo.lock | 3 --- Cargo.toml | 1 - tremor-connectors/Cargo.toml | 3 --- 3 files changed, 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2a71b9735f..f991ce72a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6764,7 +6764,6 @@ version = "0.13.0-rc.23" dependencies = [ "anyhow", "async-compression", - "async-stream", "async-trait", "base64 0.22.1", "beef", @@ -6781,7 +6780,6 @@ dependencies = [ "event-listener 5.3.0", "file-mode", "futures", - "futures-core", "gouth", "halfbrown", "hdrhistogram", @@ -7061,7 +7059,6 @@ dependencies = [ "async-trait", "aws-config", "aws-sdk-s3", - "aws-smithy-http", "aws-types", "cron", "elasticsearch", diff --git a/Cargo.toml b/Cargo.toml index eb71aabafd..4fec510fa6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -145,7 +145,6 @@ tremor-otelapis = { version = "=0.2.4" } aws-sdk-s3 = { version = "1.4", features = ["behavior-version-latest"] } aws-types = "1" aws-config = "1" -aws-smithy-http = "0.60" # gcp googapis = { version = "0.6", default-features = false, features = [ diff --git a/tremor-connectors/Cargo.toml b/tremor-connectors/Cargo.toml index 0ce824eb73..b799ae4ea4 100644 --- a/tremor-connectors/Cargo.toml +++ b/tremor-connectors/Cargo.toml @@ -62,7 +62,6 @@ hyper-util = { version = "0.1.3", optional = true, default-features = false, fea "tokio", "server-auto", ] } -async-stream = { version = "0.3", optional = true, default-features = false } gouth = { version = "0.2", optional = true, default-features = true } @@ -160,7 +159,6 @@ cron = { version = "0.12", optional = true, default-features = false } # udp socket2 = { version = "0.5", optional = true, default-features = false } -futures-core = "0.3.30" [dev-dependencies] serde_yaml = { version = "0.9", default-features = false } @@ -222,7 +220,6 @@ elasticsearch = [ "http", ] http = [ - "dep:async-stream", "dep:base64", "dep:dashmap", "dep:gouth", From a9fee6a32367ec49722e4ef87d8bdc17d818c2d9 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Wed, 8 May 2024 18:25:41 +0200 Subject: [PATCH 07/28] Obey deps check Signed-off-by: Darach Ennis --- Cargo.lock | 1 + tremor-script/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index f991ce72a7..e468d54299 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7157,6 +7157,7 @@ dependencies = [ "percent-encoding", "pretty_assertions", "proptest", + "qwal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.8.5", "regex", "serde", diff --git a/tremor-script/Cargo.toml b/tremor-script/Cargo.toml index 6d2d39a435..61ad956350 100644 --- a/tremor-script/Cargo.toml +++ b/tremor-script/Cargo.toml @@ -59,6 +59,7 @@ tremor-kv = "0.6" unicode-xid = "0.2" url = "2" xz2 = "0.1" +qwal = "0.1.0" [build-dependencies] lalrpop = "0.20" From c89b9021b8d9fce6b1dd8e522415abc4258a7a2d Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Wed, 8 May 2024 18:40:00 +0200 Subject: [PATCH 08/28] Obey deps check Signed-off-by: Darach Ennis --- Cargo.lock | 13 +------------ Cargo.toml | 2 +- tremor-script/Cargo.toml | 1 - 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e468d54299..c55b9c0538 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4483,15 +4483,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "qwal" -version = "0.1.0" -source = "git+https://github.com/tremor-rs/qwal#8191a4940d7a56f0a237c58e410fd4d779d2dca7" -dependencies = [ - "byteorder", - "tokio", -] - [[package]] name = "rand" version = "0.7.3" @@ -6796,7 +6787,7 @@ dependencies = [ "log", "mime", "proptest", - "qwal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "qwal", "rand 0.8.5", "rdkafka", "rdkafka-sys", @@ -7085,7 +7076,6 @@ dependencies = [ "proptest", "prost", "prost-types", - "qwal 0.1.0 (git+https://github.com/tremor-rs/qwal)", "rdkafka", "rdkafka-sys", "regex", @@ -7157,7 +7147,6 @@ dependencies = [ "percent-encoding", "pretty_assertions", "proptest", - "qwal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.8.5", "regex", "serde", diff --git a/Cargo.toml b/Cargo.toml index 4fec510fa6..445eecce62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -164,7 +164,7 @@ reqwest = { version = "0.11", default-features = false, features = [ uuid = { version = "1.6", features = ["v4"] } # wal -qwal = { git = "https://github.com/tremor-rs/qwal" } +# qwal = { git = "https://github.com/tremor-rs/qwal" } itoa = "1" ryu = "1" lexical = "6" diff --git a/tremor-script/Cargo.toml b/tremor-script/Cargo.toml index 61ad956350..6d2d39a435 100644 --- a/tremor-script/Cargo.toml +++ b/tremor-script/Cargo.toml @@ -59,7 +59,6 @@ tremor-kv = "0.6" unicode-xid = "0.2" url = "2" xz2 = "0.1" -qwal = "0.1.0" [build-dependencies] lalrpop = "0.20" From 2954a712c8c68a20f4a27188c7ff8548361e110a Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Wed, 8 May 2024 20:35:30 +0200 Subject: [PATCH 09/28] Update tremor-connectors/src/impls/http/meta.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/src/impls/http/meta.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tremor-connectors/src/impls/http/meta.rs b/tremor-connectors/src/impls/http/meta.rs index 2bea2ef7b0..4b0ab4ce56 100644 --- a/tremor-connectors/src/impls/http/meta.rs +++ b/tremor-connectors/src/impls/http/meta.rs @@ -358,7 +358,6 @@ mod test { )?; let config = client::Config::new(&c)?; - dbg!("got here 0"); let mut b = HttpRequestBuilder::new(request_id, meta, &codec_map, &config)?; dbg!("got here 1"); From 35e937ebf67c8aaab7d853a977fd55ba9a5d620d Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Wed, 8 May 2024 20:36:00 +0200 Subject: [PATCH 10/28] Update tremor-connectors/src/impls/http/meta.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/src/impls/http/meta.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tremor-connectors/src/impls/http/meta.rs b/tremor-connectors/src/impls/http/meta.rs index 4b0ab4ce56..74b7f25f15 100644 --- a/tremor-connectors/src/impls/http/meta.rs +++ b/tremor-connectors/src/impls/http/meta.rs @@ -360,7 +360,6 @@ mod test { let mut b = HttpRequestBuilder::new(request_id, meta, &codec_map, &config)?; - dbg!("got here 1"); let r = b.take_request()?; b.finalize(&mut s).await?; assert_eq!(r.headers().get_all("pie").iter().count(), 1); From 4f54f49ddcb0521ed3b70aaf1cb2a54257c6a0c2 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Wed, 8 May 2024 20:44:54 +0200 Subject: [PATCH 11/28] Update tremor-connectors/src/impls/http.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/src/impls/http.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tremor-connectors/src/impls/http.rs b/tremor-connectors/src/impls/http.rs index f625123a98..0874e0ef94 100644 --- a/tremor-connectors/src/impls/http.rs +++ b/tremor-connectors/src/impls/http.rs @@ -205,4 +205,4 @@ pub mod meta; /// HTTP server connect pub mod server; /// HTTP utils -pub mod utils; +pub(crate) mod utils; From 2148f5daedb0435cd6c80ab9b1ea4d9d13403a60 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 13:19:35 +0200 Subject: [PATCH 12/28] Update tremor-connectors/tests/http/server.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/tests/http/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tremor-connectors/tests/http/server.rs b/tremor-connectors/tests/http/server.rs index 77771ee637..542d3cd730 100644 --- a/tremor-connectors/tests/http/server.rs +++ b/tremor-connectors/tests/http/server.rs @@ -186,7 +186,7 @@ async fn http_server_test_query() -> Result<()> { .method("PATCH") .uri(req_url.clone()) .header("content-type", "text/plain") - .body(Body::new(body_bytes.into()))?; + .body(Full::new(body_bytes.into()))?; let result = handle_req( req, From 279af8313c49e661e936b857142a808c89fb05d8 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 13:19:58 +0200 Subject: [PATCH 13/28] Update tremor-connectors/tests/http/server.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/tests/http/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tremor-connectors/tests/http/server.rs b/tremor-connectors/tests/http/server.rs index 542d3cd730..5ec990de5f 100644 --- a/tremor-connectors/tests/http/server.rs +++ b/tremor-connectors/tests/http/server.rs @@ -118,7 +118,7 @@ async fn http_server_test_basic() -> Result<()> { let req = Request::builder() .method("GET") .uri(url.as_str()) - .body(empty_body())?; + .body(Full::new(Bytes::new()))?; result = handle_req( req, |req_data| { From 2068bef829326a437b33e7e0dcf669c327d11361 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 13:20:10 +0200 Subject: [PATCH 14/28] Update tremor-connectors/tests/http/server.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/tests/http/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tremor-connectors/tests/http/server.rs b/tremor-connectors/tests/http/server.rs index 5ec990de5f..0754d15aeb 100644 --- a/tremor-connectors/tests/http/server.rs +++ b/tremor-connectors/tests/http/server.rs @@ -407,7 +407,7 @@ async fn https_server_test() -> Result<()> { let req = hyper::Request::builder() .method("DELETE") .uri(&url) - .body(empty_body())?; + .body(Full::new(Bytes::new()))?; let one_sec = Duration::from_secs(1); let mut response = timeout(one_sec, client.request(req)).await; From d04afe26e3963cd0735453db074380bc5761d3a3 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 13:20:22 +0200 Subject: [PATCH 15/28] Update tremor-connectors/tests/http/server.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/tests/http/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tremor-connectors/tests/http/server.rs b/tremor-connectors/tests/http/server.rs index 0754d15aeb..364b917e7e 100644 --- a/tremor-connectors/tests/http/server.rs +++ b/tremor-connectors/tests/http/server.rs @@ -259,7 +259,7 @@ async fn http_server_test_chunked() -> Result<()> { hyper::header::CONTENT_TYPE, mime::APPLICATION_OCTET_STREAM.to_string(), ) - .body(Body::new("A".repeat(1024).into()))?; + .body(Full::new("A".repeat(1024).into()))?; let result = handle_req( req, From 375b173b3193125bdc1e7f3c09c857083ef0f5ff Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 13:20:29 +0200 Subject: [PATCH 16/28] Update tremor-connectors/tests/http/server.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/tests/http/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tremor-connectors/tests/http/server.rs b/tremor-connectors/tests/http/server.rs index 364b917e7e..237b759ce2 100644 --- a/tremor-connectors/tests/http/server.rs +++ b/tremor-connectors/tests/http/server.rs @@ -418,7 +418,7 @@ async fn https_server_test() -> Result<()> { let req = hyper::Request::builder() .method("DELETE") .uri(&url) - .body(empty_body())?; + .body(Full::new(Bytes::new()))?; if start.elapsed() > max_timeout { return Err(anyhow!("Timeout waiting for HTTPS server to boot up: {e}")); } From 3a8ecd46db2515e3133f800196ecdea28c106653 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 13:21:35 +0200 Subject: [PATCH 17/28] Update Cargo.toml This might have been a rebase artefact - I possibly biased for the wrong variant Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- Cargo.toml | 95 ------------------------------------------------------ 1 file changed, 95 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 445eecce62..caebad6572 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,101 +75,6 @@ simd-json-derive = "0.13" value-trait = "0.8" -# blaster / blackhole# codecs -hdrhistogram = "7" -xz2 = "0.1" - -# http -hyper = { version = "1.2", features = ["full"] } -hyper-rustls = { version = "0.24", features = ["http2"] } -mime = "0.3" -# elasticsearch -elasticsearch = { version = "=8.5.0-alpha.1", default-features = false, features = [ - "rustls-tls", -] } - - -# for tcp & ws -tokio-rustls = "0.24" -async-channel = "2.1" -rustls = "0.21" -rustls-pemfile = "1" -rustls-native-certs = "0.6" -tokio-tungstenite = "0.20" - -# dns -trust-dns-resolver = { version = "0.23" } - -rdkafka = { version = "0.36", features = [ - "cmake-build", - "libz-static", - "tokio", -], default-features = false } - -# tracking the version rdkafka depends on -rdkafka-sys = { version = "4.6", features = [ - "cmake-build", - "libz-static", -], default-features = false } - -# crononome -cron = "0.12" - -# logstash grok patterns -grok = "2" - -# discord -serenity = { version = "0.11", default-features = false, features = [ - "client", - "gateway", - "rustls_backend", - "model", - "cache", -] } - -# kv -sled = "0.34" - -# opentelemetry -tonic = { version = "0.6.1", default-features = false, features = [ - "transport", - "tls", -] } -prost = "0.9.0" -prost-types = "0.9.0" -# This is related to https://github.com/tremor-rs/tremor-runtime/issues/1688 the otel API's need to -# be updated together with tonic -tremor-otelapis = { version = "=0.2.4" } - -# aws-s3 -aws-sdk-s3 = { version = "1.4", features = ["behavior-version-latest"] } -aws-types = "1" -aws-config = "1" - -# gcp -googapis = { version = "0.6", default-features = false, features = [ - "google-pubsub-v1", - "google-cloud-bigquery-storage-v1", - "google-logging-v2", - "google-storage-v2", -] } -gouth = { version = "0.2" } -http = "0.2" -reqwest = { version = "0.11", default-features = false, features = [ - "rustls-tls", - "rustls-tls-native-roots", -] } - -# http -uuid = { version = "1.6", features = ["v4"] } - -# wal -# qwal = { git = "https://github.com/tremor-rs/qwal" } -itoa = "1" -ryu = "1" -lexical = "6" -simdutf8 = "0.1" - [dev-dependencies] port_scanner = "0.1" env_logger = "0.11" From 59bd158471a503d6e9a6c8d942cf0bff6f2ff76f Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 13:38:59 +0200 Subject: [PATCH 18/28] Add comment to http server connector on batch streaming in on-event handler Signed-off-by: Darach Ennis --- tremor-connectors/src/impls/http/server.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tremor-connectors/src/impls/http/server.rs b/tremor-connectors/src/impls/http/server.rs index c9ce0ce4e4..cc6ac8a433 100644 --- a/tremor-connectors/src/impls/http/server.rs +++ b/tremor-connectors/src/impls/http/server.rs @@ -411,6 +411,15 @@ impl Sink for HttpServerSink { // - store: request_id -> (SinkResponse, Sender) // - update SinkResponse for each element of the batch // - send response immediately in case of chunked encoding + + // NOTE: Prior to hyper-1.2 we could remove completed requests inflight here which + // is no longer possible given the structure of the connector and changes to hyper + // itself. Instead, we append responses to a map and drain it at the end of the function. + // which makes this a 2-phase rather than 1-phase operation. + // + // Addition of support for SSE or other active streaming responses would be a good time + // to revisit and refactor the code accordingly. + let mut response_map = HashMap::new(); for (value, meta) in event.value_meta_iter() { let http_meta = ctx.extract_meta(meta); From 8fe9d184c0a288b385816d57ac47432a8319e00d Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 13:45:11 +0200 Subject: [PATCH 19/28] Fix fmt/clippy issues from accepted review suggestions Signed-off-by: Darach Ennis --- tremor-connectors/tests/http/server.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tremor-connectors/tests/http/server.rs b/tremor-connectors/tests/http/server.rs index 237b759ce2..b4e38e6284 100644 --- a/tremor-connectors/tests/http/server.rs +++ b/tremor-connectors/tests/http/server.rs @@ -22,7 +22,7 @@ use std::{ time::{Duration, Instant}, }; use tokio::time::timeout; -use tremor_connectors::impls::http::utils::{empty_body, Body}; +use tremor_connectors::impls::http::utils::Body; use tremor_connectors::{ harness::Harness, impls::http::{meta::content_type, server}, @@ -186,7 +186,7 @@ async fn http_server_test_query() -> Result<()> { .method("PATCH") .uri(req_url.clone()) .header("content-type", "text/plain") - .body(Full::new(body_bytes.into()))?; + .body(Full::::new(body_bytes.into()))?; let result = handle_req( req, @@ -259,7 +259,7 @@ async fn http_server_test_chunked() -> Result<()> { hyper::header::CONTENT_TYPE, mime::APPLICATION_OCTET_STREAM.to_string(), ) - .body(Full::new("A".repeat(1024).into()))?; + .body(Full::::new("A".repeat(1024).into()))?; let result = handle_req( req, From b312f2783e0bb563c6c3becc9f0e9e5e9779cec8 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 14:09:31 +0200 Subject: [PATCH 20/28] Fix tests impacted by accepted review suggestions Signed-off-by: Darach Ennis --- tremor-connectors/tests/http/client.rs | 9 +++++---- tremor-connectors/tests/http/server.rs | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tremor-connectors/tests/http/client.rs b/tremor-connectors/tests/http/client.rs index f8e513cca5..e9b1934662 100644 --- a/tremor-connectors/tests/http/client.rs +++ b/tremor-connectors/tests/http/client.rs @@ -13,7 +13,8 @@ // limitations under the License. use anyhow::Result; -use http_body_util::BodyExt; +use bytes::Bytes; +use http_body_util::{BodyExt, Full}; use hyper::body::Incoming; use hyper::StatusCode; use hyper::{service::service_fn, Response}; @@ -25,7 +26,6 @@ use tokio::net::TcpListener; use tokio::task::{spawn, JoinHandle}; use tremor_common::url::HttpDefaults; use tremor_common::url::Url; -use tremor_connectors::impls::http::utils::{body_from_bytes, Body}; use tremor_connectors::{ harness::Harness, impls::http::{self as http_impl, meta::content_type}, @@ -68,7 +68,8 @@ struct TestHttpServer { async fn fake_server_dispatch( req: hyper::Request, -) -> std::result::Result, Box> { +) -> std::result::Result>, Box> +{ let mut res = Response::builder().status(StatusCode::OK); let ct = content_type(Some(req.headers()))?; @@ -79,7 +80,7 @@ async fn fake_server_dispatch( ct.unwrap_or(mime::TEXT_PLAIN).to_string(), ); - let body = body_from_bytes(data); + let body = Full::new(Bytes::from(data)); Ok(res.body(body)?) } diff --git a/tremor-connectors/tests/http/server.rs b/tremor-connectors/tests/http/server.rs index b4e38e6284..58951ad52c 100644 --- a/tremor-connectors/tests/http/server.rs +++ b/tremor-connectors/tests/http/server.rs @@ -14,7 +14,8 @@ use anyhow::{anyhow, Result}; use http::StatusCode; use http_body_util::BodyExt; -use hyper::{body::Incoming, Request, Response}; +use http_body_util::Full; +use hyper::{body::Bytes, body::Incoming, Request, Response}; use hyper_rustls::HttpsConnectorBuilder; use hyper_util::{client::legacy::Client, rt::TokioExecutor}; use std::{ @@ -22,7 +23,6 @@ use std::{ time::{Duration, Instant}, }; use tokio::time::timeout; -use tremor_connectors::impls::http::utils::Body; use tremor_connectors::{ harness::Harness, impls::http::{meta::content_type, server}, @@ -40,7 +40,7 @@ use value_trait::prelude::*; /// in the meantime it creates a new hyper client and sends the provided `req` to the source /// then returns the response after it went through `source`, `handle_req_fn` and `sink` async fn handle_req( - req: Request, + req: Request>, handle_req_fn: F, mut connector: Harness, is_batch: bool, From e2d4b4d40d6e544f10011e37a42b463c65a6909b Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 15:04:36 +0200 Subject: [PATCH 21/28] Attend to review suggestions impacting TLS utility code in connectors Signed-off-by: Darach Ennis --- tremor-connectors/src/utils/tls.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tremor-connectors/src/utils/tls.rs b/tremor-connectors/src/utils/tls.rs index b930529c25..6b623bcf11 100644 --- a/tremor-connectors/src/utils/tls.rs +++ b/tremor-connectors/src/utils/tls.rs @@ -18,7 +18,6 @@ use rustls::pki_types::{CertificateDer, PrivateKeyDer}; use rustls::{ClientConfig, RootCertStore, ServerConfig}; use rustls_native_certs::load_native_certs; use rustls_pemfile::{pkcs8_private_keys, rsa_private_keys, Item}; -use std::fs::File; use std::io::{self, BufReader}; use std::{path::PathBuf, sync::Arc}; use tokio_rustls::TlsConnector; @@ -69,7 +68,6 @@ impl TLSServerConfig { let key = load_keys(key)?; let server_config = ServerConfig::builder() - // .with_safe_defaults() .with_no_client_auth() // set this server to use one cert together with the loaded private key .with_single_cert(certs, key)?; @@ -205,7 +203,7 @@ pub enum Error { /// Load the passed certificates file fn load_certs<'x>(path: &PathBuf) -> Result>, Error> { - let certfile = File::open(path)?; + let certfile = tremor_common::file::open(&path)?; let mut reader = BufReader::new(certfile); let certs = rustls_pemfile::certs(&mut reader) From f04ee9a99f0dbc256a8fd80f5d3c10e04e895628 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 15:26:56 +0200 Subject: [PATCH 22/28] Update tremor-connectors/src/impls/http/utils.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/src/impls/http/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tremor-connectors/src/impls/http/utils.rs b/tremor-connectors/src/impls/http/utils.rs index 0b50e93e54..9a9d6d2f27 100644 --- a/tremor-connectors/src/impls/http/utils.rs +++ b/tremor-connectors/src/impls/http/utils.rs @@ -19,7 +19,7 @@ use hyper::body::Bytes; /// We re-use Full from `http_body_util` crate which is a wrapper around /// `hyper::body::Bytes` and implements `http_body::Body` trait. This /// avoids introducing our own Body type -pub type Body = Full; +pub(crate) type Body = Full; /// An empty body #[must_use] From f3cfb3b93a1276008978dd794a3b3945ea080797 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 15:27:07 +0200 Subject: [PATCH 23/28] Update tremor-connectors/src/impls/http/utils.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/src/impls/http/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tremor-connectors/src/impls/http/utils.rs b/tremor-connectors/src/impls/http/utils.rs index 9a9d6d2f27..b80a9beebf 100644 --- a/tremor-connectors/src/impls/http/utils.rs +++ b/tremor-connectors/src/impls/http/utils.rs @@ -23,7 +23,7 @@ pub(crate) type Body = Full; /// An empty body #[must_use] -pub fn empty_body() -> Body { +pub(crate) fn empty_body() -> Body { Full::new(Bytes::new()) } From 7330ff9d7f592078b1c89878106c1410a636f72a Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 15:27:40 +0200 Subject: [PATCH 24/28] Update tremor-connectors/src/impls/http/utils.rs Co-authored-by: Heinz N. Gies Signed-off-by: Darach Ennis --- tremor-connectors/src/impls/http/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tremor-connectors/src/impls/http/utils.rs b/tremor-connectors/src/impls/http/utils.rs index b80a9beebf..fc4d44cf87 100644 --- a/tremor-connectors/src/impls/http/utils.rs +++ b/tremor-connectors/src/impls/http/utils.rs @@ -29,7 +29,7 @@ pub(crate) fn empty_body() -> Body { /// Create a new body from bytes #[must_use] -pub fn body_from_bytes(bytes: Vec) -> Body { +pub(crate) fn body_from_bytes(bytes: Vec) -> Body { Full::new(Bytes::from(bytes)) } From d782c771b0a0fda1914755aafc308dd1a4f9da0b Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 15:42:16 +0200 Subject: [PATCH 25/28] Improve connectors deps by moving some tokio features to dev deps Signed-off-by: Darach Ennis --- tremor-connectors/Cargo.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tremor-connectors/Cargo.toml b/tremor-connectors/Cargo.toml index b799ae4ea4..4da0edbd64 100644 --- a/tremor-connectors/Cargo.toml +++ b/tremor-connectors/Cargo.toml @@ -17,11 +17,7 @@ tremor-script = { path = "../tremor-script", version = "0.13.0-rc.23" } tremor-value = { path = "../tremor-value", version = "0.13.0-rc.23" } tremor-interceptor = { path = "../tremor-interceptor", version = "0.13.0-rc.23" } tremor-system = { path = "../tremor-system", version = "0.13.0-rc.23" } - -tokio = { version = "1.34", default-features = false, features = [ - "full", - "test-util", -] } +tokio = { version = "1.34", default-features = false } beef = { version = "0.5", default-features = false } value-trait = { version = "0.8", default-features = false } futures = { version = "0.3", default-features = false } @@ -172,6 +168,10 @@ tempfile = { version = "3.8", default-features = false } env_logger = "0.11" tremor-connectors-test-helpers = { path = "../tremor-connectors-test-helpers", version = "0.13.0-rc.23" } tide = { version = "0.16", default-features = false } # TODO remove tide from TestHttpServer +tokio = { version = "1.34", default-features = false, features = [ + "full", + "test-util", +] } [features] default = [ From 1fea60fcff28c5b5430b5e071b681802ba16ff34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 May 2024 17:21:38 +0000 Subject: [PATCH 26/28] Bump serenity from 0.11.7 to 0.12.1 Bumps [serenity](https://github.com/serenity-rs/serenity) from 0.11.7 to 0.12.1. - [Release notes](https://github.com/serenity-rs/serenity/releases) - [Changelog](https://github.com/serenity-rs/serenity/blob/current/CHANGELOG.md) - [Commits](https://github.com/serenity-rs/serenity/compare/v0.11.7...v0.12.1) --- updated-dependencies: - dependency-name: serenity dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 144 +++++++++++------------------------------------------ 1 file changed, 29 insertions(+), 115 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c55b9c0538..78414d216b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -541,7 +541,7 @@ dependencies = [ "futures-core", "futures-io", "rustls 0.18.1", - "webpki 0.21.4", + "webpki", "webpki-roots 0.20.0", ] @@ -556,22 +556,6 @@ dependencies = [ "syn 2.0.61", ] -[[package]] -name = "async-tungstenite" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b71b31561643aa8e7df3effe284fa83ab1a840e52294c5f4bd7bfd8b2becbb" -dependencies = [ - "futures-io", - "futures-util", - "log", - "pin-project-lite 0.2.14", - "tokio", - "tokio-rustls 0.23.4", - "tungstenite 0.17.3", - "webpki-roots 0.22.6", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -603,7 +587,7 @@ dependencies = [ "serde", "serde_urlencoded 0.6.1", "url", - "webpki 0.21.4", + "webpki", "webpki-roots 0.19.0", "wildmatch", ] @@ -4948,7 +4932,7 @@ dependencies = [ "log", "ring 0.16.20", "sct 0.6.1", - "webpki 0.21.4", + "webpki", ] [[package]] @@ -4961,19 +4945,7 @@ dependencies = [ "log", "ring 0.16.20", "sct 0.6.1", - "webpki 0.21.4", -] - -[[package]] -name = "rustls" -version = "0.20.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" -dependencies = [ - "log", - "ring 0.16.20", - "sct 0.7.1", - "webpki 0.22.4", + "webpki", ] [[package]] @@ -5041,15 +5013,6 @@ dependencies = [ "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -5079,6 +5042,8 @@ dependencies = [ [[package]] name = "rustls-webpki" version = "0.102.3" +<<<<<<< HEAD +======= source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" dependencies = [ @@ -5386,29 +5351,29 @@ dependencies = [ [[package]] name = "serenity" -version = "0.11.7" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a7a89cef23483fc9d4caf2df41e6d3928e18aada84c56abd237439d929622c6" +checksum = "c64da29158bb55d70677cacd4f4f8eab1acef005fb830d9c3bea411b090e96a9" dependencies = [ + "arrayvec 0.7.4", "async-trait", - "async-tungstenite", "base64 0.21.7", - "bitflags 1.3.2", + "bitflags 2.5.0", "bytes", - "cfg-if", "dashmap", "flate2", "futures", - "mime", + "fxhash", "mime_guess", "parking_lot 0.12.2", "percent-encoding", "reqwest", + "secrecy", "serde", - "serde-value", "serde_json", "time 0.3.36", "tokio", + "tokio-tungstenite 0.21.0", "tracing", "typemap_rev 0.1.5", "url", @@ -5469,17 +5434,6 @@ dependencies = [ "syn 2.0.61", ] -[[package]] -name = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - [[package]] name = "sha1" version = "0.6.1" @@ -6359,18 +6313,7 @@ checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ "rustls 0.19.1", "tokio", - "webpki 0.21.4", -] - -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls 0.20.9", - "tokio", - "webpki 0.22.4", + "webpki", ] [[package]] @@ -6405,6 +6348,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.15" @@ -7256,27 +7210,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "tungstenite" -version = "0.17.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" -dependencies = [ - "base64 0.13.1", - "byteorder", - "bytes", - "http 0.2.12", - "httparse", - "log", - "rand 0.8.5", - "rustls 0.20.9", - "sha-1", - "thiserror", - "url", - "utf-8", - "webpki 0.22.4", -] - [[package]] name = "tungstenite" version = "0.20.1" @@ -7348,9 +7281,9 @@ dependencies = [ [[package]] name = "typemap_rev" -version = "0.1.5" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5b74f0a24b5454580a79abb6994393b09adf0ab8070f15827cb666255de155" +checksum = "74b08b0c1257381af16a5c3605254d529d3e7e109f3c62befc5d168968192998" [[package]] name = "typemap_rev" @@ -7741,23 +7674,13 @@ dependencies = [ "untrusted 0.7.1", ] -[[package]] -name = "webpki" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" -dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", -] - [[package]] name = "webpki-roots" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739" dependencies = [ - "webpki 0.21.4", + "webpki", ] [[package]] @@ -7766,16 +7689,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" dependencies = [ - "webpki 0.21.4", -] - -[[package]] -name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki 0.22.4", + "webpki", ] [[package]] From dc27e5b42ef7d357ba0283400e1dae44bc9fe827 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Fri, 10 May 2024 19:18:57 +0200 Subject: [PATCH 27/28] Silence clippy unwrap used failures in connector free port helper tests Signed-off-by: Darach Ennis --- tremor-connectors-test-helpers/src/free_port.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tremor-connectors-test-helpers/src/free_port.rs b/tremor-connectors-test-helpers/src/free_port.rs index 5ddb0062a8..dfa68ec559 100644 --- a/tremor-connectors-test-helpers/src/free_port.rs +++ b/tremor-connectors-test-helpers/src/free_port.rs @@ -79,6 +79,7 @@ mod tests { use super::*; #[tokio::test] + #[allow(clippy::unwrap_used)] // Don't care in this test async fn test_find_free_tcp_port() { let port = find_free_tcp_port().await.unwrap(); assert!(port >= *FreePort::RANGE.start()); @@ -93,6 +94,7 @@ mod tests { } #[tokio::test] + #[allow(clippy::unwrap_used)] // Don't care in this test async fn test_find_free_udp_port() { let port = find_free_udp_port().await.unwrap(); assert!(port >= *FreePort::RANGE.start()); From 4acac1e998acb7e7d22b0e32190bf7dbc4287b23 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Mon, 13 May 2024 12:22:21 +0200 Subject: [PATCH 28/28] Update discord connector to latest serenity library Signed-off-by: Darach Ennis --- tremor-connectors/Cargo.toml | 2 +- .../src/impls/discord/handler.rs | 229 ++++++++---------- tremor-connectors/src/impls/discord/utils.rs | 34 +-- 3 files changed, 124 insertions(+), 141 deletions(-) diff --git a/tremor-connectors/Cargo.toml b/tremor-connectors/Cargo.toml index 4da0edbd64..4dcf7a9291 100644 --- a/tremor-connectors/Cargo.toml +++ b/tremor-connectors/Cargo.toml @@ -167,7 +167,7 @@ bytes = "1.0" tempfile = { version = "3.8", default-features = false } env_logger = "0.11" tremor-connectors-test-helpers = { path = "../tremor-connectors-test-helpers", version = "0.13.0-rc.23" } -tide = { version = "0.16", default-features = false } # TODO remove tide from TestHttpServer +tide = { version = "0.16", default-features = false } # TODO remove tide from TestHttpServer tokio = { version = "1.34", default-features = false, features = [ "full", "test-util", diff --git a/tremor-connectors/src/impls/discord/handler.rs b/tremor-connectors/src/impls/discord/handler.rs index d2712cf22f..d57a65de9d 100644 --- a/tremor-connectors/src/impls/discord/handler.rs +++ b/tremor-connectors/src/impls/discord/handler.rs @@ -16,11 +16,12 @@ use super::utils::{as_snowflake, get_snowflake, to_reactions, DiscordMessage}; use crate::channel::{Receiver, Sender}; use serenity::{ + all::{CreateEmbed, CreateEmbedAuthor, CreateEmbedFooter, CreateMessage, EditMember}, model::{ - channel::{Channel, ChannelCategory, GuildChannel, Message, Reaction}, + channel::{GuildChannel, Message, Reaction}, event::{ - ChannelPinsUpdateEvent, GuildMembersChunkEvent, ResumedEvent, TypingStartEvent, - VoiceServerUpdateEvent, + ChannelPinsUpdateEvent, GuildMemberUpdateEvent, GuildMembersChunkEvent, ResumedEvent, + TypingStartEvent, VoiceServerUpdateEvent, }, guild::{Emoji, Guild, Member, PartialGuild, Role}, id::{ChannelId, EmojiId, GuildId, MessageId, RoleId, UserId}, @@ -29,6 +30,7 @@ use serenity::{ }, prelude::*, }; +use simd_json::prelude::ValueObjectAccess; use std::collections::HashMap; use tokio::task; use tremor_value::{prelude::*, to_value}; @@ -57,6 +59,7 @@ impl Handler { } } } + #[async_trait::async_trait] impl EventHandler for Handler { // We use the cache_ready event just in case some cache operation is required in whatever use @@ -71,23 +74,17 @@ impl EventHandler for Handler { } } - async fn channel_create(&self, _ctx: Context, channel: &GuildChannel) { - self.forward(DiscordMessage::ChannelCreate(channel.clone())) - .await; - } - - async fn category_create(&self, _ctx: Context, category: &ChannelCategory) { - self.forward(DiscordMessage::CategoryCreate(category.clone())) - .await; + async fn channel_create(&self, _ctx: Context, channel: GuildChannel) { + self.forward(DiscordMessage::ChannelCreate(channel)).await; } - async fn category_delete(&self, _ctx: Context, category: &ChannelCategory) { - self.forward(DiscordMessage::CategoryDelete(category.clone())) - .await; - } - - async fn channel_delete(&self, _ctx: Context, channel: &GuildChannel) { - self.forward(DiscordMessage::ChannelDelete(channel.clone())) + async fn channel_delete( + &self, + _ctx: Context, + channel: GuildChannel, + maybe_message: Option>, + ) { + self.forward(DiscordMessage::ChannelDelete(channel, maybe_message)) .await; } @@ -133,7 +130,7 @@ impl EventHandler for Handler { self.forward(DiscordMessage::TypingStart(e)).await; } - async fn channel_update(&self, _ctx: Context, old: Option, new: Channel) { + async fn channel_update(&self, _ctx: Context, old: Option, new: GuildChannel) { self.forward(DiscordMessage::ChannelUpdate { old, new }) .await; } @@ -148,7 +145,7 @@ impl EventHandler for Handler { .await; } - async fn guild_create(&self, _ctx: Context, guild: Guild, is_new: bool) { + async fn guild_create(&self, _ctx: Context, guild: Guild, is_new: Option) { self.forward(DiscordMessage::GuildCreate { guild, is_new }) .await; } @@ -200,11 +197,13 @@ impl EventHandler for Handler { &self, _ctx: Context, old_if_available: Option, - new: Member, + member: Option, + event: GuildMemberUpdateEvent, ) { self.forward(DiscordMessage::MemberUpdate { old_if_available, - new, + member, + event, }) .await; } @@ -245,11 +244,6 @@ impl EventHandler for Handler { .await; } - async fn guild_unavailable(&self, _ctx: Context, guild_id: GuildId) { - self.forward(DiscordMessage::GuildUnavailable(guild_id)) - .await; - } - async fn guild_update( &self, _ctx: Context, @@ -325,9 +319,17 @@ impl EventHandler for Handler { self.forward(DiscordMessage::Resume(resume)).await; } - async fn user_update(&self, _ctx: Context, old_data: CurrentUser, new: CurrentUser) { - self.forward(DiscordMessage::UserUpdate { old_data, new }) + async fn user_update(&self, _ctx: Context, old_data: Option, new: CurrentUser) { + if let Some(old_data) = old_data { + self.forward(DiscordMessage::UserUpdate { old_data, new }) + .await; + } else { + self.forward(DiscordMessage::UserUpdate { + old_data: new.clone(), + new, + }) .await; + } } async fn voice_server_update(&self, _ctx: Context, update: VoiceServerUpdateEvent) { @@ -358,7 +360,7 @@ async fn reply_loop(mut rx: Receiver>, ctx: Context) { while let Some(reply) = rx.recv().await { if let Some(reply) = reply.get("guild") { let guild = if let Some(id) = get_snowflake(reply, "id") { - GuildId(id) + GuildId::new(id) } else { error!("guild `id` missing"); continue; @@ -366,8 +368,8 @@ async fn reply_loop(mut rx: Receiver>, ctx: Context) { if let Some(member) = reply.get("member") { if let Some(id) = get_snowflake(member, "id") { - let user = UserId(id); - let mut current_member = match guild.member(&ctx, user).await { + let user = UserId::new(id); + let current_member = match guild.member(&ctx, user).await { Ok(current_member) => current_member, Err(e) => { error!("Member error: {}", e); @@ -377,7 +379,7 @@ async fn reply_loop(mut rx: Receiver>, ctx: Context) { if let Some(to_remove) = member.get_array("remove_roles") { let to_remove: Vec<_> = to_remove .iter() - .filter_map(|v| as_snowflake(v).map(RoleId)) + .filter_map(|v| as_snowflake(v).map(RoleId::new)) .collect(); if let Err(e) = current_member.remove_roles(&ctx, &to_remove).await { error!("Role removal error: {}", e); @@ -387,24 +389,20 @@ async fn reply_loop(mut rx: Receiver>, ctx: Context) { if let Some(to_roles) = member.get_array("add_roles") { let to_roles: Vec<_> = to_roles .iter() - .filter_map(|v| as_snowflake(v).map(RoleId)) + .filter_map(|v| as_snowflake(v).map(RoleId::new)) .collect(); if let Err(e) = current_member.add_roles(&ctx, &to_roles).await { error!("Role add error: {}", e); }; } - let r = guild - .edit_member(&ctx, id, |m| { - if let Some(deafen) = member.get_bool("deafen") { - m.deafen(deafen); - } - if let Some(mute) = member.get_bool("mute") { - m.mute(mute); - } - - m - }) - .await; + let mut em = EditMember::default(); + if let Some(mute) = member.get_bool("mute") { + em = em.mute(mute); + }; + if let Some(deaf) = member.get_bool("deaf") { + em = em.deafen(deaf); + }; + let r = guild.edit_member(&ctx, id, em).await; if let Err(e) = r { error!("Mute/Deafen error: {}", e); }; @@ -413,7 +411,7 @@ async fn reply_loop(mut rx: Receiver>, ctx: Context) { } if let Some(reply) = reply.get("message") { let channel = if let Some(id) = get_snowflake(reply, "channel_id") { - ChannelId(id) + ChannelId::new(id) } else { error!("channel_id missing"); continue; @@ -440,84 +438,67 @@ async fn reply_loop(mut rx: Receiver>, ctx: Context) { } if let Some(reply) = reply.get("send") { - if let Err(e) = channel - .send_message(&ctx, |m| { - // Normal content - if let Some(content) = reply.get_str("content") { - m.content(content); - }; - // Reference to another message - if let Some(reference_message) = get_snowflake(reply, "reference_message") { - let reference_channel = get_snowflake(reply, "reference_channel") - .map_or(channel, ChannelId); - m.reference_message((reference_channel, MessageId(reference_message))); - }; - - if let Some(tts) = reply.get_bool("tts") { - m.tts(tts); - }; - - if let Some(embed) = reply.get("embed") { - m.embed(|e| { - if let Some(author) = embed.get("author") { - e.author(|a| { - if let Some(icon_url) = author.get_str("icon_url") { - a.icon_url(icon_url); - }; - if let Some(name) = author.get_str("name") { - a.name(name); - }; - if let Some(url) = author.get_str("url") { - a.url(url); - }; - - a - }); - }; - - if let Some(colour) = embed.get_u64("colour") { - e.colour(colour); - }; - if let Some(description) = embed.get_str("description") { - e.description(description); - }; - - if let Some(fields) = embed.get_array("fields") { - e.fields(fields.iter().filter_map(|v| { - let name = v.get_str("name")?; - let value = v.get_str("value")?; - let inline = v.get_bool("inline").unwrap_or_default(); - Some((name, value, inline)) - })); - }; - if let Some(footer) = embed.get("footer") { - e.footer(|f| { - if let Some(text) = footer.as_str() { - f.text(text); - }; - if let Some(text) = footer.get_str("text") { - f.text(text); - }; - if let Some(icon_url) = footer.get_str("icon_url") { - f.icon_url(icon_url); - }; - - f - }); - }; - - e - }); - }; - - if let Some(reactions) = reply.get("reactions").and_then(to_reactions) { - m.reactions(reactions); + let mut created_message = CreateMessage::default(); + // Normal content + if let Some(content) = reply.get_str("content") { + created_message = created_message.content(content); + }; + // Reference to another message + if let Some(reference_message) = get_snowflake(reply, "reference_message") { + let reference_channel = + get_snowflake(reply, "reference_channel").map_or(channel, ChannelId::new); + created_message = created_message + .reference_message((reference_channel, MessageId::new(reference_message))); + }; + if let Some(tts) = reply.get_bool("tts") { + created_message = created_message.tts(tts); + }; + if let Some(embed) = reply.get("embed") { + let mut created_embed = CreateEmbed::default(); + if let Some(author) = embed.get("author") { + if let Some(name) = author.get_str("name") { + let mut create_embed_author = CreateEmbedAuthor::new(name); + if let Some(icon_url) = author.get_str("icon_url") { + create_embed_author = create_embed_author.icon_url(icon_url); + }; + if let Some(url) = author.get_str("url") { + create_embed_author = create_embed_author.url(url); + }; + created_embed = created_embed.author(create_embed_author); + } + }; + if let Some(colour) = embed.get_u64("colour") { + created_embed = created_embed.colour(colour); + }; + if let Some(description) = embed.get_str("description") { + created_embed = created_embed.description(description); + }; + if let Some(fields) = embed.get_array("fields") { + created_embed = created_embed.fields(fields.iter().filter_map(|v| { + let name = v.get_str("name")?; + let value = v.get_str("value")?; + let inline = v.get_bool("inline").unwrap_or_default(); + Some((name, value, inline)) + })); + }; + if let Some(footer) = embed.get("footer") { + if let Some(text) = footer.as_str() { + let mut created_embed_footer = CreateEmbedFooter::new(text); + if let Some(text) = footer.get_str("text") { + created_embed_footer = created_embed_footer.text(text); + }; + if let Some(icon_url) = footer.get_str("icon_url") { + created_embed_footer = created_embed_footer.icon_url(icon_url); + }; + created_embed = created_embed.footer(created_embed_footer); }; - - m - }) - .await - { + }; + created_message = created_message.embed(created_embed); + }; + if let Some(reactions) = reply.get("reactions").and_then(to_reactions) { + created_message = created_message.reactions(reactions); + }; + if let Err(e) = channel.send_message(&ctx, created_message).await { error!("Discord send error: {}", e); }; }; diff --git a/tremor-connectors/src/impls/discord/utils.rs b/tremor-connectors/src/impls/discord/utils.rs index cd7ea3ca49..ab36fe2f64 100644 --- a/tremor-connectors/src/impls/discord/utils.rs +++ b/tremor-connectors/src/impls/discord/utils.rs @@ -15,8 +15,11 @@ // #![cfg_attr(coverage, no_coverage)] // We need a life discord api for this use serenity::{ model::{ - channel::{Channel, ChannelCategory, GuildChannel, Message, Reaction, ReactionType}, - event::{GuildMembersChunkEvent, ResumedEvent, TypingStartEvent, VoiceServerUpdateEvent}, + channel::{GuildChannel, Message, Reaction, ReactionType}, + event::{ + GuildMemberUpdateEvent, GuildMembersChunkEvent, ResumedEvent, TypingStartEvent, + VoiceServerUpdateEvent, + }, guild::{Emoji, Guild, Member, PartialGuild, Role}, id::{ChannelId, EmojiId, GuildId, MessageId, RoleId}, prelude::{CurrentUser, Presence, User, VoiceState}, @@ -32,8 +35,8 @@ pub(crate) enum Intents { Guilds, /// GuildMembers Grouping GuildMembers, - /// GuildBans Grouping - GuildBans, + /// GuildModeration Grouping + GuildModeration, /// GuildEmojis Grouping GuildEmojis, /// GuildIntegrations Grouping @@ -73,7 +76,7 @@ impl From for GatewayIntents { match intent { Intents::Guilds => GatewayIntents::GUILDS, Intents::GuildMembers => GatewayIntents::GUILD_MEMBERS, - Intents::GuildBans => GatewayIntents::GUILD_BANS, + Intents::GuildModeration => GatewayIntents::GUILD_MODERATION, Intents::GuildEmojis => GatewayIntents::GUILD_EMOJIS_AND_STICKERS, Intents::GuildIntegrations => GatewayIntents::GUILD_INTEGRATIONS, Intents::GuildWebHooks => GatewayIntents::GUILD_WEBHOOKS, @@ -100,12 +103,10 @@ pub(crate) enum DiscordMessage { AddReaction(Reaction), RemoveReaction(Reaction), ChannelCreate(GuildChannel), - ChannelDelete(GuildChannel), - CategoryCreate(ChannelCategory), - CategoryDelete(ChannelCategory), + ChannelDelete(GuildChannel, Option>), ChannelUpdate { - old: Option, - new: Channel, + old: Option, + new: GuildChannel, }, BanAddition { guild_id: GuildId, @@ -117,7 +118,7 @@ pub(crate) enum DiscordMessage { }, GuildCreate { guild: Guild, - is_new: bool, + is_new: Option, }, // GuildDelete { // incomplete: GuildUnavailable, @@ -138,7 +139,8 @@ pub(crate) enum DiscordMessage { }, MemberUpdate { old_if_available: Option, - new: Member, + member: Option, + event: GuildMemberUpdateEvent, }, RoleCreate { new: Role, @@ -189,7 +191,7 @@ pub(crate) enum DiscordMessage { }, VoiceServerUpdate(VoiceServerUpdateEvent), Resume(ResumedEvent), - GuildUnavailable(GuildId), + // GuildUnavailable(GuildId), GuildMembersChunk(GuildMembersChunkEvent), TypingStart(TypingStartEvent), PresenceReplace(Vec), @@ -209,7 +211,7 @@ fn to_reaction(v: &Value) -> Option { v.as_char().map_or_else( || { get_snowflake(v, "id").map(|id| ReactionType::Custom { - id: EmojiId(id), + id: EmojiId::new(id), animated: v.get_bool("animated").unwrap_or_default(), name: v.get_str("name").map(ToString::to_string), }) @@ -300,8 +302,8 @@ mod test { GatewayIntents::GUILD_MEMBERS ); assert_eq!( - GatewayIntents::from(Intents::GuildBans), - GatewayIntents::GUILD_BANS + GatewayIntents::from(Intents::GuildModeration), + GatewayIntents::GUILD_MODERATION ); assert_eq!( GatewayIntents::from(Intents::GuildEmojis),