diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3d6f86dc..02d4a1ef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,6 +41,27 @@ jobs: with: command: doc args: --no-deps --all-features --document-private-items + + build_versions: + strategy: + matrix: + rust: [stable, beta, 1.61.0] + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + - uses: Swatinem/rust-cache@v1 + - uses: actions-rs/cargo@v1 + with: + command: build + - uses: actions-rs/cargo@v1 + with: + command: build + build_and_test: name: Test runs-on: ubuntu-latest @@ -76,7 +97,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --no-default-features --features "${{ matrix.tls }} ${{ matrix.feature }}" + args: --no-default-features --features "testdeps ${{ matrix.tls }} ${{ matrix.feature }}" cargo-deny: diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d5a66ce..098fd7c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,41 @@ +# Unreleased + +# 2.9.6 + +## Fixed + + * `hootbin` is optional dep. Tests must be run with feature `testdeps` (#729) + * Exclude script files from cargo package (#728) + +# 2.9.5 + +## Fixed + + * Update deps (`cookie` 0.18, `cookie_store` 0.21, unpin `url`). (#722) + +# 2.9.4 + +## Fixed + + * MSRV 1.61 with CI tests + +# 2.9.3 + +## Fixed + + * docs.rs docs + +# 2.9.2 + +## Added + + * Replace dependency on httpbin.org for tests/doc-tests. (#703) + +## Fixed + + * Remove Header struct that never should have been exported. (#696) + * Update deps (rustls 0.22) (#690) + # 2.9.1 ## Fixed diff --git a/Cargo.lock b/Cargo.lock index af5aedb2..e7827823 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,9 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -33,16 +33,21 @@ dependencies = [ ] [[package]] -name = "autocfg" -version = "1.1.0" +name = "atty" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] [[package]] name = "base64" -version = "0.21.4" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bitflags" @@ -52,31 +57,25 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "brotli-decompressor" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da74e2b81409b1b743f8f0c62cc6254afefb8b8e50bbfe3735550f7aeefa3448" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", ] -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -101,9 +100,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cookie" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" +checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" dependencies = [ "percent-encoding", "time", @@ -112,9 +111,9 @@ dependencies = [ [[package]] name = "cookie_store" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387461abbc748185c3a6e1673d826918b450b87ff22639429c694619a83b6cf6" +checksum = "4934e6b7e8419148b6ef56950d277af8561060b56afd59e2aadf98b59fce6baa" dependencies = [ "cookie", "idna", @@ -129,9 +128,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -139,9 +138,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "crc32fast" @@ -154,9 +153,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] [[package]] name = "encoding_rs" @@ -169,36 +171,31 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ + "atty", "humantime", - "is-terminal", "log", "regex", "termcolor", ] [[package]] -name = "errno" -version = "0.3.3" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "errno" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] @@ -209,9 +206,9 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -240,24 +237,61 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hoot" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fceae3b65325d8086333faa87d165c595464b57a50963911a5a2c1ee87cd4e56" +dependencies = [ + "httparse", + "log", +] + +[[package]] +name = "hootbin" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebcf9e17911ae109a3abe00cd094ff6a5d36e36a10694b7db827fdf30d36c1b8" +dependencies = [ + "fastrand", + "hoot", + "serde", + "serde_json", + "thiserror", +] [[package]] name = "http" @@ -281,6 +315,12 @@ dependencies = [ "itoa", ] +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + [[package]] name = "humantime" version = "2.1.0" @@ -289,9 +329,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "idna" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -299,39 +339,19 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys", -] - [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "js-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" -dependencies = [ - "wasm-bindgen", -] +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "lazy_static" @@ -341,15 +361,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.148" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "linux-raw-sys" -version = "0.4.7" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "log" @@ -359,15 +379,15 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.6.3" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -390,19 +410,25 @@ dependencies = [ "tempfile", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.2", "cfg-if", "foreign-types", "libc", @@ -430,9 +456,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -442,48 +468,45 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" + +[[package]] +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "regex" -version = "1.9.5" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -493,9 +516,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.8" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -504,104 +527,104 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "ring" -version = "0.16.20" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys 0.48.0", ] [[package]] name = "rustix" -version = "0.38.15" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f9da0cbd88f9f09e7814e388301c8414c51c62aa6ce1e4b5c551d49d96e531" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.7" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" 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.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4" dependencies = [ "base64", + "rustls-pki-types", ] +[[package]] +name = "rustls-pki-types" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a716eb65e3158e90e17cd93d855216e27bde02745ab842f2cab4a39dba1bacf" + [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ "ring", + "rustls-pki-types", "untrusted", ] [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "schannel" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "sct" -version = "0.7.0" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "ring", - "untrusted", + "windows-sys 0.52.0", ] [[package]] @@ -629,18 +652,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.188" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -649,9 +672,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -671,15 +694,21 @@ dependencies = [ [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "subtle" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.37" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -688,34 +717,55 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.3.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] +[[package]] +name = "thiserror" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "time" -version = "0.3.29" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -729,10 +779,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -753,9 +804,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -774,13 +825,13 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.9.1" +version = "2.9.6" dependencies = [ "base64", "brotli-decompressor", @@ -789,6 +840,7 @@ dependencies = [ "encoding_rs", "env_logger", "flate2", + "hootbin", "http 0.2.11", "http 1.0.0", "log", @@ -797,6 +849,7 @@ dependencies = [ "rustls", "rustls-native-certs", "rustls-pemfile", + "rustls-pki-types", "rustls-webpki", "serde", "serde_json", @@ -807,9 +860,9 @@ dependencies = [ [[package]] name = "url" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -829,75 +882,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "wasm-bindgen" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "wasm-bindgen-macro" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "web-sys" -version = "0.3.64" +name = "webpki-roots" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" dependencies = [ - "js-sys", - "wasm-bindgen", + "rustls-pki-types", ] -[[package]] -name = "webpki-roots" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" - [[package]] name = "winapi" version = "0.3.9" @@ -935,7 +933,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", ] [[package]] @@ -944,13 +951,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -959,38 +981,86 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[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 9db57653..9375234e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ureq" -version = "2.9.1" +version = "2.9.6" authors = ["Martin Algesten ", "Jacob Hoffman-Andrews "] description = "Simple, safe HTTP client" license = "MIT OR Apache-2.0" @@ -9,16 +9,21 @@ readme = "README.md" keywords = ["web", "request", "https", "http", "client"] categories = ["web-programming::http-client"] edition = "2018" +exclude = ["/cargo_deny.sh", "/deny.toml", "/test.sh"] + + +# MSRV +rust-version = "1.61" [package.metadata.docs.rs] -# features = ["tls", "dep:native-tls", "json", "charset", "cookies", "socks-proxy", "gzip", "brotli", "http-interop"] -features = "all" +features = ["tls", "native-tls", "json", "charset", "cookies", "socks-proxy", "gzip", "brotli", "http-interop"] rustdoc-args = ["--cfg", "docsrs"] [features] default = ["tls", "gzip"] -tls = ["dep:webpki", "dep:webpki-roots", "dep:rustls"] +tls = ["dep:webpki", "dep:webpki-roots", "dep:rustls", "dep:rustls-pki-types"] native-certs = ["dep:rustls-native-certs"] +native-tls = ["dep:native-tls"] json = ["dep:serde", "dep:serde_json"] charset = ["dep:encoding_rs"] cookies = ["dep:cookie", "dep:cookie_store"] @@ -31,33 +36,39 @@ http-interop = ["dep:http-02"] # http-crate is for http crate version 1.0 (full release) http-crate = ["dep:http"] proxy-from-env = [] +# Doc tests require hootbin. +testdeps = ["dep:hootbin"] [dependencies] base64 = "0.21" -cookie = { version = "0.17", default-features = false, optional = true } +cookie = { version = "0.18", default-features = false, optional = true } once_cell = "1" url = "2" socks = { version = "0.3", optional = true } serde = { version = "1", optional = true } serde_json = { version = ">=1.0.97", optional = true } encoding_rs = { version = "0.8", optional = true } -cookie_store = { version = "0.20", optional = true, default-features = false, features = ["preserve_order"] } +cookie_store = { version = "0.21", optional = true, default-features = false, features = ["preserve_order"] } log = "0.4" -webpki = { package = "rustls-webpki", version = "0.101", optional = true } -webpki-roots = { version = "0.25", optional = true } -rustls = { version = "0.21.6", optional = true } -rustls-native-certs = { version = "0.6", optional = true } +webpki = { package = "rustls-webpki", version = "0.102", optional = true } +webpki-roots = { version = "0.26", optional = true } +rustls = { version = "0.22.0", optional = true } +rustls-pki-types = { version = "1", optional = true } +rustls-native-certs = { version = "0.7", optional = true } native-tls = { version = "0.2", optional = true } flate2 = { version = "1.0.22", optional = true } brotli-decompressor = { version = "2.3.2", optional = true } http-02 = { package = "http", version = "0.2", optional = true } http = { version = "1.0", optional = true } +# This can't be in dev-dependencies due to doc tests. +hootbin = { version = "0.1.5", optional = true } + [dev-dependencies] serde = { version = "1", features = ["derive"] } -env_logger = "0.10" -rustls = { version = ">=0.21.6, <0.22", features = ["dangerous_configuration"] } -rustls-pemfile = { version = "1.0" } +env_logger = "<=0.9" +rustls = { version = "0.22.0" } +rustls-pemfile = { version = "2.0" } [[example]] name = "cureq" diff --git a/FUTURE.md b/FUTURE.md index 2423423a..6fee95f4 100644 --- a/FUTURE.md +++ b/FUTURE.md @@ -1,2 +1,3 @@ +- Make `AgentBuilder::timeout` be a truly global timeout, including for `connect`. - Replace `impl From for Request` with `TryFrom` because the conversion is fallible (implement in terms of `From`: `builder.body(())?.into_parts().0.into()`); diff --git a/README.md b/README.md index 9c2e9a44..ff6eec34 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,8 @@ You can control them when including ureq as a dependency. does nothing for `native-tls`. * `gzip` enables requests of gzip-compressed responses and decompresses them. This is enabled by default. * `brotli` enables requests brotli-compressed responses and decompresses them. -* `http-interop` enables conversion methods to and from `http::Response` and `http::request::Builder`. +* `http-interop` enables conversion methods to and from `http::Response` and `http::request::Builder` (v0.2). +* `http` enables conversion methods to and from `http::Response` and `http::request::Builder` (v1.0). ## Plain requests diff --git a/examples/cureq/main.rs b/examples/cureq/main.rs index 3d584bc4..2afd8310 100644 --- a/examples/cureq/main.rs +++ b/examples/cureq/main.rs @@ -3,13 +3,11 @@ use std::fmt; use std::io; use std::thread; use std::time::Duration; -use std::time::SystemTime; use std::{env, sync::Arc}; -use rustls::client::ServerCertVerified; -use rustls::client::ServerCertVerifier; -use rustls::ServerName; -use rustls::{Certificate, ClientConfig}; +use rustls::client::danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier}; +use rustls::ClientConfig; +use rustls_pki_types::{CertificateDer, ServerName, UnixTime}; use ureq; #[derive(Debug)] @@ -96,20 +94,42 @@ fn perform( Ok(()) } +#[derive(Debug)] struct AcceptAll {} impl ServerCertVerifier for AcceptAll { fn verify_server_cert( &self, - _end_entity: &Certificate, - _intermediates: &[Certificate], + _end_entity: &CertificateDer, + _intermediates: &[CertificateDer], _server_name: &ServerName, - _scts: &mut dyn Iterator, _ocsp_response: &[u8], - _now: SystemTime, + _now: UnixTime, ) -> Result { Ok(ServerCertVerified::assertion()) } + + fn verify_tls12_signature( + &self, + _message: &[u8], + _cert: &CertificateDer<'_>, + _dss: &rustls::DigitallySignedStruct, + ) -> Result { + Ok(HandshakeSignatureValid::assertion()) + } + + fn verify_tls13_signature( + &self, + _message: &[u8], + _cert: &CertificateDer<'_>, + _dss: &rustls::DigitallySignedStruct, + ) -> Result { + Ok(HandshakeSignatureValid::assertion()) + } + + fn supported_verify_schemes(&self) -> Vec { + todo!() + } } fn main() { @@ -165,7 +185,7 @@ Fetch url and copy it to stdout. } "-k" => { let client_config = ClientConfig::builder() - .with_safe_defaults() + .dangerous() .with_custom_certificate_verifier(Arc::new(AcceptAll {})) .with_no_client_auth(); builder = builder.tls_config(Arc::new(client_config)); diff --git a/examples/tls_config.rs b/examples/tls_config.rs index 7746f6d4..ab2549ed 100644 --- a/examples/tls_config.rs +++ b/examples/tls_config.rs @@ -21,23 +21,13 @@ pub fn main() { // } // This adds webpki_roots certs. - root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| { - rustls::OwnedTrustAnchor::from_subject_spki_name_constraints( - ta.subject, - ta.spki, - ta.name_constraints, - ) - })); + root_store.roots = webpki_roots::TLS_SERVER_ROOTS.iter().cloned().collect(); // This is how we narrow down the allowed TLS versions for rustls. let protocol_versions = &[&TLS12, &TLS13]; // See rustls documentation for more configuration options. - let tls_config = rustls::ClientConfig::builder() - .with_safe_default_cipher_suites() - .with_safe_default_kx_groups() - .with_protocol_versions(protocol_versions) - .unwrap() + let tls_config = rustls::ClientConfig::builder_with_protocol_versions(protocol_versions) .with_root_certificates(root_store) .with_no_client_auth(); diff --git a/src/agent.rs b/src/agent.rs index 30a0038e..202869ff 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -93,11 +93,11 @@ pub(crate) struct AgentConfig { /// let mut agent = ureq::agent(); /// /// agent -/// .post("http://example.com/login") +/// .post("http://example.com/post/login") /// .call()?; /// /// let secret = agent -/// .get("http://example.com/my-protected-page") +/// .get("http://example.com/get/my-protected-page") /// .call()? /// .into_string()?; /// @@ -173,7 +173,7 @@ impl Agent { /// let agent = ureq::agent(); /// /// let mut url: Url = "http://example.com/some-page".parse()?; - /// url.set_path("/robots.txt"); + /// url.set_path("/get/robots.txt"); /// let resp: Response = agent /// .request_url("GET", &url) /// .call()?; @@ -595,17 +595,11 @@ impl AgentBuilder { /// # fn main() -> Result<(), ureq::Error> { /// # ureq::is_test(true); /// use std::sync::Arc; - /// let mut root_store = rustls::RootCertStore::empty(); - /// root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| { - /// rustls::OwnedTrustAnchor::from_subject_spki_name_constraints( - /// ta.subject, - /// ta.spki, - /// ta.name_constraints, - /// ) - /// })); + /// let mut root_store = rustls::RootCertStore { + /// roots: webpki_roots::TLS_SERVER_ROOTS.iter().cloned().collect(), + /// }; /// /// let tls_config = rustls::ClientConfig::builder() - /// .with_safe_defaults() /// .with_root_certificates(root_store) /// .with_no_client_auth(); /// let agent = ureq::builder() diff --git a/src/chunked/mod.rs b/src/chunked/mod.rs index 4d85cc40..4402e3b4 100644 --- a/src/chunked/mod.rs +++ b/src/chunked/mod.rs @@ -12,7 +12,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#![allow(dead_code)] +#![allow(dead_code, unused_imports)] mod decoder; pub use decoder::Decoder; diff --git a/src/error.rs b/src/error.rs index 9610fc74..805395ec 100644 --- a/src/error.rs +++ b/src/error.rs @@ -212,7 +212,7 @@ impl Display for Error { match self { Error::Status(status, response) => { write!(f, "{}: status code {}", response.get_url(), status)?; - if let Some(original) = response.history.get(0) { + if let Some(original) = response.history.first() { write!(f, " (redirected from {})", original)?; } } diff --git a/src/header.rs b/src/header.rs index ebc2ed1b..053c8c5a 100644 --- a/src/header.rs +++ b/src/header.rs @@ -65,7 +65,7 @@ impl fmt::Display for HeaderLine { #[derive(Clone, PartialEq, Eq)] /// Wrapper type for a header field. /// -pub struct Header { +pub(crate) struct Header { // Line contains the unmodified bytes of single header field. // It does not contain the final CRLF. line: HeaderLine, @@ -115,6 +115,7 @@ impl Header { /// /// ureq can't know what encoding the header is in, but this function provides /// an escape hatch for users that need to handle such headers. + #[allow(unused)] pub fn value_raw(&self) -> &[u8] { let mut bytes = &self.line.as_bytes()[self.index + 1..]; @@ -151,22 +152,22 @@ impl Header { } /// For non-utf8 headers this returns [`None`] (use [`get_header_raw()`]). -pub fn get_header<'h>(headers: &'h [Header], name: &str) -> Option<&'h str> { +pub(crate) fn get_header<'h>(headers: &'h [Header], name: &str) -> Option<&'h str> { headers .iter() .find(|h| h.is_name(name)) .and_then(|h| h.value()) } -#[cfg(any(doc, all(test, any(feature = "http-interop", feature = "http-crate"))))] -pub fn get_header_raw<'h>(headers: &'h [Header], name: &str) -> Option<&'h [u8]> { +#[allow(unused)] +pub(crate) fn get_header_raw<'h>(headers: &'h [Header], name: &str) -> Option<&'h [u8]> { headers .iter() .find(|h| h.is_name(name)) .map(|h| h.value_raw()) } -pub fn get_all_headers<'h>(headers: &'h [Header], name: &str) -> Vec<&'h str> { +pub(crate) fn get_all_headers<'h>(headers: &'h [Header], name: &str) -> Vec<&'h str> { headers .iter() .filter(|h| h.is_name(name)) @@ -174,11 +175,11 @@ pub fn get_all_headers<'h>(headers: &'h [Header], name: &str) -> Vec<&'h str> { .collect() } -pub fn has_header(headers: &[Header], name: &str) -> bool { +pub(crate) fn has_header(headers: &[Header], name: &str) -> bool { get_header(headers, name).is_some() } -pub fn add_header(headers: &mut Vec
, header: Header) { +pub(crate) fn add_header(headers: &mut Vec
, header: Header) { let name = header.name(); if !name.starts_with("x-") && !name.starts_with("X-") { headers.retain(|h| h.name() != name); diff --git a/src/http_crate.rs b/src/http_crate.rs index ad37d49e..367c74e2 100644 --- a/src/http_crate.rs +++ b/src/http_crate.rs @@ -8,9 +8,9 @@ use crate::{header::HeaderLine, response::ResponseStatusIndex, Request, Response /// Converts an [`http::Response`] into a [`Response`]. /// /// As an [`http::Response`] does not contain a URL, `"https://example.com/"` is used as a -/// placeholder. Additionally, if the response has a header which cannot be converted into a valid -/// [`Header`](crate::Header), it will be skipped rather than having the conversion fail. The remote -/// address property will also always be `127.0.0.1:80` for similar reasons to the URL. +/// placeholder. Additionally, if the response has a header which cannot be converted to ureq's +/// internal header representation, it will be skipped rather than having the conversion fail. +/// The remote address property will also always be `127.0.0.1:80` for similar reasons to the URL. /// /// ``` /// # fn main() -> Result<(), http::Error> { diff --git a/src/http_interop.rs b/src/http_interop.rs index 2864daa5..1d69dd0c 100644 --- a/src/http_interop.rs +++ b/src/http_interop.rs @@ -10,8 +10,8 @@ use crate::{header::HeaderLine, response::ResponseStatusIndex, Request, Response /// Converts an [`http::Response`] into a [`Response`]. /// /// As an [`http::Response`] does not contain a URL, `"https://example.com/"` is used as a -/// placeholder. Additionally, if the response has a header which cannot be converted into a valid -/// [`Header`](crate::Header), it will be skipped rather than having the conversion fail. The remote +/// placeholder. Additionally, if the response has a header which cannot be converted into +/// the ureq equivalent, it will be skipped rather than having the conversion fail. The remote /// address property will also always be `127.0.0.1:80` for similar reasons to the URL. /// /// ``` diff --git a/src/lib.rs b/src/lib.rs index d6bafe9d..a99d1a0a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -104,7 +104,7 @@ //! # fn main() -> std::result::Result<(), ureq::Error> { //! # ureq::is_test(true); //! // Requires the `json` feature enabled. -//! let resp: String = ureq::post("http://myapi.example.com/ingest") +//! let resp: String = ureq::post("http://myapi.example.com/post/ingest") //! .set("X-My-Header", "Secret") //! .send_json(ureq::json!({ //! "name": "martin", @@ -430,7 +430,6 @@ pub use crate::agent::Agent; pub use crate::agent::AgentBuilder; pub use crate::agent::RedirectAuthHeaders; pub use crate::error::{Error, ErrorKind, OrAnyStatus, Transport}; -pub use crate::header::Header; pub use crate::middleware::{Middleware, MiddlewareNext}; pub use crate::proxy::Proxy; pub use crate::request::{Request, RequestUrl}; @@ -528,7 +527,7 @@ pub fn request(method: &str, path: &str) -> Request { /// let agent = ureq::agent(); /// /// let mut url: Url = "http://example.com/some-page".parse()?; -/// url.set_path("/robots.txt"); +/// url.set_path("/get/robots.txt"); /// let resp: ureq::Response = ureq::request_url("GET", &url) /// .call()?; /// # Ok(()) diff --git a/src/ntls.rs b/src/ntls.rs index 829f59b3..78e33d32 100644 --- a/src/ntls.rs +++ b/src/ntls.rs @@ -17,9 +17,12 @@ impl TlsConnector for native_tls::TlsConnector { native_tls::HandshakeError::Failure(e) => ErrorKind::ConnectionFailed .msg("native_tls connect failed") .src(e), - native_tls::HandshakeError::WouldBlock(_) => { - ErrorKind::Io.msg("Unexpected native_tls::HandshakeError::WouldBlock") - } + native_tls::HandshakeError::WouldBlock(_) => ErrorKind::Io + .msg("native_tls handshake timed out") + .src(std::io::Error::new( + std::io::ErrorKind::TimedOut, + "native_tls handshake timed out", + )), })?; Ok(Box::new(stream)) diff --git a/src/request.rs b/src/request.rs index f92ddde1..33c68eed 100644 --- a/src/request.rs +++ b/src/request.rs @@ -18,7 +18,7 @@ pub type Result = std::result::Result; /// ``` /// # fn main() -> Result<(), ureq::Error> { /// # ureq::is_test(true); -/// let response = ureq::get("http://example.com/form") +/// let response = ureq::get("http://example.com/get") /// .query("foo", "bar baz") // add ?foo=bar+baz /// .call()?; // run the request /// # Ok(()) diff --git a/src/response.rs b/src/response.rs index 4085cb0f..1cc48e97 100644 --- a/src/response.rs +++ b/src/response.rs @@ -201,8 +201,8 @@ impl Response { /// ``` /// # fn main() -> Result<(), ureq::Error> { /// # ureq::is_test(true); - /// let resp = ureq::get("http://example.com/").call()?; - /// assert!(matches!(resp.header("content-type"), Some("text/html; charset=ISO-8859-1"))); + /// let resp = ureq::get("http://example.com/charset/iso").call()?; + /// assert_eq!(resp.header("content-type"), Some("text/html; charset=ISO-8859-1")); /// assert_eq!("text/html", resp.content_type()); /// # Ok(()) /// # } @@ -225,8 +225,8 @@ impl Response { /// ``` /// # fn main() -> Result<(), ureq::Error> { /// # ureq::is_test(true); - /// let resp = ureq::get("http://example.com/").call()?; - /// assert!(matches!(resp.header("content-type"), Some("text/html; charset=ISO-8859-1"))); + /// let resp = ureq::get("http://example.com/charset/iso").call()?; + /// assert_eq!(resp.header("content-type"), Some("text/html; charset=ISO-8859-1")); /// assert_eq!("ISO-8859-1", resp.charset()); /// # Ok(()) /// # } @@ -435,7 +435,7 @@ impl Response { /// ``` /// # fn main() -> Result<(), ureq::Error> { /// # ureq::is_test(true); - /// let text = ureq::get("http://httpbin.org/get/success") + /// let text = ureq::get("http://httpbin.org/get?success") /// .call()? /// .into_string()?; /// @@ -500,15 +500,15 @@ impl Response { /// /// #[derive(Deserialize)] /// struct Message { - /// hello: String, + /// text: String, /// } /// /// let message: Message = - /// ureq::get("http://example.com/hello_world.json") + /// ureq::get("http://example.com/get/hello_world.json") /// .call()? /// .into_json()?; /// - /// assert_eq!(message.hello, "world"); + /// assert_eq!(message.text, "Ok"); /// # Ok(()) /// # } /// ``` @@ -520,11 +520,11 @@ impl Response { /// ``` /// # fn main() -> Result<(), ureq::Error> { /// # ureq::is_test(true); - /// let json: serde_json::Value = ureq::get("http://example.com/hello_world.json") + /// let json: serde_json::Value = ureq::get("http://example.com/get/hello_world.json") /// .call()? /// .into_json()?; /// - /// assert_eq!(json["hello"], "world"); + /// assert_eq!(json["text"], "Ok"); /// # Ok(()) /// # } /// ``` diff --git a/src/rtls.rs b/src/rtls.rs index f18adee6..5081ef72 100644 --- a/src/rtls.rs +++ b/src/rtls.rs @@ -64,30 +64,12 @@ fn root_certs() -> rustls::RootCertStore { use log::error; let mut root_cert_store = rustls::RootCertStore::empty(); - - let mut valid_count = 0; - let mut invalid_count = 0; - let certs = rustls_native_certs::load_native_certs().unwrap_or_else(|e| { + let native_certs = rustls_native_certs::load_native_certs().unwrap_or_else(|e| { error!("loading native certificates: {}", e); vec![] }); - for cert in certs { - let cert = rustls::Certificate(cert.0); - // Continue on parsing errors, as native stores often include ancient or syntactically - // invalid certificates, like root certificates without any X509 extensions. - // Inspiration: https://github.com/rustls/rustls/blob/633bf4ba9d9521a95f68766d04c22e2b01e68318/rustls/src/anchors.rs#L105-L112 - match root_cert_store.add(&cert) { - Ok(_) => valid_count += 1, - Err(err) => { - invalid_count += 1; - log::warn!( - "rustls failed to parse DER certificate {:?} {:?}", - &err, - &cert - ); - } - } - } + let (valid_count, invalid_count) = + root_cert_store.add_parsable_certificates(native_certs.into_iter().map(|c| c.into())); if valid_count == 0 && invalid_count > 0 { error!( "no valid certificates loaded by rustls-native-certs. all HTTPS requests will fail." @@ -98,15 +80,9 @@ fn root_certs() -> rustls::RootCertStore { #[cfg(not(feature = "native-certs"))] fn root_certs() -> rustls::RootCertStore { - let mut root_store = rustls::RootCertStore::empty(); - root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| { - rustls::OwnedTrustAnchor::from_subject_spki_name_constraints( - ta.subject, - ta.spki, - ta.name_constraints, - ) - })); - root_store + rustls::RootCertStore { + roots: webpki_roots::TLS_SERVER_ROOTS.to_vec(), + } } impl TlsConnector for Arc { @@ -122,8 +98,9 @@ impl TlsConnector for Arc { dns_name }; - let sni = rustls::ServerName::try_from(dns_name) - .map_err(|e| ErrorKind::Dns.msg(format!("parsing '{}'", dns_name)).src(e))?; + let sni = rustls_pki_types::ServerName::try_from(dns_name) + .map_err(|e| ErrorKind::Dns.msg(format!("parsing '{}'", dns_name)).src(e))? + .to_owned(); let mut sess = rustls::ClientConnection::new(self.clone(), sni) .map_err(|e| ErrorKind::Io.msg("tls connection creation failed").src(e))?; @@ -142,7 +119,6 @@ impl TlsConnector for Arc { pub fn default_tls_config() -> Arc { static TLS_CONF: Lazy> = Lazy::new(|| { let config = rustls::ClientConfig::builder() - .with_safe_defaults() .with_root_certificates(root_certs()) .with_no_client_auth(); Arc::new(Arc::new(config)) diff --git a/src/stream.rs b/src/stream.rs index 98b7da64..8e7a36ee 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -2,6 +2,7 @@ use log::debug; use std::io::{self, BufRead, BufReader, Read, Write}; use std::net::SocketAddr; use std::net::TcpStream; +use std::ops::Div; use std::time::Duration; use std::time::Instant; use std::{fmt, io::Cursor}; @@ -375,10 +376,18 @@ pub(crate) fn connect_host( let mut any_err = None; let mut any_stream_and_addr = None; // Find the first sock_addr that accepts a connection + let multiple_addrs = sock_addrs.len() > 1; + for sock_addr in sock_addrs { // ensure connect timeout or overall timeout aren't yet hit. let timeout = match connect_deadline { - Some(deadline) => Some(time_until_deadline(deadline)?), + Some(deadline) => { + let mut deadline = time_until_deadline(deadline)?; + if multiple_addrs { + deadline = deadline.div(2); + } + Some(deadline) + } None => None, }; diff --git a/src/test/agent_test.rs b/src/test/agent_test.rs index ea0abdac..1fdaedfd 100644 --- a/src/test/agent_test.rs +++ b/src/test/agent_test.rs @@ -3,7 +3,7 @@ use crate::error::Error; use crate::testserver::{read_request, TestServer}; use std::io::{self, Read, Write}; -use std::net::TcpStream; +use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpStream}; use std::thread; use std::time::Duration; @@ -111,6 +111,33 @@ fn custom_resolver() { assert_eq!(&server.join().unwrap(), b"GET / HTTP/1.1\r\n"); } +#[test] +fn socket_addr_fail_over() { + use std::net::TcpListener; + + let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + + let local_addr = listener.local_addr().unwrap(); + let non_routable_ipv4 = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(10, 255, 255, 1)), 9872); + let server = std::thread::spawn(move || { + let (mut client, _) = listener.accept().unwrap(); + let mut buf = vec![0u8; 16]; + let read = client.read(&mut buf).unwrap(); + buf.truncate(read); + buf + }); + + AgentBuilder::new() + .resolver(move |_: &str| Ok(vec![non_routable_ipv4, local_addr])) + .timeout_connect(Duration::from_secs(2)) + .build() + .get("http://cool.server/") + .call() + .ok(); + + assert_eq!(&server.join().unwrap(), b"GET / HTTP/1.1\r\n"); +} + #[cfg(feature = "cookies")] #[cfg(test)] fn cookie_and_redirect(mut stream: TcpStream) -> io::Result<()> { diff --git a/src/testserver.rs b/src/testserver.rs index 5df8f6b4..293caf68 100644 --- a/src/testserver.rs +++ b/src/testserver.rs @@ -1,58 +1,46 @@ +use std::io; +use std::net::ToSocketAddrs; use std::net::{SocketAddr, TcpListener, TcpStream}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread; use std::time::Duration; -use std::{ - io::{self, BufRead, BufReader, Write}, - net::ToSocketAddrs, -}; use crate::{Agent, AgentBuilder}; +#[cfg(not(feature = "testdeps"))] +fn test_server_handler(_stream: TcpStream) -> io::Result<()> { + Ok(()) +} + +#[cfg(feature = "testdeps")] +fn test_server_handler(stream: TcpStream) -> io::Result<()> { + use hootbin::serve_single; + let o = stream.try_clone().expect("TcpStream to be clonable"); + let i = stream; + match serve_single(i, o, "https://hootbin.test/") { + Ok(()) => {} + Err(e) => { + if let hootbin::Error::Io(ioe) = &e { + if ioe.kind() == io::ErrorKind::UnexpectedEof { + // accept this. the pre-connect below is always erroring. + return Ok(()); + } + } + + println!("TestServer error: {:?}", e); + } + }; + Ok(()) +} + // An agent to be installed by default for tests and doctests, such // that all hostnames resolve to a TestServer on localhost. pub(crate) fn test_agent() -> Agent { #[cfg(test)] let _ = env_logger::try_init(); - let testserver = TestServer::new(|mut stream: TcpStream| -> io::Result<()> { - let headers = read_request(&stream); - if headers.0.is_empty() { - // no headers probably means it's the initial request to check test server is up. - } else if headers.path() == "/status/200" { - stream.write_all(b"HTTP/1.1 200 OK\r\n\r\n")?; - } else if headers.path() == "/status/500" { - stream.write_all(b"HTTP/1.1 500 Server Internal Error\r\n\r\n")?; - } else if headers.path() == "/bytes/100" { - stream.write_all(b"HTTP/1.1 200 OK\r\n")?; - stream.write_all(b"Content-Length: 100\r\n")?; - stream.write_all(b"\r\n")?; - stream.write_all(&[0; 100])?; - } else if headers.path() == "/hello_world.json" { - stream.write_all(b"HTTP/1.1 200 OK\r\n")?; - stream.write_all(b"\r\n")?; - stream.write_all(br#"{"hello": "world"}"#)?; - } else if headers.path() == "/status/301" { - stream.write_all(b"HTTP/1.1 301 Found\r\n")?; - stream.write_all(b"Location: /status/200\r\n")?; - stream.write_all(b"\r\n")?; - } else if headers.path() == "/status/307" { - stream.write_all(b"HTTP/1.1 307 Found\r\n")?; - stream.write_all(b"Location: /status/200\r\n")?; - stream.write_all(b"\r\n")?; - } else { - stream.write_all(b"HTTP/1.1 200 OK\r\n")?; - stream.write_all(b"Transfer-Encoding: chunked\r\n")?; - stream.write_all(b"Content-Type: text/html; charset=ISO-8859-1\r\n")?; - stream.write_all(b"\r\n")?; - stream.write_all(b"7\r\n")?; - stream.write_all(b"success\r\n")?; - stream.write_all(b"0\r\n")?; - stream.write_all(b"\r\n")?; - } - Ok(()) - }); + let testserver = TestServer::new(test_server_handler); // Slightly tricky thing here: we want to make sure the TestServer lives // as long as the agent. This is accomplished by `move`ing it into the // closure, which becomes owned by the agent. @@ -97,7 +85,10 @@ impl TestHeaders { // Read a stream until reaching a blank line, in order to consume // request headers. +#[cfg(test)] pub fn read_request(stream: &TcpStream) -> TestHeaders { + use std::io::{BufRead, BufReader}; + let mut results = vec![]; for line in BufReader::new(stream).lines() { match line { diff --git a/test.sh b/test.sh index d5fa3df0..4bfa42f2 100755 --- a/test.sh +++ b/test.sh @@ -5,8 +5,8 @@ export RUST_BACKTRACE=1 export RUSTFLAGS="-D dead_code -D unused-variables -D unused" for feature in "" tls json charset cookies socks-proxy "tls native-certs" native-tls gzip brotli http-interop http-crate; do - if ! cargo test --no-default-features --features "${feature}" ; then - echo Command failed: cargo test --no-default-features --features \"${feature}\" + if ! cargo test --no-default-features --features "testdeps ${feature}" ; then + echo Command failed: cargo test --no-default-features --features \"testdeps ${feature}\" exit 1 fi done diff --git a/tests/https-agent.rs b/tests/https-agent.rs index 6722bc54..1cb92225 100644 --- a/tests/https-agent.rs +++ b/tests/https-agent.rs @@ -96,26 +96,19 @@ m0Wqhhi8/24Sy934t5Txgkfoltg8ahkx934WjP6WWRnSAu+cf+vW use ureq::OrAnyStatus; let certs = rustls_pemfile::certs(&mut BADSSL_CLIENT_CERT_PEM.as_bytes()) + .collect::, _>>() + .unwrap(); + let key = rustls_pemfile::private_key(&mut BADSSL_CLIENT_CERT_PEM.as_bytes()) .unwrap() - .into_iter() - .map(rustls::Certificate) - .collect(); - let key = rustls_pemfile::rsa_private_keys(&mut BADSSL_CLIENT_CERT_PEM.as_bytes()).unwrap()[0] - .clone(); - - let mut root_store = rustls::RootCertStore::empty(); - root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| { - rustls::OwnedTrustAnchor::from_subject_spki_name_constraints( - ta.subject, - ta.spki, - ta.name_constraints, - ) - })); + .unwrap(); + + let root_store = rustls::RootCertStore { + roots: webpki_roots::TLS_SERVER_ROOTS.iter().cloned().collect(), + }; let tls_config = rustls::ClientConfig::builder() - .with_safe_defaults() .with_root_certificates(root_store) - .with_single_cert(certs, rustls::PrivateKey(key)) + .with_client_auth_cert(certs, key) .unwrap(); let agent = ureq::builder() @@ -156,17 +149,11 @@ m0Wqhhi8/24Sy934t5Txgkfoltg8ahkx934WjP6WWRnSAu+cf+vW #[test] #[cfg(any(feature = "tls", feature = "tls-native"))] fn ipv6_addr_in_dns_name() { - let mut root_store = rustls::RootCertStore::empty(); - root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| { - rustls::OwnedTrustAnchor::from_subject_spki_name_constraints( - ta.subject, - ta.spki, - ta.name_constraints, - ) - })); + let root_store = rustls::RootCertStore { + roots: webpki_roots::TLS_SERVER_ROOTS.to_vec(), + }; let tls_config = rustls::ClientConfig::builder() - .with_safe_defaults() .with_root_certificates(root_store) .with_no_client_auth();