From c7e966cf2b94afdf825e0aec7893c1a6cc6a8102 Mon Sep 17 00:00:00 2001 From: Kevin Flansburg Date: Mon, 19 Aug 2024 11:15:05 -0400 Subject: [PATCH] Remove HeaderExt and AbortSignalExt (#621) * Remove HeaderExt Closes #617 * Fix deprecation warnings * feature --- Cargo.lock | 273 +++++++++++++++++------------ examples/digest/src/lib.rs | 6 +- worker-sys/Cargo.toml | 2 +- worker-sys/src/ext.rs | 4 - worker-sys/src/ext/abort_signal.rs | 42 ----- worker-sys/src/ext/headers.rs | 42 ----- worker/Cargo.toml | 2 +- worker/src/abort.rs | 1 - worker/src/cache.rs | 8 +- worker/src/global.rs | 8 +- worker/src/headers.rs | 7 - worker/src/http/header.rs | 3 +- worker/src/http/request.rs | 12 +- worker/src/request.rs | 29 ++- worker/src/request_init.rs | 12 +- worker/src/response.rs | 4 +- 16 files changed, 204 insertions(+), 251 deletions(-) delete mode 100644 worker-sys/src/ext/abort_signal.rs delete mode 100644 worker-sys/src/ext/headers.rs diff --git a/Cargo.lock b/Cargo.lock index 4c8462f9..d163d044 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,18 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -124,7 +136,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -200,7 +212,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -319,9 +331,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.7" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -351,12 +363,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.7" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" +checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] @@ -413,9 +426,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.13" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ "clap_builder", "clap_derive", @@ -423,9 +436,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.13" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", @@ -442,7 +455,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -507,15 +520,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] @@ -620,7 +633,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -631,7 +644,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -694,7 +707,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -757,14 +770,14 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "filetime" -version = "0.2.23" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", - "windows-sys 0.52.0", + "libredox", + "windows-sys 0.59.0", ] [[package]] @@ -853,7 +866,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -943,7 +956,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.3.0", + "indexmap 2.4.0", "slab", "tokio", "tokio-util", @@ -961,6 +974,10 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] [[package]] name = "heck" @@ -1194,9 +1211,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -1250,9 +1267,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -1282,9 +1299,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libredox" @@ -1294,6 +1311,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.6.0", "libc", + "redox_syscall 0.5.3", ] [[package]] @@ -1386,6 +1404,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minicov" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169" +dependencies = [ + "cc", + "walkdir", +] + [[package]] name = "miniz_oxide" version = "0.7.4" @@ -1397,9 +1425,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi 0.3.9", "libc", @@ -1474,9 +1502,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.2" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] @@ -1510,7 +1538,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -1657,7 +1685,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -1736,7 +1764,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -2103,9 +2131,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.204" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] @@ -2134,13 +2162,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -2154,9 +2182,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.122" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ "itoa", "memchr", @@ -2222,6 +2250,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -2322,9 +2356,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -2377,15 +2411,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fcd239983515c23a32fb82099f97d0b11b8c72f654ed659363a95c3dad7a53" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2405,7 +2439,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -2467,9 +2501,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", @@ -2491,7 +2525,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -2602,7 +2636,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.4.0", "serde", "serde_spanned", "toml_datetime", @@ -2615,7 +2649,7 @@ version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.4.0", "serde", "serde_spanned", "toml_datetime", @@ -2637,15 +2671,15 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -2666,7 +2700,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -2832,9 +2866,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72139d247e5f97a3eff96229a7ae85ead5328a39efe76f8bf5a06313d505b6ea" +checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" dependencies = [ "base64 0.22.1", "flate2", @@ -2911,9 +2945,9 @@ dependencies = [ [[package]] name = "walrus" -version = "0.20.3" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c03529cd0c4400a2449f640d2f27cd1b48c3065226d15e26d98e4429ab0adb7" +checksum = "467611cafbc8a84834b77d2b4bb191fd2f5769752def8340407e924390c6883b" dependencies = [ "anyhow", "gimli 0.26.2", @@ -2922,7 +2956,7 @@ dependencies = [ "log", "walrus-macro", "wasm-encoder", - "wasmparser 0.80.2", + "wasmparser 0.212.0", ] [[package]] @@ -2960,37 +2994,38 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-cli-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca821da8c1ae6c87c5e94493939a206daa8587caff227c6032e0061a3d80817f" +checksum = "1a7f49ca6e7da74d53d6d716b868828a47d1c3808a8f676e2104fadd3b9874bb" dependencies = [ "anyhow", - "base64 0.21.7", + "base64 0.22.1", "log", "rustc-demangle", "serde_json", @@ -3007,19 +3042,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-externref-xform" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "102582726b35a30d53157fbf8de3d0f0fed4c40c0c7951d69a034e9ef01da725" +checksum = "2c1f37f2705f4177cc87e5b2763115d078d39e4843e351438b34b085d53a8930" dependencies = [ "anyhow", "walrus", + "wasm-bindgen-wasm-conventions", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -3029,9 +3065,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3039,41 +3075,43 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-multi-value-xform" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3498e4799f43523d780ceff498f04d882a8dbc9719c28020034822e5952f32a4" +checksum = "2864e3f221fef3869992b541b238e55f53f99b43c4ce220422a6e1ec9458dc21" dependencies = [ "anyhow", "walrus", + "wasm-bindgen-wasm-conventions", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasm-bindgen-test" -version = "0.3.42" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9bf62a58e0780af3e852044583deee40983e5886da43a271dd772379987667b" +checksum = "68497a05fb21143a08a7d24fc81763384a3072ee43c44e86aad1744d6adef9d9" dependencies = [ "console_error_panic_hook", "js-sys", + "minicov", "scoped-tls", "wasm-bindgen", "wasm-bindgen-futures", @@ -3082,20 +3120,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.42" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" +checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] name = "wasm-bindgen-threads-xform" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d5add359b7f7d09a55299a9d29be54414264f2b8cf84f8c8fda5be9269b5dd9" +checksum = "7e9ca60ee029d64cf6f63a630050935360c3877844f6de38e8287afb8f1d2715" dependencies = [ "anyhow", "walrus", @@ -3104,19 +3142,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-wasm-conventions" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c04e3607b810e76768260db3a5f2e8beb477cb089ef8726da85c8eb9bd3b575" +checksum = "6e429e00149de60ffc768e6e1f0563778a237e7c11cc01801edf9734bff8161f" dependencies = [ "anyhow", + "leb128", + "log", "walrus", + "wasmparser 0.212.0", ] [[package]] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea966593c8243a33eb4d643254eb97a69de04e89462f46cf6b4f506aae89b3a" +checksum = "771c49db324f195f221796bf3868247dd91cca4a85604dcb3729213e439abe59" dependencies = [ "anyhow", "log", @@ -3126,9 +3167,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.29.0" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" +checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" dependencies = [ "leb128", ] @@ -3181,26 +3222,34 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.80.2" +version = "0.205.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "449167e2832691a1bff24cde28d2804e90e09586a448c8e76984792c44334a6b" +checksum = "1d457bb52804242e09d55a306e53ddbc65d1d29ed83db6a4eea3ed412ee0cfdf" +dependencies = [ + "bitflags 2.6.0", + "indexmap 2.4.0", + "semver", +] [[package]] name = "wasmparser" -version = "0.205.0" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d457bb52804242e09d55a306e53ddbc65d1d29ed83db6a4eea3ed412ee0cfdf" +checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" dependencies = [ + "ahash", "bitflags 2.6.0", - "indexmap 2.3.0", + "hashbrown 0.14.5", + "indexmap 2.4.0", "semver", + "serde", ] [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -3453,7 +3502,7 @@ checksum = "a3db34c7688c161ed7bd1b2f8055dca9fb2c15201db58754e9c48a0805f32e5f" dependencies = [ "anyhow", "id-arena", - "indexmap 2.3.0", + "indexmap 2.4.0", "log", "semver", "serde", @@ -3519,7 +3568,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-macro-support", @@ -3550,7 +3599,7 @@ dependencies = [ "async-trait", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-macro-support", @@ -3628,7 +3677,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -3648,7 +3697,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.75", ] [[package]] @@ -3667,7 +3716,7 @@ dependencies = [ "displaydoc", "flate2", "hmac", - "indexmap 2.3.0", + "indexmap 2.4.0", "lzma-rs", "memchr", "pbkdf2", diff --git a/examples/digest/src/lib.rs b/examples/digest/src/lib.rs index a8bfb724..a558d268 100644 --- a/examples/digest/src/lib.rs +++ b/examples/digest/src/lib.rs @@ -29,9 +29,9 @@ async fn main(_req: Request, _env: Env, _ctx: Context) -> Result { } fn str_to_readable_stream(value: &str) -> web_sys::ReadableStream { - let mut req_init = web_sys::RequestInit::new(); - req_init.method("POST"); - req_init.body(Some(&JsValue::from_str(value))); + let req_init = web_sys::RequestInit::new(); + req_init.set_method("POST"); + req_init.set_body(&JsValue::from_str(value)); let req = web_sys::Request::new_with_str_and_init("http://internal", &req_init).unwrap(); req.body().unwrap() } diff --git a/worker-sys/Cargo.toml b/worker-sys/Cargo.toml index 81043b5c..522c0f76 100644 --- a/worker-sys/Cargo.toml +++ b/worker-sys/Cargo.toml @@ -13,7 +13,7 @@ wasm-bindgen.workspace = true cfg-if = "1.0.0" [dependencies.web-sys] -version = "0.3.63" +version = ">=0.3.70" features = [ "ReadableStream", "WritableStream", diff --git a/worker-sys/src/ext.rs b/worker-sys/src/ext.rs index 014731af..d7548423 100644 --- a/worker-sys/src/ext.rs +++ b/worker-sys/src/ext.rs @@ -1,16 +1,12 @@ mod abort_controller; -mod abort_signal; mod cache_storage; -mod headers; mod request; mod response; mod response_init; mod websocket; pub use abort_controller::*; -pub use abort_signal::*; pub use cache_storage::*; -pub use headers::*; pub use request::*; pub use response::*; pub use response_init::*; diff --git a/worker-sys/src/ext/abort_signal.rs b/worker-sys/src/ext/abort_signal.rs deleted file mode 100644 index e88e6e49..00000000 --- a/worker-sys/src/ext/abort_signal.rs +++ /dev/null @@ -1,42 +0,0 @@ -use wasm_bindgen::prelude::*; - -mod glue { - use super::*; - - #[wasm_bindgen] - extern "C" { - #[wasm_bindgen] - pub type AbortSignal; - - #[wasm_bindgen(method, catch, getter)] - pub fn reason(this: &AbortSignal) -> Result; - - #[wasm_bindgen(static_method_of=AbortSignal, catch)] - pub fn abort() -> Result; - - #[wasm_bindgen(static_method_of=AbortSignal, js_name=abort, catch)] - pub fn abort_with_reason(reason: &JsValue) -> Result; - } -} - -pub trait AbortSignalExt { - fn reason(&self) -> JsValue; - - fn abort() -> web_sys::AbortSignal; - - fn abort_with_reason(reason: &JsValue) -> web_sys::AbortSignal; -} - -impl AbortSignalExt for web_sys::AbortSignal { - fn reason(&self) -> JsValue { - self.unchecked_ref::().reason().unwrap() - } - - fn abort() -> web_sys::AbortSignal { - glue::AbortSignal::abort().unwrap() - } - - fn abort_with_reason(reason: &JsValue) -> web_sys::AbortSignal { - glue::AbortSignal::abort_with_reason(reason).unwrap() - } -} diff --git a/worker-sys/src/ext/headers.rs b/worker-sys/src/ext/headers.rs deleted file mode 100644 index ebed105f..00000000 --- a/worker-sys/src/ext/headers.rs +++ /dev/null @@ -1,42 +0,0 @@ -use wasm_bindgen::prelude::*; - -mod glue { - use super::*; - - #[wasm_bindgen] - extern "C" { - #[wasm_bindgen(extends=js_sys::Object)] - pub type Headers; - - #[wasm_bindgen(method, catch)] - pub fn entries(this: &Headers) -> Result; - - #[wasm_bindgen(method, catch)] - pub fn keys(this: &Headers) -> Result; - - #[wasm_bindgen(method, catch)] - pub fn values(this: &Headers) -> Result; - } -} - -pub trait HeadersExt { - fn entries(&self) -> Result; - - fn keys(&self) -> Result; - - fn values(&self) -> Result; -} - -impl HeadersExt for web_sys::Headers { - fn entries(&self) -> Result { - self.unchecked_ref::().entries() - } - - fn keys(&self) -> Result { - self.unchecked_ref::().keys() - } - - fn values(&self) -> Result { - self.unchecked_ref::().values() - } -} diff --git a/worker/Cargo.toml b/worker/Cargo.toml index 6c8db65d..2d55e280 100644 --- a/worker/Cargo.toml +++ b/worker/Cargo.toml @@ -45,7 +45,7 @@ version = "0.8.4" default-features = false [dependencies.web-sys] -version = "0.3.63" +version = ">=0.3.70" features = [ "File", "WorkerGlobalScope", diff --git a/worker/src/abort.rs b/worker/src/abort.rs index ad4d69c1..220b4b8b 100644 --- a/worker/src/abort.rs +++ b/worker/src/abort.rs @@ -1,7 +1,6 @@ use std::ops::Deref; use wasm_bindgen::JsValue; -use worker_sys::ext::{AbortControllerExt, AbortSignalExt}; /// An interface that allows you to abort in-flight [Fetch](crate::Fetch) requests. #[derive(Debug)] diff --git a/worker/src/cache.rs b/worker/src/cache.rs index 54d962c3..61b257f0 100644 --- a/worker/src/cache.rs +++ b/worker/src/cache.rs @@ -103,8 +103,8 @@ impl Cache { key: K, ignore_method: bool, ) -> Result> { - let mut options = web_sys::CacheQueryOptions::new(); - options.ignore_method(ignore_method); + let options = web_sys::CacheQueryOptions::new(); + options.set_ignore_method(ignore_method); let promise = match key.into() { CacheKey::Url(url) => self @@ -136,8 +136,8 @@ impl Cache { key: K, ignore_method: bool, ) -> Result { - let mut options = web_sys::CacheQueryOptions::new(); - options.ignore_method(ignore_method); + let options = web_sys::CacheQueryOptions::new(); + options.set_ignore_method(ignore_method); let promise = match key.into() { CacheKey::Url(url) => self diff --git a/worker/src/global.rs b/worker/src/global.rs index 39a5d50e..5a33635c 100644 --- a/worker/src/global.rs +++ b/worker/src/global.rs @@ -31,8 +31,8 @@ impl Fetch { } async fn fetch_with_str(url: &str, signal: Option<&AbortSignal>) -> Result { - let mut init = web_sys::RequestInit::new(); - init.signal(signal.map(|x| x.deref())); + let init = web_sys::RequestInit::new(); + init.set_signal(signal.map(|x| x.deref())); let worker: web_sys::WorkerGlobalScope = js_sys::global().unchecked_into(); let promise = worker.fetch_with_str_and_init(url, &init); @@ -42,8 +42,8 @@ async fn fetch_with_str(url: &str, signal: Option<&AbortSignal>) -> Result) -> Result { - let mut init = web_sys::RequestInit::new(); - init.signal(signal.map(|x| x.deref())); + let init = web_sys::RequestInit::new(); + init.set_signal(signal.map(|x| x.deref())); let worker: web_sys::WorkerGlobalScope = js_sys::global().unchecked_into(); let req = request.inner(); diff --git a/worker/src/headers.rs b/worker/src/headers.rs index dba973a0..e2c2bbdb 100644 --- a/worker/src/headers.rs +++ b/worker/src/headers.rs @@ -9,7 +9,6 @@ use std::{ use http::{header::HeaderName, HeaderMap, HeaderValue}; use js_sys::Array; use wasm_bindgen::JsValue; -use worker_sys::ext::HeadersExt; /// A [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) representation used in /// Request and Response objects. @@ -65,8 +64,6 @@ impl Headers { pub fn entries(&self) -> HeaderIterator { self.0 .entries() - // Header.entries() doesn't error: https://developer.mozilla.org/en-US/docs/Web/API/Headers/entries - .unwrap() .into_iter() // The entries iterator.next() will always return a proper value: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols .map((|a| a.unwrap().into()) as F1) @@ -79,8 +76,6 @@ impl Headers { pub fn keys(&self) -> impl Iterator { self.0 .keys() - // Header.keys() doesn't error: https://developer.mozilla.org/en-US/docs/Web/API/Headers/keys - .unwrap() .into_iter() // The keys iterator.next() will always return a proper value containing a string .map(|a| a.unwrap().as_string().unwrap()) @@ -91,8 +86,6 @@ impl Headers { pub fn values(&self) -> impl Iterator { self.0 .values() - // Header.values() doesn't error: https://developer.mozilla.org/en-US/docs/Web/API/Headers/values - .unwrap() .into_iter() // The values iterator.next() will always return a proper value containing a string .map(|a| a.unwrap().as_string().unwrap()) diff --git a/worker/src/http/header.rs b/worker/src/http/header.rs index 09c76c2e..a47bbca9 100644 --- a/worker/src/http/header.rs +++ b/worker/src/http/header.rs @@ -1,14 +1,13 @@ use crate::Result; use http::{HeaderMap, HeaderName, HeaderValue}; use js_sys::Array; -use worker_sys::ext::HeadersExt; pub(crate) fn header_map_from_web_sys_headers( from_headers: web_sys::Headers, to_headers: &mut HeaderMap, ) -> Result<()> { // Header.entries() doesn't error: https://developer.mozilla.org/en-US/docs/Web/API/Headers/entries - for res in from_headers.entries()?.into_iter() { + for res in from_headers.entries().into_iter() { // The entries iterator.next() will always return a proper value: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols let a: Array = res?.into(); // The entries iterator always returns an array[2] of strings diff --git a/worker/src/http/request.rs b/worker/src/http/request.rs index 9acbe44b..19936e28 100644 --- a/worker/src/http/request.rs +++ b/worker/src/http/request.rs @@ -50,17 +50,17 @@ pub fn from_wasm(req: web_sys::Request) -> Result> { pub fn to_wasm + 'static>( mut req: http::Request, ) -> Result { - let mut init = web_sys::RequestInit::new(); - init.method(req.method().as_str()); + let init = web_sys::RequestInit::new(); + init.set_method(req.method().as_str()); let headers = web_sys_headers_from_header_map(req.headers())?; - init.headers(headers.as_ref()); + init.set_headers(headers.as_ref()); let uri = req.uri().to_string(); let signal = req.extensions_mut().remove::(); - init.signal(signal.as_ref().map(|s| s.inner())); + init.set_signal(signal.as_ref().map(|s| s.inner())); if let Some(redirect) = req.extensions_mut().remove::() { - init.redirect(redirect.into()); + init.set_redirect(redirect.into()); } if let Some(cf) = req.extensions_mut().remove::() { @@ -81,7 +81,7 @@ pub fn to_wasm + 'static>( if !body.is_end_stream() { let readable_stream = wasm_streams::ReadableStream::from_stream(BodyStream::new(body)).into_raw(); - init.body(Some(readable_stream.as_ref())); + init.set_body(readable_stream.as_ref()); } Ok(web_sys::Request::new_with_str_and_init(&uri, &init)?) diff --git a/worker/src/request.rs b/worker/src/request.rs index 3f24918d..6be8a7b8 100644 --- a/worker/src/request.rs +++ b/worker/src/request.rs @@ -86,21 +86,20 @@ impl TryFrom<&Request> for web_sys::Request { impl Request { /// Construct a new `Request` with an HTTP Method. pub fn new(uri: &str, method: Method) -> Result { - web_sys::Request::new_with_str_and_init( - uri, - web_sys::RequestInit::new().method(method.as_ref()), - ) - .map(|req| { - let mut req: Request = req.into(); - req.immutable = false; - req - }) - .map_err(|e| { - Error::JsError( - e.as_string() - .unwrap_or_else(|| "invalid URL or method for Request".to_string()), - ) - }) + let init = web_sys::RequestInit::new(); + init.set_method(method.as_ref()); + web_sys::Request::new_with_str_and_init(uri, &init) + .map(|req| { + let mut req: Request = req.into(); + req.immutable = false; + req + }) + .map_err(|e| { + Error::JsError( + e.as_string() + .unwrap_or_else(|| "invalid URL or method for Request".to_string()), + ) + }) } /// Construct a new `Request` with a `RequestInit` configuration. diff --git a/worker/src/request_init.rs b/worker/src/request_init.rs index e7ae9651..6c0954e4 100644 --- a/worker/src/request_init.rs +++ b/worker/src/request_init.rs @@ -57,11 +57,13 @@ impl RequestInit { impl From<&RequestInit> for web_sys::RequestInit { fn from(req: &RequestInit) -> Self { - let mut inner = web_sys::RequestInit::new(); - inner.headers(req.headers.as_ref()); - inner.method(req.method.as_ref()); - inner.redirect(req.redirect.into()); - inner.body(req.body.as_ref()); + let inner = web_sys::RequestInit::new(); + inner.set_headers(req.headers.as_ref()); + inner.set_method(req.method.as_ref()); + inner.set_redirect(req.redirect.into()); + if let Some(body) = req.body.as_ref() { + inner.set_body(body); + } // set the Cloudflare-specific `cf` property on FFI RequestInit let r = ::js_sys::Reflect::set( diff --git a/worker/src/response.rs b/worker/src/response.rs index 2ec3bdfb..cf3c7359 100644 --- a/worker/src/response.rs +++ b/worker/src/response.rs @@ -533,8 +533,8 @@ impl ResponseBuilder { impl From for web_sys::ResponseInit { fn from(init: ResponseBuilder) -> Self { let mut edge_init = web_sys::ResponseInit::new(); - edge_init.status(init.status_code); - edge_init.headers(&init.headers.0); + edge_init.set_status(init.status_code); + edge_init.set_headers(&init.headers.0); if let Some(websocket) = &init.websocket { edge_init .websocket(websocket.as_ref())