summaryrefslogtreecommitdiffstats
path: root/vendor/tokio-native-tls
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/tokio-native-tls')
-rw-r--r--vendor/tokio-native-tls/.cargo-checksum.json1
-rw-r--r--vendor/tokio-native-tls/CHANGELOG.md11
-rw-r--r--vendor/tokio-native-tls/Cargo.lock664
-rw-r--r--vendor/tokio-native-tls/Cargo.toml95
-rw-r--r--vendor/tokio-native-tls/LICENSE25
-rw-r--r--vendor/tokio-native-tls/README.md14
-rw-r--r--vendor/tokio-native-tls/examples/download-rust-lang.rs39
-rw-r--r--vendor/tokio-native-tls/examples/echo.rs52
-rw-r--r--vendor/tokio-native-tls/examples/identity.p12bin0 -> 3386 bytes
-rwxr-xr-xvendor/tokio-native-tls/scripts/generate-certificate.sh57
-rw-r--r--vendor/tokio-native-tls/src/lib.rs384
-rw-r--r--vendor/tokio-native-tls/tests/bad.rs122
-rw-r--r--vendor/tokio-native-tls/tests/cert.derbin0 -> 799 bytes
-rw-r--r--vendor/tokio-native-tls/tests/google.rs99
-rw-r--r--vendor/tokio-native-tls/tests/identity.p12bin0 -> 3386 bytes
-rw-r--r--vendor/tokio-native-tls/tests/root-ca.derbin0 -> 865 bytes
-rw-r--r--vendor/tokio-native-tls/tests/smoke.rs172
17 files changed, 1735 insertions, 0 deletions
diff --git a/vendor/tokio-native-tls/.cargo-checksum.json b/vendor/tokio-native-tls/.cargo-checksum.json
new file mode 100644
index 000000000..307792ce9
--- /dev/null
+++ b/vendor/tokio-native-tls/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"8a8a1d1a3df87d242be74c306f838f89ac0f9597596dcfd82cf42204acd988d5","Cargo.lock":"935e7a9ddc35eb51d64e32723643c6a48f453283b4c13f58727fc6eeebac183c","Cargo.toml":"6bb138e0cd1d8edc28e1e4e37e796b732a9b4f9db909d6b10779225e1581bcb0","LICENSE":"898b1ae9821e98daf8964c8d6c7f61641f5f5aa78ad500020771c0939ee0dea1","README.md":"c67dbbda2b1036378bc287ac7297156dabbdf2d557c363b2311abf7ff307ff52","examples/download-rust-lang.rs":"def23a173284d3712ec82db9ce5c760462754d89dddd8defd8e230409366c9de","examples/echo.rs":"38d186fcaacd15aa8d1e1b63e8fec9d1d657f4eda4a0511c279f84b9734d92a5","examples/identity.p12":"aceeb3e5516471bd5af9a44bbeffc9559c4f228f67c677d29f36a4b368e2779f","scripts/generate-certificate.sh":"a4b6225beb38a99b68b71ce9dcef6c64e7958687ef71117502bd005588aadab1","src/lib.rs":"9f29482a3522a6f2c8051affc0ff41ca1e90b9494dca83c108e4d911b94dda89","tests/bad.rs":"76b690c5453f8ccc3f14323bdd0945174a23cc4c9b5377ff749631e7255de4dd","tests/cert.der":"4712b939fbcb42a6b5101b42139a25b14f81b418facabd378746f12f85cc6544","tests/google.rs":"5dfa4e09a59e2ce6ec1ead73574dbacc8771222a8c08c59bc05635721f6d3a1b","tests/identity.p12":"aceeb3e5516471bd5af9a44bbeffc9559c4f228f67c677d29f36a4b368e2779f","tests/root-ca.der":"063d70aef5de8fa5a9c35cdd46aea1cb4368ae50e99debd2049e7fa02568d7cc","tests/smoke.rs":"5db888556dd8f4a930063b0dd9f75b83ab08abb2025a4e345ca09457373e5e21"},"package":"bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"} \ No newline at end of file
diff --git a/vendor/tokio-native-tls/CHANGELOG.md b/vendor/tokio-native-tls/CHANGELOG.md
new file mode 100644
index 000000000..199430241
--- /dev/null
+++ b/vendor/tokio-native-tls/CHANGELOG.md
@@ -0,0 +1,11 @@
+# 0.3.0 (December 23, 2020)
+
+- Upgrade to `tokio 1.0`.
+
+# 0.2.0 (October 16, 2020)
+
+- Upgrade to `tokio 0.3`.
+
+# 0.1.0 (January 9th, 2019)
+
+- Initial release from `tokio-tls 0.3`
diff --git a/vendor/tokio-native-tls/Cargo.lock b/vendor/tokio-native-tls/Cargo.lock
new file mode 100644
index 000000000..eecfd4ff2
--- /dev/null
+++ b/vendor/tokio-native-tls/Cargo.lock
@@ -0,0 +1,664 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "MacTypes-sys"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eaf9f0d0b1cc33a4d2aee14fb4b2eac03462ef4db29c8ac4057327d8a71ad86f"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "bytes"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
+
+[[package]]
+name = "cc"
+version = "1.0.79"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
+
+[[package]]
+name = "cfg-if"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "core-foundation"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980"
+dependencies = [
+ "core-foundation-sys 0.5.1",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
+dependencies = [
+ "core-foundation-sys 0.8.3",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
+
+[[package]]
+name = "env_logger"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
+dependencies = [
+ "log",
+]
+
+[[package]]
+name = "fastrand"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
+dependencies = [
+ "instant",
+]
+
+[[package]]
+name = "foreign-types"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
+dependencies = [
+ "foreign-types-shared",
+]
+
+[[package]]
+name = "foreign-types-shared"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
+
+[[package]]
+name = "futures"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-channel"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
+dependencies = [
+ "futures-core",
+ "futures-sink",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
+
+[[package]]
+name = "futures-executor"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-io"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531"
+
+[[package]]
+name = "futures-macro"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "futures-sink"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
+
+[[package]]
+name = "futures-task"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
+
+[[package]]
+name = "futures-util"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-macro",
+ "futures-sink",
+ "futures-task",
+ "memchr",
+ "pin-project-lite",
+ "pin-utils",
+ "slab",
+]
+
+[[package]]
+name = "hermit-abi"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "instant"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
+dependencies = [
+ "cfg-if 1.0.0",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
+[[package]]
+name = "libc"
+version = "0.2.139"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
+
+[[package]]
+name = "log"
+version = "0.4.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
+dependencies = [
+ "cfg-if 1.0.0",
+]
+
+[[package]]
+name = "memchr"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
+
+[[package]]
+name = "mio"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
+dependencies = [
+ "libc",
+ "log",
+ "wasi",
+ "windows-sys",
+]
+
+[[package]]
+name = "native-tls"
+version = "0.2.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
+dependencies = [
+ "lazy_static",
+ "libc",
+ "log",
+ "openssl",
+ "openssl-probe",
+ "openssl-sys",
+ "schannel",
+ "security-framework 2.8.2",
+ "security-framework-sys 2.8.0",
+ "tempfile",
+]
+
+[[package]]
+name = "num_cpus"
+version = "1.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
+dependencies = [
+ "hermit-abi",
+ "libc",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
+
+[[package]]
+name = "openssl"
+version = "0.10.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1"
+dependencies = [
+ "bitflags",
+ "cfg-if 1.0.0",
+ "foreign-types",
+ "libc",
+ "once_cell",
+ "openssl-macros",
+ "openssl-sys",
+]
+
+[[package]]
+name = "openssl-macros"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "openssl-probe"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
+
+[[package]]
+name = "openssl-src"
+version = "111.24.0+1.1.1s"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3498f259dab01178c6228c6b00dcef0ed2a2d5e20d648c017861227773ea4abd"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "openssl-sys"
+version = "0.9.80"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7"
+dependencies = [
+ "autocfg",
+ "cc",
+ "libc",
+ "openssl-src",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
+
+[[package]]
+name = "pin-utils"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+
+[[package]]
+name = "pkg-config"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.51"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "remove_dir_all"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "schannel"
+version = "0.1.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "security-framework"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfab8dda0e7a327c696d893df9ffa19cadc4bd195797997f5223cf5831beaf05"
+dependencies = [
+ "core-foundation 0.5.1",
+ "core-foundation-sys 0.5.1",
+ "libc",
+ "security-framework-sys 0.2.3",
+]
+
+[[package]]
+name = "security-framework"
+version = "2.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254"
+dependencies = [
+ "bitflags",
+ "core-foundation 0.9.3",
+ "core-foundation-sys 0.8.3",
+ "libc",
+ "security-framework-sys 2.8.0",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d6696852716b589dff9e886ff83778bb635150168e83afa8ac6b8a78cb82abc"
+dependencies = [
+ "MacTypes-sys",
+ "core-foundation-sys 0.5.1",
+ "libc",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "2.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4"
+dependencies = [
+ "core-foundation-sys 0.8.3",
+ "libc",
+]
+
+[[package]]
+name = "slab"
+version = "0.4.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "socket2"
+version = "0.4.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
+dependencies = [
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "syn"
+version = "1.0.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "tempfile"
+version = "3.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
+dependencies = [
+ "cfg-if 1.0.0",
+ "fastrand",
+ "libc",
+ "redox_syscall",
+ "remove_dir_all",
+ "winapi",
+]
+
+[[package]]
+name = "tokio"
+version = "1.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
+dependencies = [
+ "autocfg",
+ "bytes",
+ "libc",
+ "memchr",
+ "mio",
+ "num_cpus",
+ "pin-project-lite",
+ "socket2",
+ "tokio-macros",
+ "windows-sys",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "1.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tokio-native-tls"
+version = "0.3.1"
+dependencies = [
+ "cfg-if 0.1.10",
+ "env_logger",
+ "futures",
+ "lazy_static",
+ "native-tls",
+ "openssl",
+ "schannel",
+ "security-framework 0.2.2",
+ "tempfile",
+ "tokio",
+ "tokio-util",
+ "winapi",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.6.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-io",
+ "futures-sink",
+ "log",
+ "pin-project-lite",
+ "slab",
+ "tokio",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
+
+[[package]]
+name = "vcpkg"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+
+[[package]]
+name = "wasi"
+version = "0.11.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
+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",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
diff --git a/vendor/tokio-native-tls/Cargo.toml b/vendor/tokio-native-tls/Cargo.toml
new file mode 100644
index 000000000..76be3d393
--- /dev/null
+++ b/vendor/tokio-native-tls/Cargo.toml
@@ -0,0 +1,95 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+name = "tokio-native-tls"
+version = "0.3.1"
+authors = ["Tokio Contributors <team@tokio.rs>"]
+description = """
+An implementation of TLS/SSL streams for Tokio using native-tls giving an implementation of TLS
+for nonblocking I/O streams.
+"""
+homepage = "https://tokio.rs"
+documentation = "https://docs.rs/tokio-native-tls"
+readme = "README.md"
+categories = [
+ "asynchronous",
+ "network-programming",
+]
+license = "MIT"
+repository = "https://github.com/tokio-rs/tls"
+
+[package.metadata.docs.rs]
+all-features = true
+
+[dependencies.native-tls]
+version = "0.2"
+
+[dependencies.tokio]
+version = "1.0"
+
+[dev-dependencies.cfg-if]
+version = "0.1"
+
+[dev-dependencies.env_logger]
+version = "0.6"
+default-features = false
+
+[dev-dependencies.futures]
+version = "0.3.0"
+features = ["async-await"]
+
+[dev-dependencies.lazy_static]
+version = "1.4.0"
+
+[dev-dependencies.tempfile]
+version = "3.1"
+
+[dev-dependencies.tokio]
+version = "1.0"
+features = [
+ "macros",
+ "rt",
+ "rt-multi-thread",
+ "io-util",
+ "net",
+]
+
+[dev-dependencies.tokio-util]
+version = "0.6.0"
+features = ["full"]
+
+[features]
+vendored = ["native-tls/vendored"]
+
+[target."cfg(all(not(target_os = \"macos\"), not(windows), not(target_os = \"ios\")))".dev-dependencies.openssl]
+version = "0.10"
+
+[target."cfg(any(target_os = \"macos\", target_os = \"ios\"))".dev-dependencies.security-framework]
+version = "0.2"
+
+[target."cfg(windows)".dev-dependencies.schannel]
+version = "0.1"
+
+[target."cfg(windows)".dev-dependencies.winapi]
+version = "0.3"
+features = [
+ "lmcons",
+ "basetsd",
+ "minwinbase",
+ "minwindef",
+ "ntdef",
+ "sysinfoapi",
+ "timezoneapi",
+ "wincrypt",
+ "winerror",
+]
diff --git a/vendor/tokio-native-tls/LICENSE b/vendor/tokio-native-tls/LICENSE
new file mode 100644
index 000000000..cdb28b4b5
--- /dev/null
+++ b/vendor/tokio-native-tls/LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) 2019 Tokio Contributors
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/vendor/tokio-native-tls/README.md b/vendor/tokio-native-tls/README.md
new file mode 100644
index 000000000..455612be8
--- /dev/null
+++ b/vendor/tokio-native-tls/README.md
@@ -0,0 +1,14 @@
+# tokio-tls
+
+An implementation of TLS/SSL streams for Tokio built on top of the [`native-tls`
+crate]
+
+## License
+
+This project is licensed under the [MIT license](./LICENSE).
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in Tokio by you, shall be licensed as MIT, without any additional
+terms or conditions.
diff --git a/vendor/tokio-native-tls/examples/download-rust-lang.rs b/vendor/tokio-native-tls/examples/download-rust-lang.rs
new file mode 100644
index 000000000..6f864c38a
--- /dev/null
+++ b/vendor/tokio-native-tls/examples/download-rust-lang.rs
@@ -0,0 +1,39 @@
+// #![warn(rust_2018_idioms)]
+
+use native_tls::TlsConnector;
+use std::error::Error;
+use std::net::ToSocketAddrs;
+use tokio::io::{AsyncReadExt, AsyncWriteExt};
+use tokio::net::TcpStream;
+
+#[tokio::main]
+async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
+ let addr = "www.rust-lang.org:443"
+ .to_socket_addrs()?
+ .next()
+ .ok_or("failed to resolve www.rust-lang.org")?;
+
+ let socket = TcpStream::connect(&addr).await?;
+ let cx = TlsConnector::builder().build()?;
+ let cx = tokio_native_tls::TlsConnector::from(cx);
+
+ let mut socket = cx.connect("www.rust-lang.org", socket).await?;
+
+ socket
+ .write_all(
+ "\
+ GET / HTTP/1.0\r\n\
+ Host: www.rust-lang.org\r\n\
+ \r\n\
+ "
+ .as_bytes(),
+ )
+ .await?;
+
+ let mut data = Vec::new();
+ socket.read_to_end(&mut data).await?;
+
+ // println!("data: {:?}", &data);
+ println!("{}", String::from_utf8_lossy(&data[..]));
+ Ok(())
+}
diff --git a/vendor/tokio-native-tls/examples/echo.rs b/vendor/tokio-native-tls/examples/echo.rs
new file mode 100644
index 000000000..74c056433
--- /dev/null
+++ b/vendor/tokio-native-tls/examples/echo.rs
@@ -0,0 +1,52 @@
+#![warn(rust_2018_idioms)]
+
+// A tiny async TLS echo server with Tokio
+use native_tls::Identity;
+use tokio::io::{AsyncReadExt, AsyncWriteExt};
+use tokio::net::TcpListener;
+
+/**
+an example to setup a tls server.
+how to test:
+wget https://127.0.0.1:12345 --no-check-certificate
+*/
+#[tokio::main]
+async fn main() -> Result<(), Box<dyn std::error::Error>> {
+ // Bind the server's socket
+ let addr = "127.0.0.1:12345".to_string();
+ let tcp: TcpListener = TcpListener::bind(&addr).await?;
+
+ // Create the TLS acceptor.
+ let der = include_bytes!("identity.p12");
+ let cert = Identity::from_pkcs12(der, "mypass")?;
+ let tls_acceptor =
+ tokio_native_tls::TlsAcceptor::from(native_tls::TlsAcceptor::builder(cert).build()?);
+ loop {
+ // Asynchronously wait for an inbound socket.
+ let (socket, remote_addr) = tcp.accept().await?;
+ let tls_acceptor = tls_acceptor.clone();
+ println!("accept connection from {}", remote_addr);
+ tokio::spawn(async move {
+ // Accept the TLS connection.
+ let mut tls_stream = tls_acceptor.accept(socket).await.expect("accept error");
+ // In a loop, read data from the socket and write the data back.
+
+ let mut buf = [0; 1024];
+ let n = tls_stream
+ .read(&mut buf)
+ .await
+ .expect("failed to read data from socket");
+
+ if n == 0 {
+ return;
+ }
+ println!("read={}", unsafe {
+ String::from_utf8_unchecked(buf[0..n].into())
+ });
+ tls_stream
+ .write_all(&buf[0..n])
+ .await
+ .expect("failed to write data to socket");
+ });
+ }
+}
diff --git a/vendor/tokio-native-tls/examples/identity.p12 b/vendor/tokio-native-tls/examples/identity.p12
new file mode 100644
index 000000000..d16abb8c7
--- /dev/null
+++ b/vendor/tokio-native-tls/examples/identity.p12
Binary files differ
diff --git a/vendor/tokio-native-tls/scripts/generate-certificate.sh b/vendor/tokio-native-tls/scripts/generate-certificate.sh
new file mode 100755
index 000000000..e797eac13
--- /dev/null
+++ b/vendor/tokio-native-tls/scripts/generate-certificate.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+set -e
+
+cd $1
+
+# prepare config file for root CA generation
+cat <<EOF >> root.cnf
+[ req ]
+distinguished_name = req_dn
+[ req_dn ]
+[ v3_ca ]
+basicConstraints = CA:TRUE
+keyUsage = digitalSignature, nonRepudiation, keyCertSign, cRLSign
+subjectKeyIdentifier = hash
+authorityKeyIdentifier = keyid:always
+EOF
+
+ROOT_CA_KEY=root-ca.key.pem
+ROOT_CA=root-ca.pem
+ROOT_CA_DER=root-ca.der
+
+echo "Generate root CA key"
+openssl genrsa -out $ROOT_CA_KEY 4096
+
+echo "Generate root CA certificate"
+openssl req -x509 -new -key $ROOT_CA_KEY -out $ROOT_CA -days 365 -SHA256 -subj "/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd" -config root.cnf -extensions v3_ca
+openssl x509 -outform der -in $ROOT_CA -out $ROOT_CA_DER
+
+rm root.cnf
+
+# prepare config file for server certificate generation
+cat <<EOF >> server.cnf
+extendedKeyUsage=serverAuth
+subjectAltName = @alt_names
+[alt_names]
+DNS.1 = foobar.com
+EOF
+
+
+SERVER_KEY=server.key.pem
+SERVER_CERT=cert.pem
+SERVER_CERT_DER=cert.der
+IDENTITY=identity.p12
+PASSPHRASE=mypass
+
+echo "Generate server key"
+openssl genrsa -out $SERVER_KEY 4096
+
+echo "Generate server certificate"
+openssl req -out server.csr -key $SERVER_KEY -new -days 365 -SHA256 -subj "/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/CN=foobar.com"
+openssl x509 -req -days 365 -SHA256 -in server.csr -CA $ROOT_CA -CAkey $ROOT_CA_KEY -CAcreateserial -out $SERVER_CERT -extfile server.cnf
+openssl x509 -outform der -in $SERVER_CERT -out $SERVER_CERT_DER
+
+openssl pkcs12 -export -out $IDENTITY -inkey $SERVER_KEY -in $SERVER_CERT -passout pass:$PASSPHRASE
+
+rm server.csr
+rm server.cnf
diff --git a/vendor/tokio-native-tls/src/lib.rs b/vendor/tokio-native-tls/src/lib.rs
new file mode 100644
index 000000000..8ce19c029
--- /dev/null
+++ b/vendor/tokio-native-tls/src/lib.rs
@@ -0,0 +1,384 @@
+#![doc(html_root_url = "https://docs.rs/tokio-native-tls/0.3.0")]
+#![warn(
+ missing_debug_implementations,
+ missing_docs,
+ rust_2018_idioms,
+ unreachable_pub
+)]
+#![deny(rustdoc::broken_intra_doc_links)]
+#![doc(test(
+ no_crate_inject,
+ attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
+))]
+
+//! Async TLS streams
+//!
+//! This library is an implementation of TLS streams using the most appropriate
+//! system library by default for negotiating the connection. That is, on
+//! Windows this library uses SChannel, on OSX it uses SecureTransport, and on
+//! other platforms it uses OpenSSL.
+//!
+//! Each TLS stream implements the `Read` and `Write` traits to interact and
+//! interoperate with the rest of the futures I/O ecosystem. Client connections
+//! initiated from this crate verify hostnames automatically and by default.
+//!
+//! This crate primarily exports this ability through two newtypes,
+//! `TlsConnector` and `TlsAcceptor`. These newtypes augment the
+//! functionality provided by the `native-tls` crate, on which this crate is
+//! built. Configuration of TLS parameters is still primarily done through the
+//! `native-tls` crate.
+
+use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
+
+use crate::native_tls::{Error, HandshakeError, MidHandshakeTlsStream};
+use std::fmt;
+use std::future::Future;
+use std::io::{self, Read, Write};
+use std::marker::Unpin;
+#[cfg(unix)]
+use std::os::unix::io::{AsRawFd, RawFd};
+#[cfg(windows)]
+use std::os::windows::io::{AsRawSocket, RawSocket};
+use std::pin::Pin;
+use std::ptr::null_mut;
+use std::task::{Context, Poll};
+
+/// An intermediate wrapper for the inner stream `S`.
+#[derive(Debug)]
+pub struct AllowStd<S> {
+ inner: S,
+ context: *mut (),
+}
+
+impl<S> AllowStd<S> {
+ /// Returns a shared reference to the inner stream.
+ pub fn get_ref(&self) -> &S {
+ &self.inner
+ }
+
+ /// Returns a mutable reference to the inner stream.
+ pub fn get_mut(&mut self) -> &mut S {
+ &mut self.inner
+ }
+}
+
+/// A wrapper around an underlying raw stream which implements the TLS or SSL
+/// protocol.
+///
+/// A `TlsStream<S>` represents a handshake that has been completed successfully
+/// and both the server and the client are ready for receiving and sending
+/// data. Bytes read from a `TlsStream` are decrypted from `S` and bytes written
+/// to a `TlsStream` are encrypted when passing through to `S`.
+#[derive(Debug)]
+pub struct TlsStream<S>(native_tls::TlsStream<AllowStd<S>>);
+
+/// A wrapper around a `native_tls::TlsConnector`, providing an async `connect`
+/// method.
+#[derive(Clone)]
+pub struct TlsConnector(native_tls::TlsConnector);
+
+/// A wrapper around a `native_tls::TlsAcceptor`, providing an async `accept`
+/// method.
+#[derive(Clone)]
+pub struct TlsAcceptor(native_tls::TlsAcceptor);
+
+struct MidHandshake<S>(Option<MidHandshakeTlsStream<AllowStd<S>>>);
+
+enum StartedHandshake<S> {
+ Done(TlsStream<S>),
+ Mid(MidHandshakeTlsStream<AllowStd<S>>),
+}
+
+struct StartedHandshakeFuture<F, S>(Option<StartedHandshakeFutureInner<F, S>>);
+struct StartedHandshakeFutureInner<F, S> {
+ f: F,
+ stream: S,
+}
+
+struct Guard<'a, S>(&'a mut TlsStream<S>)
+where
+ AllowStd<S>: Read + Write;
+
+impl<S> Drop for Guard<'_, S>
+where
+ AllowStd<S>: Read + Write,
+{
+ fn drop(&mut self) {
+ (self.0).0.get_mut().context = null_mut();
+ }
+}
+
+// *mut () context is neither Send nor Sync
+unsafe impl<S: Send> Send for AllowStd<S> {}
+unsafe impl<S: Sync> Sync for AllowStd<S> {}
+
+impl<S> AllowStd<S>
+where
+ S: Unpin,
+{
+ fn with_context<F, R>(&mut self, f: F) -> io::Result<R>
+ where
+ F: FnOnce(&mut Context<'_>, Pin<&mut S>) -> Poll<io::Result<R>>,
+ {
+ unsafe {
+ assert!(!self.context.is_null());
+ let waker = &mut *(self.context as *mut _);
+ match f(waker, Pin::new(&mut self.inner)) {
+ Poll::Ready(r) => r,
+ Poll::Pending => Err(io::Error::from(io::ErrorKind::WouldBlock)),
+ }
+ }
+ }
+}
+
+impl<S> Read for AllowStd<S>
+where
+ S: AsyncRead + Unpin,
+{
+ fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+ let mut buf = ReadBuf::new(buf);
+ self.with_context(|ctx, stream| stream.poll_read(ctx, &mut buf))?;
+ Ok(buf.filled().len())
+ }
+}
+
+impl<S> Write for AllowStd<S>
+where
+ S: AsyncWrite + Unpin,
+{
+ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+ self.with_context(|ctx, stream| stream.poll_write(ctx, buf))
+ }
+
+ fn flush(&mut self) -> io::Result<()> {
+ self.with_context(|ctx, stream| stream.poll_flush(ctx))
+ }
+}
+
+impl<S> TlsStream<S> {
+ fn with_context<F, R>(&mut self, ctx: &mut Context<'_>, f: F) -> Poll<io::Result<R>>
+ where
+ F: FnOnce(&mut native_tls::TlsStream<AllowStd<S>>) -> io::Result<R>,
+ AllowStd<S>: Read + Write,
+ {
+ self.0.get_mut().context = ctx as *mut _ as *mut ();
+ let g = Guard(self);
+ match f(&mut (g.0).0) {
+ Ok(v) => Poll::Ready(Ok(v)),
+ Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => Poll::Pending,
+ Err(e) => Poll::Ready(Err(e)),
+ }
+ }
+
+ /// Returns a shared reference to the inner stream.
+ pub fn get_ref(&self) -> &native_tls::TlsStream<AllowStd<S>> {
+ &self.0
+ }
+
+ /// Returns a mutable reference to the inner stream.
+ pub fn get_mut(&mut self) -> &mut native_tls::TlsStream<AllowStd<S>> {
+ &mut self.0
+ }
+}
+
+impl<S> AsyncRead for TlsStream<S>
+where
+ S: AsyncRead + AsyncWrite + Unpin,
+{
+ fn poll_read(
+ mut self: Pin<&mut Self>,
+ ctx: &mut Context<'_>,
+ buf: &mut ReadBuf<'_>,
+ ) -> Poll<io::Result<()>> {
+ self.with_context(ctx, |s| {
+ let n = s.read(buf.initialize_unfilled())?;
+ buf.advance(n);
+ Ok(())
+ })
+ }
+}
+
+impl<S> AsyncWrite for TlsStream<S>
+where
+ S: AsyncRead + AsyncWrite + Unpin,
+{
+ fn poll_write(
+ mut self: Pin<&mut Self>,
+ ctx: &mut Context<'_>,
+ buf: &[u8],
+ ) -> Poll<io::Result<usize>> {
+ self.with_context(ctx, |s| s.write(buf))
+ }
+
+ fn poll_flush(mut self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll<io::Result<()>> {
+ self.with_context(ctx, |s| s.flush())
+ }
+
+ fn poll_shutdown(mut self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll<io::Result<()>> {
+ self.with_context(ctx, |s| s.shutdown())
+ }
+}
+
+#[cfg(unix)]
+impl<S> AsRawFd for TlsStream<S>
+where
+ S: AsRawFd,
+{
+ fn as_raw_fd(&self) -> RawFd {
+ self.get_ref().get_ref().get_ref().as_raw_fd()
+ }
+}
+
+#[cfg(windows)]
+impl<S> AsRawSocket for TlsStream<S>
+where
+ S: AsRawSocket,
+{
+ fn as_raw_socket(&self) -> RawSocket {
+ self.get_ref().get_ref().get_ref().as_raw_socket()
+ }
+}
+
+async fn handshake<F, S>(f: F, stream: S) -> Result<TlsStream<S>, Error>
+where
+ F: FnOnce(
+ AllowStd<S>,
+ ) -> Result<native_tls::TlsStream<AllowStd<S>>, HandshakeError<AllowStd<S>>>
+ + Unpin,
+ S: AsyncRead + AsyncWrite + Unpin,
+{
+ let start = StartedHandshakeFuture(Some(StartedHandshakeFutureInner { f, stream }));
+
+ match start.await {
+ Err(e) => Err(e),
+ Ok(StartedHandshake::Done(s)) => Ok(s),
+ Ok(StartedHandshake::Mid(s)) => MidHandshake(Some(s)).await,
+ }
+}
+
+impl<F, S> Future for StartedHandshakeFuture<F, S>
+where
+ F: FnOnce(
+ AllowStd<S>,
+ ) -> Result<native_tls::TlsStream<AllowStd<S>>, HandshakeError<AllowStd<S>>>
+ + Unpin,
+ S: Unpin,
+ AllowStd<S>: Read + Write,
+{
+ type Output = Result<StartedHandshake<S>, Error>;
+
+ fn poll(
+ mut self: Pin<&mut Self>,
+ ctx: &mut Context<'_>,
+ ) -> Poll<Result<StartedHandshake<S>, Error>> {
+ let inner = self.0.take().expect("future polled after completion");
+ let stream = AllowStd {
+ inner: inner.stream,
+ context: ctx as *mut _ as *mut (),
+ };
+
+ match (inner.f)(stream) {
+ Ok(mut s) => {
+ s.get_mut().context = null_mut();
+ Poll::Ready(Ok(StartedHandshake::Done(TlsStream(s))))
+ }
+ Err(HandshakeError::WouldBlock(mut s)) => {
+ s.get_mut().context = null_mut();
+ Poll::Ready(Ok(StartedHandshake::Mid(s)))
+ }
+ Err(HandshakeError::Failure(e)) => Poll::Ready(Err(e)),
+ }
+ }
+}
+
+impl TlsConnector {
+ /// Connects the provided stream with this connector, assuming the provided
+ /// domain.
+ ///
+ /// This function will internally call `TlsConnector::connect` to connect
+ /// the stream and returns a future representing the resolution of the
+ /// connection operation. The returned future will resolve to either
+ /// `TlsStream<S>` or `Error` depending if it's successful or not.
+ ///
+ /// This is typically used for clients who have already established, for
+ /// example, a TCP connection to a remote server. That stream is then
+ /// provided here to perform the client half of a connection to a
+ /// TLS-powered server.
+ pub async fn connect<S>(&self, domain: &str, stream: S) -> Result<TlsStream<S>, Error>
+ where
+ S: AsyncRead + AsyncWrite + Unpin,
+ {
+ handshake(move |s| self.0.connect(domain, s), stream).await
+ }
+}
+
+impl fmt::Debug for TlsConnector {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("TlsConnector").finish()
+ }
+}
+
+impl From<native_tls::TlsConnector> for TlsConnector {
+ fn from(inner: native_tls::TlsConnector) -> TlsConnector {
+ TlsConnector(inner)
+ }
+}
+
+impl TlsAcceptor {
+ /// Accepts a new client connection with the provided stream.
+ ///
+ /// This function will internally call `TlsAcceptor::accept` to connect
+ /// the stream and returns a future representing the resolution of the
+ /// connection operation. The returned future will resolve to either
+ /// `TlsStream<S>` or `Error` depending if it's successful or not.
+ ///
+ /// This is typically used after a new socket has been accepted from a
+ /// `TcpListener`. That socket is then passed to this function to perform
+ /// the server half of accepting a client connection.
+ pub async fn accept<S>(&self, stream: S) -> Result<TlsStream<S>, Error>
+ where
+ S: AsyncRead + AsyncWrite + Unpin,
+ {
+ handshake(move |s| self.0.accept(s), stream).await
+ }
+}
+
+impl fmt::Debug for TlsAcceptor {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("TlsAcceptor").finish()
+ }
+}
+
+impl From<native_tls::TlsAcceptor> for TlsAcceptor {
+ fn from(inner: native_tls::TlsAcceptor) -> TlsAcceptor {
+ TlsAcceptor(inner)
+ }
+}
+
+impl<S: AsyncRead + AsyncWrite + Unpin> Future for MidHandshake<S> {
+ type Output = Result<TlsStream<S>, Error>;
+
+ fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
+ let mut_self = self.get_mut();
+ let mut s = mut_self.0.take().expect("future polled after completion");
+
+ s.get_mut().context = cx as *mut _ as *mut ();
+ match s.handshake() {
+ Ok(mut s) => {
+ s.get_mut().context = null_mut();
+ Poll::Ready(Ok(TlsStream(s)))
+ }
+ Err(HandshakeError::WouldBlock(mut s)) => {
+ s.get_mut().context = null_mut();
+ mut_self.0 = Some(s);
+ Poll::Pending
+ }
+ Err(HandshakeError::Failure(e)) => Poll::Ready(Err(e)),
+ }
+ }
+}
+
+/// re-export native_tls
+pub mod native_tls {
+ pub use native_tls::*;
+}
diff --git a/vendor/tokio-native-tls/tests/bad.rs b/vendor/tokio-native-tls/tests/bad.rs
new file mode 100644
index 000000000..862d99845
--- /dev/null
+++ b/vendor/tokio-native-tls/tests/bad.rs
@@ -0,0 +1,122 @@
+#![warn(rust_2018_idioms)]
+
+use cfg_if::cfg_if;
+use native_tls::TlsConnector;
+use std::io::{self, Error};
+use std::net::ToSocketAddrs;
+use tokio::net::TcpStream;
+
+macro_rules! t {
+ ($e:expr) => {
+ match $e {
+ Ok(e) => e,
+ Err(e) => panic!("{} failed with {:?}", stringify!($e), e),
+ }
+ };
+}
+
+cfg_if! {
+ if #[cfg(feature = "force-rustls")] {
+ fn verify_failed(err: &Error, s: &str) {
+ let err = err.to_string();
+ assert!(err.contains(s), "bad error: {}", err);
+ }
+
+ fn assert_expired_error(err: &Error) {
+ verify_failed(err, "CertExpired");
+ }
+
+ fn assert_wrong_host(err: &Error) {
+ verify_failed(err, "CertNotValidForName");
+ }
+
+ fn assert_self_signed(err: &Error) {
+ verify_failed(err, "UnknownIssuer");
+ }
+
+ fn assert_untrusted_root(err: &Error) {
+ verify_failed(err, "UnknownIssuer");
+ }
+ } else if #[cfg(any(feature = "force-openssl",
+ all(not(target_os = "macos"),
+ not(target_os = "windows"),
+ not(target_os = "ios"))))] {
+ fn verify_failed(err: &Error) {
+ assert!(format!("{}", err).contains("certificate verify failed"))
+ }
+
+ use verify_failed as assert_expired_error;
+ use verify_failed as assert_wrong_host;
+ use verify_failed as assert_self_signed;
+ use verify_failed as assert_untrusted_root;
+ } else if #[cfg(any(target_os = "macos", target_os = "ios"))] {
+
+ fn assert_invalid_cert_chain(err: &Error) {
+ assert!(format!("{}", err).contains("was not trusted."))
+ }
+
+ use crate::assert_invalid_cert_chain as assert_expired_error;
+ use crate::assert_invalid_cert_chain as assert_wrong_host;
+ use crate::assert_invalid_cert_chain as assert_self_signed;
+ use crate::assert_invalid_cert_chain as assert_untrusted_root;
+ } else {
+ fn assert_expired_error(err: &Error) {
+ let s = err.to_string();
+ assert!(s.contains("system clock"), "error = {:?}", s);
+ }
+
+ fn assert_wrong_host(err: &Error) {
+ let s = err.to_string();
+ assert!(s.contains("CN name"), "error = {:?}", s);
+ }
+
+ fn assert_self_signed(err: &Error) {
+ let s = err.to_string();
+ assert!(s.contains("root certificate which is not trusted"), "error = {:?}", s);
+ }
+
+ use assert_self_signed as assert_untrusted_root;
+ }
+}
+
+async fn get_host(host: &'static str) -> Error {
+ drop(env_logger::try_init());
+
+ let addr = format!("{}:443", host);
+ let addr = t!(addr.to_socket_addrs()).next().unwrap();
+
+ let socket = t!(TcpStream::connect(&addr).await);
+ let builder = TlsConnector::builder();
+ let cx = t!(builder.build());
+ let cx = tokio_native_tls::TlsConnector::from(cx);
+ let res = cx
+ .connect(host, socket)
+ .await
+ .map_err(|e| Error::new(io::ErrorKind::Other, e));
+
+ assert!(res.is_err());
+ res.err().unwrap()
+}
+
+#[tokio::test]
+async fn expired() {
+ assert_expired_error(&get_host("expired.badssl.com").await)
+}
+
+// TODO: the OSX builders on Travis apparently fail this tests spuriously?
+// passes locally though? Seems... bad!
+#[tokio::test]
+#[cfg_attr(all(target_os = "macos", feature = "force-openssl"), ignore)]
+async fn wrong_host() {
+ assert_wrong_host(&get_host("wrong.host.badssl.com").await)
+}
+
+#[tokio::test]
+async fn self_signed() {
+ assert_self_signed(&get_host("self-signed.badssl.com").await)
+}
+
+#[tokio::test]
+async fn untrusted_root() {
+ assert_untrusted_root(&get_host("untrusted-root.badssl.com").await)
+}
diff --git a/vendor/tokio-native-tls/tests/cert.der b/vendor/tokio-native-tls/tests/cert.der
new file mode 100644
index 000000000..e1f964d6b
--- /dev/null
+++ b/vendor/tokio-native-tls/tests/cert.der
Binary files differ
diff --git a/vendor/tokio-native-tls/tests/google.rs b/vendor/tokio-native-tls/tests/google.rs
new file mode 100644
index 000000000..179358e3c
--- /dev/null
+++ b/vendor/tokio-native-tls/tests/google.rs
@@ -0,0 +1,99 @@
+#![warn(rust_2018_idioms)]
+
+use cfg_if::cfg_if;
+use native_tls::TlsConnector;
+use std::io;
+use std::net::ToSocketAddrs;
+use tokio::io::{AsyncReadExt, AsyncWriteExt};
+use tokio::net::TcpStream;
+
+macro_rules! t {
+ ($e:expr) => {
+ match $e {
+ Ok(e) => e,
+ Err(e) => panic!("{} failed with {:?}", stringify!($e), e),
+ }
+ };
+}
+
+cfg_if! {
+ if #[cfg(feature = "force-rustls")] {
+ fn assert_bad_hostname_error(err: &io::Error) {
+ let err = err.to_string();
+ assert!(err.contains("CertNotValidForName"), "bad error: {}", err);
+ }
+ } else if #[cfg(any(feature = "force-openssl",
+ all(not(target_os = "macos"),
+ not(target_os = "windows"),
+ not(target_os = "ios"))))] {
+ fn assert_bad_hostname_error(err: &io::Error) {
+ let err = err.get_ref().unwrap();
+ let err = err.downcast_ref::<native_tls::Error>().unwrap();
+ assert!(format!("{}", err).contains("certificate verify failed"));
+ }
+ } else if #[cfg(any(target_os = "macos", target_os = "ios"))] {
+ fn assert_bad_hostname_error(err: &io::Error) {
+ let err = err.get_ref().unwrap();
+ let err = err.downcast_ref::<native_tls::Error>().unwrap();
+ assert!(format!("{}", err).contains("was not trusted."));
+ }
+ } else {
+ fn assert_bad_hostname_error(err: &io::Error) {
+ let err = err.get_ref().unwrap();
+ let err = err.downcast_ref::<native_tls::Error>().unwrap();
+ assert!(format!("{}", err).contains("CN name"));
+ }
+ }
+}
+
+#[tokio::test]
+async fn fetch_google() {
+ drop(env_logger::try_init());
+
+ // First up, resolve google.com
+ let addr = t!("google.com:443".to_socket_addrs()).next().unwrap();
+
+ let socket = TcpStream::connect(&addr).await.unwrap();
+
+ // Send off the request by first negotiating an SSL handshake, then writing
+ // of our request, then flushing, then finally read off the response.
+ let builder = TlsConnector::builder();
+ let connector = t!(builder.build());
+ let connector = tokio_native_tls::TlsConnector::from(connector);
+ let mut socket = t!(connector.connect("google.com", socket).await);
+ t!(socket.write_all(b"GET / HTTP/1.0\r\n\r\n").await);
+ let mut data = Vec::new();
+ t!(socket.read_to_end(&mut data).await);
+
+ // any response code is fine
+ assert!(data.starts_with(b"HTTP/1.0 "));
+
+ let data = String::from_utf8_lossy(&data);
+ let data = data.trim_end();
+ assert!(data.ends_with("</html>") || data.ends_with("</HTML>"));
+}
+
+fn native2io(e: native_tls::Error) -> io::Error {
+ io::Error::new(io::ErrorKind::Other, e)
+}
+
+// see comment in bad.rs for ignore reason
+#[cfg_attr(all(target_os = "macos", feature = "force-openssl"), ignore)]
+#[tokio::test]
+async fn wrong_hostname_error() {
+ drop(env_logger::try_init());
+
+ let addr = t!("google.com:443".to_socket_addrs()).next().unwrap();
+
+ let socket = t!(TcpStream::connect(&addr).await);
+ let builder = TlsConnector::builder();
+ let connector = t!(builder.build());
+ let connector = tokio_native_tls::TlsConnector::from(connector);
+ let res = connector
+ .connect("rust-lang.org", socket)
+ .await
+ .map_err(native2io);
+
+ assert!(res.is_err());
+ assert_bad_hostname_error(&res.err().unwrap());
+}
diff --git a/vendor/tokio-native-tls/tests/identity.p12 b/vendor/tokio-native-tls/tests/identity.p12
new file mode 100644
index 000000000..d16abb8c7
--- /dev/null
+++ b/vendor/tokio-native-tls/tests/identity.p12
Binary files differ
diff --git a/vendor/tokio-native-tls/tests/root-ca.der b/vendor/tokio-native-tls/tests/root-ca.der
new file mode 100644
index 000000000..a9335c6fc
--- /dev/null
+++ b/vendor/tokio-native-tls/tests/root-ca.der
Binary files differ
diff --git a/vendor/tokio-native-tls/tests/smoke.rs b/vendor/tokio-native-tls/tests/smoke.rs
new file mode 100644
index 000000000..994fddee3
--- /dev/null
+++ b/vendor/tokio-native-tls/tests/smoke.rs
@@ -0,0 +1,172 @@
+use futures::join;
+use lazy_static::lazy_static;
+use native_tls::{Certificate, Identity};
+use std::{fs, io::Error, path::PathBuf, process::Command};
+use tokio::{
+ io::{AsyncReadExt, AsyncWrite, AsyncWriteExt},
+ net::{TcpListener, TcpStream},
+};
+use tokio_native_tls::{TlsAcceptor, TlsConnector};
+
+lazy_static! {
+ static ref CERT_DIR: PathBuf = {
+ if cfg!(unix) {
+ let dir = tempfile::TempDir::new().unwrap();
+ let path = dir.path().to_str().unwrap();
+
+ Command::new("sh")
+ .arg("-c")
+ .arg(format!("./scripts/generate-certificate.sh {}", path))
+ .output()
+ .expect("failed to execute process");
+
+ dir.into_path()
+ } else {
+ PathBuf::from("tests")
+ }
+ };
+}
+
+#[tokio::test]
+async fn client_to_server() {
+ let srv = TcpListener::bind("127.0.0.1:0").await.unwrap();
+ let addr = srv.local_addr().unwrap();
+
+ let (server_tls, client_tls) = context();
+
+ // Create a future to accept one socket, connect the ssl stream, and then
+ // read all the data from it.
+ let server = async move {
+ let (socket, _) = srv.accept().await.unwrap();
+ let mut socket = server_tls.accept(socket).await.unwrap();
+
+ // Verify access to all of the nested inner streams (e.g. so that peer
+ // certificates can be accessed). This is just a compile check.
+ let native_tls_stream: &native_tls::TlsStream<_> = socket.get_ref();
+ let _peer_cert = native_tls_stream.peer_certificate().unwrap();
+ let allow_std_stream: &tokio_native_tls::AllowStd<_> = native_tls_stream.get_ref();
+ let _tokio_tcp_stream: &tokio::net::TcpStream = allow_std_stream.get_ref();
+
+ let mut data = Vec::new();
+ socket.read_to_end(&mut data).await.unwrap();
+ data
+ };
+
+ // Create a future to connect to our server, connect the ssl stream, and
+ // then write a bunch of data to it.
+ let client = async move {
+ let socket = TcpStream::connect(&addr).await.unwrap();
+ let socket = client_tls.connect("foobar.com", socket).await.unwrap();
+ copy_data(socket).await
+ };
+
+ // Finally, run everything!
+ let (data, _) = join!(server, client);
+ // assert_eq!(amt, AMT);
+ assert!(data == vec![9; AMT]);
+}
+
+#[tokio::test]
+async fn server_to_client() {
+ // Create a server listening on a port, then figure out what that port is
+ let srv = TcpListener::bind("127.0.0.1:0").await.unwrap();
+ let addr = srv.local_addr().unwrap();
+
+ let (server_tls, client_tls) = context();
+
+ let server = async move {
+ let (socket, _) = srv.accept().await.unwrap();
+ let socket = server_tls.accept(socket).await.unwrap();
+ copy_data(socket).await
+ };
+
+ let client = async move {
+ let socket = TcpStream::connect(&addr).await.unwrap();
+ let mut socket = client_tls.connect("foobar.com", socket).await.unwrap();
+ let mut data = Vec::new();
+ socket.read_to_end(&mut data).await.unwrap();
+ data
+ };
+
+ // Finally, run everything!
+ let (_, data) = join!(server, client);
+ assert!(data == vec![9; AMT]);
+}
+
+#[tokio::test]
+async fn one_byte_at_a_time() {
+ const AMT: usize = 1024;
+
+ let srv = TcpListener::bind("127.0.0.1:0").await.unwrap();
+ let addr = srv.local_addr().unwrap();
+
+ let (server_tls, client_tls) = context();
+
+ let server = async move {
+ let (socket, _) = srv.accept().await.unwrap();
+ let mut socket = server_tls.accept(socket).await.unwrap();
+ let mut amt = 0;
+ for b in std::iter::repeat(9).take(AMT) {
+ let data = [b as u8];
+ socket.write_all(&data).await.unwrap();
+ amt += 1;
+ }
+ amt
+ };
+
+ let client = async move {
+ let socket = TcpStream::connect(&addr).await.unwrap();
+ let mut socket = client_tls.connect("foobar.com", socket).await.unwrap();
+ let mut data = Vec::new();
+ loop {
+ let mut buf = [0; 1];
+ match socket.read_exact(&mut buf).await {
+ Ok(_) => data.extend_from_slice(&buf),
+ Err(ref err) if err.kind() == std::io::ErrorKind::UnexpectedEof => break,
+ Err(err) => panic!("{}", err),
+ }
+ }
+ data
+ };
+
+ let (amt, data) = join!(server, client);
+ assert_eq!(amt, AMT);
+ assert!(data == vec![9; AMT as usize]);
+}
+
+fn context() -> (TlsAcceptor, TlsConnector) {
+ let pkcs12 = fs::read(CERT_DIR.join("identity.p12")).unwrap();
+ let der = fs::read(CERT_DIR.join("root-ca.der")).unwrap();
+
+ let identity = Identity::from_pkcs12(&pkcs12, "mypass").unwrap();
+ let acceptor = native_tls::TlsAcceptor::builder(identity).build().unwrap();
+
+ let cert = Certificate::from_der(&der).unwrap();
+ let connector = native_tls::TlsConnector::builder()
+ .add_root_certificate(cert)
+ .build()
+ .unwrap();
+
+ (acceptor.into(), connector.into())
+}
+
+const AMT: usize = 128 * 1024;
+
+async fn copy_data<W: AsyncWrite + Unpin>(mut w: W) -> Result<usize, Error> {
+ let mut data = vec![9; AMT as usize];
+ let mut amt = 0;
+ while !data.is_empty() {
+ let written = w.write(&data).await?;
+ if written <= data.len() {
+ amt += written;
+ data.resize(data.len() - written, 0);
+ } else {
+ w.write_all(&data).await?;
+ amt += data.len();
+ break;
+ }
+
+ println!("remaining: {}", data.len());
+ }
+ Ok(amt)
+}