From 52619c51afb02fa1be2493fa6e460a8293c1e9ac Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Tue, 23 Apr 2024 09:27:13 +0200 Subject: [PATCH] Update gix and related deps (#59) Closes: #58 --- CHANGELOG.md | 3 + Cargo.lock | 272 +++++++++++++++++++++++++------------ Cargo.toml | 8 +- deny.toml | 2 + src/index/sparse.rs | 5 +- src/index/sparse_remote.rs | 72 +++++++--- tests/connect/src/main.rs | 64 +++++---- 7 files changed, 285 insertions(+), 141 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 480458d..fe34e0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate +### Changed +- [PR#59](https://github.com/EmbarkStudios/tame-index/pull/59) updated `gix` -> 0.62, `reqwest` -> 0.12, `http` -> 1.1. + ## [0.10.0] - 2024-03-21 ### Changed - [PR#54](https://github.com/EmbarkStudios/tame-index/pull/54) updated `gix` -> 0.61. diff --git a/Cargo.lock b/Cargo.lock index 7852b7d..a1fd19f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,6 +81,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" + [[package]] name = "bitflags" version = "1.3.2" @@ -365,6 +371,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -399,6 +406,7 @@ checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-io", + "futures-sink", "futures-task", "memchr", "pin-project-lite", @@ -435,9 +443,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "gix" -version = "0.61.0" +version = "0.62.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e0e59a44bf00de058ee98d6ecf3c9ed8f8842c1da642258ae4120d41ded8f7" +checksum = "5631c64fb4cd48eee767bf98a3cbc5c9318ef3bb71074d4c099a2371510282b6" dependencies = [ "gix-actor", "gix-attributes", @@ -563,9 +571,9 @@ dependencies = [ [[package]] name = "gix-config" -version = "0.36.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62129c75e4b6229fe15fb9838cdc00c655e87105b651e4edd7c183fc5288b5d1" +checksum = "7580e05996e893347ad04e1eaceb92e1c0e6a3ffe517171af99bf6b6df0ca6e5" dependencies = [ "bstr", "gix-config-value", @@ -626,9 +634,9 @@ dependencies = [ [[package]] name = "gix-diff" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78e605593c2ef74980a534ade0909c7dc57cca72baa30cbb67d2dda621f99ac4" +checksum = "a5fbc24115b957346cd23fb0f47d830eb799c46c89cdcf2f5acc9bf2938c2d01" dependencies = [ "bstr", "gix-hash", @@ -674,9 +682,9 @@ dependencies = [ [[package]] name = "gix-filter" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd71bf3e64d8fb5d5635d4166ca5a36fe56b292ffff06eab1d93ea47fd5beb89" +checksum = "5c0d1f01af62bfd2fb3dd291acc2b29d4ab3e96ad52a679174626508ce98ef12" dependencies = [ "bstr", "encoding_rs", @@ -695,9 +703,9 @@ dependencies = [ [[package]] name = "gix-fs" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634b8a743b0aae03c1a74ee0ea24e8c5136895efac64ce52b3ea106e1c6f0613" +checksum = "e2184c40e7910529677831c8b481acf788ffd92427ed21fad65b6aa637e631b8" dependencies = [ "gix-features", "gix-utils", @@ -751,9 +759,9 @@ dependencies = [ [[package]] name = "gix-index" -version = "0.31.1" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "549621f13d9ccf325a7de45506a3266af0d08f915181c5687abb5e8669bfd2e6" +checksum = "881ab3b1fa57f497601a5add8289e72a7ae09471fc0b9bbe483b628ae8e418a1" dependencies = [ "bitflags 2.5.0", "bstr", @@ -835,9 +843,9 @@ dependencies = [ [[package]] name = "gix-odb" -version = "0.59.0" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b55378c719693380f66d9dd21ce46721eed2981d8789fc698ec1ada6fa176e" +checksum = "e8bbb43d2fefdc4701ffdf9224844d05b136ae1b9a73c2f90710c8dd27a93503" dependencies = [ "arc-swap", "gix-date", @@ -855,9 +863,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.49.0" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6391aeaa030ad64aba346a9f5c69bb1c4e5c6fb4411705b03b40b49d8614ec30" +checksum = "b58bad27c7677fa6b587aab3a1aca0b6c97373bd371a0a4290677c838c9bcaf1" dependencies = [ "clru", "gix-chunk", @@ -875,9 +883,9 @@ dependencies = [ [[package]] name = "gix-packetline" -version = "0.17.4" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea5cd2b8ecbab2f3a2133686bf241dfc947a744347cfac8806c4ae5769ab931" +checksum = "b70486beda0903b6d5b65dfa6e40585098cdf4e6365ca2dff4f74c387354a515" dependencies = [ "bstr", "faster-hex", @@ -887,9 +895,9 @@ dependencies = [ [[package]] name = "gix-packetline-blocking" -version = "0.17.3" +version = "0.17.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8ef6dd3ea50e26f3bf572e90c034d033c804d340cd1eb386392f184a9ba2f7" +checksum = "c31d42378a3d284732e4d589979930d0d253360eccf7ec7a80332e5ccb77e14a" dependencies = [ "bstr", "faster-hex", @@ -912,9 +920,9 @@ dependencies = [ [[package]] name = "gix-pathspec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a96ed0e71ce9084a471fddfa74e842576a7cbf02fe8bd50388017ac461aed97" +checksum = "ea9f934a111e0efdf93ae06e3648427e60e783099fbebd6a53a7a2ffb10a1e65" dependencies = [ "bitflags 2.5.0", "bstr", @@ -940,9 +948,9 @@ dependencies = [ [[package]] name = "gix-protocol" -version = "0.44.2" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a905cd00946ed8ed6f4f2281f98a889c5b3d38361cd94b8d5a5771d25ab33b99" +checksum = "aed3bb6179835a3250403baa9d7022579e559fc45f2efc416d9de1a14b5acf11" dependencies = [ "bstr", "gix-credentials", @@ -1076,17 +1084,17 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b838b2db8f62c9447d483a4c28d251b67fee32741a82cb4d35e9eb4e9fdc5ab" +checksum = "f924267408915fddcd558e3f37295cc7d6a3e50f8bd8b606cee0808c3915157e" [[package]] name = "gix-transport" -version = "0.41.2" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf8e5f72ec9cad9ee44714b9a4ec7427b540a2418b62111f5e3a715bebe1ed9d" +checksum = "9d2f783b2fe86bf2a8cf1f3b8669d65b01ab4932f32cc0101d3893e1b16a3bd6" dependencies = [ - "base64", + "base64 0.21.7", "bstr", "gix-command", "gix-credentials", @@ -1101,10 +1109,11 @@ dependencies = [ [[package]] name = "gix-traverse" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95aef84bc777025403a09788b1e4815c06a19332e9e5d87a955e1ed7da9bf0cf" +checksum = "f4029ec209b0cc480d209da3837a42c63801dd8548f09c1f4502c60accb62aeb" dependencies = [ + "bitflags 2.5.0", "gix-commitgraph", "gix-date", "gix-hash", @@ -1117,9 +1126,9 @@ dependencies = [ [[package]] name = "gix-url" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0b24f3ecc79a5a53539de9c2e99425d0ef23feacdcf3faac983aa9a2f26849" +checksum = "0db829ebdca6180fbe32be7aed393591df6db4a72dbbc0b8369162390954d1cf" dependencies = [ "bstr", "gix-features", @@ -1131,9 +1140,9 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0066432d4c277f9877f091279a597ea5331f68ca410efc874f0bdfb1cd348f92" +checksum = "35192df7fd0fa112263bad8021e2df7167df4cc2a6e6d15892e1e55621d3d4dc" dependencies = [ "fastrand", "unicode-normalization", @@ -1151,9 +1160,9 @@ dependencies = [ [[package]] name = "gix-worktree" -version = "0.32.0" +version = "0.33.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe78e03af9eec168eb187e05463a981c57f0a915f64b1788685a776bd2ef969c" +checksum = "f06ca5dd164678914fc9280ba9d1ffeb66499ccc16ab1278c513828beee88401" dependencies = [ "bstr", "gix-attributes", @@ -1169,9 +1178,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.25" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" dependencies = [ "bytes", "fnv", @@ -1213,9 +1222,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1224,12 +1233,24 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ "bytes", + "futures-core", "http", + "http-body", "pin-project-lite", ] @@ -1239,48 +1260,61 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "hyper" -version = "0.14.28" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", "http", "hyper", + "hyper-util", "rustls", + "rustls-pki-types", "tokio", "tokio-rustls", + "tower-service", +] + +[[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", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -1488,6 +1522,26 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -1567,21 +1621,24 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" [[package]] name = "reqwest" -version = "0.11.27" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ "async-compression", - "base64", + "base64 0.22.0", "bytes", "encoding_rs", + "futures-channel", "futures-core", "futures-util", "h2", "http", "http-body", + "http-body-util", "hyper", "hyper-rustls", + "hyper-util", "ipnet", "js-sys", "log", @@ -1592,6 +1649,7 @@ dependencies = [ "rustls", "rustls-native-certs", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", @@ -1645,44 +1703,55 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.10" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", "rustls-pemfile", + "rustls-pki-types", "schannel", "security-framework", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64", + "base64 0.22.0", + "rustls-pki-types", ] +[[package]] +name = "rustls-pki-types" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" + [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.102.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" dependencies = [ "ring", + "rustls-pki-types", "untrusted", ] @@ -1716,16 +1785,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "security-framework" version = "2.9.2" @@ -1870,6 +1929,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "2.0.53" @@ -2040,11 +2105,12 @@ dependencies = [ [[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", + "rustls-pki-types", "tokio", ] @@ -2071,6 +2137,28 @@ dependencies = [ "smallvec", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -2083,6 +2171,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-core", ] @@ -2271,9 +2360,12 @@ dependencies = [ [[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 = "winapi" @@ -2449,9 +2541,9 @@ dependencies = [ [[package]] name = "winreg" -version = "0.50.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", "windows-sys 0.48.0", @@ -2476,3 +2568,9 @@ dependencies = [ "quote", "syn", ] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index 5ae6802..352411e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ crossbeam-channel = { version = "0.5", optional = true } # Used to find the location of the local `CARGO_HOME` home = "0.5" # Allows calling crates to provide their own HTTP implementation, keep aligned with reqwest/hyper -http = "0.2" +http = "1.1" # Nicer scanning through bytes memchr = "2.5" rayon = { version = "1.7", optional = true } @@ -59,16 +59,16 @@ twox-hash = { version = "1.6", default-features = false } [dependencies.gix] optional = true -version = "0.61" +version = "0.62" default-features = false features = ["blocking-http-transport-reqwest"] # Keep version aligned with gix-transport [dependencies.reqwest] optional = true -version = "0.11" +version = "0.12" default-features = false -features = ["blocking", "gzip"] +features = ["blocking", "gzip", "http2"] [target.'cfg(unix)'.dependencies] libc = "0.2" diff --git a/deny.toml b/deny.toml index 45e52d7..a568729 100644 --- a/deny.toml +++ b/deny.toml @@ -42,6 +42,8 @@ deny = ["openssl", "curl"] skip = [ # several users of this old version "bitflags@1.3.2", + # irritating transitive dependency + "base64@0.21.7", ] skip-tree = [ # sigh diff --git a/src/index/sparse.rs b/src/index/sparse.rs index 43d595e..a0fd308 100644 --- a/src/index/sparse.rs +++ b/src/index/sparse.rs @@ -97,7 +97,7 @@ impl SparseIndex { name: KrateName<'_>, etag: Option<&str>, lock: &FileLock, - ) -> Result, Error> { + ) -> Result, Error> { use http::header; let url = self.crate_url(name); @@ -166,8 +166,7 @@ impl SparseIndex { } } - const EMPTY: &[u8] = &[]; - Ok(req.body(EMPTY).unwrap()) + Ok(req.body(()).unwrap()) } /// Process the response to a request created by [`Self::make_remote_request`] diff --git a/src/index/sparse_remote.rs b/src/index/sparse_remote.rs index fd2dd10..2a217e0 100644 --- a/src/index/sparse_remote.rs +++ b/src/index/sparse_remote.rs @@ -33,9 +33,22 @@ impl RemoteSparseIndex { lock: &FileLock, ) -> Result, Error> { let req = self.index.make_remote_request(name, None, lock)?; - let req = req.try_into()?; - - let res = self.client.execute(req)?; + let ( + http::request::Parts { + method, + uri, + version, + headers, + .. + }, + _, + ) = req.into_parts(); + + let mut req = self.client.request(method, uri.to_string()); + req = req.version(version); + req = req.headers(headers); + + let res = self.client.execute(req.build()?)?; let mut builder = http::Response::builder() .status(res.status()) @@ -130,11 +143,24 @@ impl AsyncRemoteSparseIndex { write_cache_entry: bool, lock: &FileLock, ) -> Result, Error> { - let req = self - .index - .make_remote_request(name, None, lock)? - .try_into()?; - let res = Self::exec_request(&self.client, req).await?; + let req = self.index.make_remote_request(name, None, lock)?; + + let ( + http::request::Parts { + method, + uri, + version, + headers, + .. + }, + _, + ) = req.into_parts(); + + let mut req = self.client.request(method, uri.to_string()); + req = req.version(version); + req = req.headers(headers); + + let res = Self::exec_request(&self.client, req.build()?).await?; self.index .parse_remote_response(name, res, write_cache_entry, lock) @@ -207,16 +233,33 @@ impl AsyncRemoteSparseIndex { return Default::default(); }; - let create_req = |kname: &str| -> Result, Error> { + let create_req = |kname: &str| -> Result { let name = kname.try_into()?; - self.index.make_remote_request(name, None, lock) + let req = self.index.make_remote_request(name, None, lock)?; + + let ( + http::request::Parts { + method, + uri, + version, + headers, + .. + }, + _, + ) = req.into_parts(); + + let mut req = self.client.request(method, uri.to_string()); + req = req.version(version); + req = req.headers(headers); + + Ok(req.build()?) }; let mut results = BTreeMap::new(); { let result; - match create_req(&prep_krate).and_then(|req| Ok(req.try_into()?)) { + match create_req(&prep_krate) { Ok(req) => match Self::exec_request(&self.client, req).await { Ok(res) => { result = self.index.parse_remote_response( @@ -237,12 +280,7 @@ impl AsyncRemoteSparseIndex { let mut tasks = tokio::task::JoinSet::new(); for kname in krates { - match kname.as_str().try_into().and_then(|name| { - Ok(self - .index - .make_remote_request(name, None, lock)? - .try_into()?) - }) { + match create_req(kname.as_str()) { Ok(req) => { let client = self.client.clone(); tasks.spawn(async move { diff --git a/tests/connect/src/main.rs b/tests/connect/src/main.rs index cd23935..24c8485 100644 --- a/tests/connect/src/main.rs +++ b/tests/connect/src/main.rs @@ -48,51 +48,55 @@ fn main() { ts = mt; } - let proc_count: usize = if std::env::var_os("CI").is_none() { - // The connection count should be roughly the same as the processor count - let stdout = std::process::Command::new("nproc").output().unwrap().stdout; - - std::str::from_utf8(&stdout) - .unwrap() - .trim() - .parse() - .unwrap() - } else { - 30 - }; - - let max = proc_count + (proc_count as f32 * 0.05).floor() as usize; + // At this moment, crates.io should resolve to 4 IPv4 addresses, so we expect + // those 4, as well as the TLS connection for test in ["reuses_connection", "async_reuses_connection"] { + let path = format!("/tmp/tame-index-connection-trace-{test}"); assert!( std::process::Command::new("strace") - .args([ - "-f", - "-e", - "trace=connect", - "-o", - "/tmp/tame-index-connection-trace" - ]) + .args(["-f", "-e", "trace=connect", "-o", &path]) .arg(&latest) .arg("--exact") .arg(format!("remote::{test}")) + .arg("--nocapture") + .env("RUST_LOG", "debug") .status() .unwrap() .success(), "failed to strace test" ); - let trace = std::fs::read_to_string("/tmp/tame-index-connection-trace") - .expect("failed to read strace output"); + let trace = std::fs::read_to_string(path).expect("failed to read strace output"); - let connection_counts = trace + let (connect_count, tls_count) = trace .lines() - .filter(|line| line.contains("connect(")) - .count(); + .filter_map(|line| { + if !line.contains("connect(") { + return None; + } - assert!( - connection_counts <= max, - "connection syscalls ({connection_counts}) should be lower than {max}" - ); + if !line.contains("sa_family=AF_INET") { + return None; + } + + if line.contains("sin_port=htons(0)") && line.ends_with(" = 0") { + Some((1, 0)) + } else if line.contains("sin_port=htons(443)") + && line.ends_with(" = -1 EINPROGRESS (Operation now in progress)") + { + Some((0, 1)) + } else { + None + } + }) + .fold((0, 0), |acc, i| (acc.0 + i.0, acc.1 + i.1)); + + if connect_count != 4 || tls_count != 1 { + if std::env::var_os("CI").is_some() { + eprintln!("{trace}"); + } + panic!("should have established 4 (but got {connect_count}) connections and 1 (but got {tls_count}) TLS connection"); + } } }