Update hyper

Not by me: https://github.com/getzola/zola/pull/1246
Can't be arsed to figure out the issue I had with cherry-picking
the commit and submodules.
Originally merged on master by mistake
This commit is contained in:
Vincent Prouillet 2021-01-05 22:06:52 +01:00
parent 6622078038
commit c4260e091d
3 changed files with 306 additions and 181 deletions

429
Cargo.lock generated
View file

@ -207,6 +207,12 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]]
name = "bytes"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1f8e949d755f9d79112b5bb46938e0ef9d3804a0b16dfab13aafcaa5f0fa72"
[[package]]
name = "cc"
version = "1.0.66"
@ -305,21 +311,11 @@ dependencies = [
"utils",
]
[[package]]
name = "console_error_panic_hook"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
dependencies = [
"cfg-if 0.1.10",
"wasm-bindgen",
]
[[package]]
name = "const_fn"
version = "0.4.4"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826"
checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6"
[[package]]
name = "cpuid-bool"
@ -462,9 +458,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "dtoa"
version = "0.4.6"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b"
checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e"
[[package]]
name = "either"
@ -752,7 +748,7 @@ dependencies = [
"futures-macro",
"futures-task",
"memchr",
"pin-project 1.0.2",
"pin-project 1.0.3",
"pin-utils",
"proc-macro-hack",
"proc-macro-nested",
@ -780,15 +776,26 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.1.15"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
[[package]]
name = "getrandom"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6"
dependencies = [
"cfg-if 1.0.0",
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
]
[[package]]
name = "gh-emoji"
version = "1.0.3"
@ -853,8 +860,28 @@ dependencies = [
"http",
"indexmap",
"slab",
"tokio",
"tokio-util",
"tokio 0.2.24",
"tokio-util 0.3.1",
"tracing",
"tracing-futures",
]
[[package]]
name = "h2"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5"
dependencies = [
"bytes 1.0.0",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http",
"indexmap",
"slab",
"tokio 1.0.1",
"tokio-util 0.6.0",
"tracing",
"tracing-futures",
]
@ -869,17 +896,11 @@ dependencies = [
"autocfg",
]
[[package]]
name = "hashbrown"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
[[package]]
name = "heck"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
dependencies = [
"unicode-segmentation",
]
@ -909,9 +930,9 @@ dependencies = [
[[package]]
name = "http"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9"
checksum = "84129d298a6d57d246960ff8eb831ca4af3f96d29e2e28848dae275408658e26"
dependencies = [
"bytes 0.5.6",
"fnv",
@ -928,6 +949,16 @@ dependencies = [
"http",
]
[[package]]
name = "http-body"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994"
dependencies = [
"bytes 1.0.0",
"http",
]
[[package]]
name = "httparse"
version = "1.3.4"
@ -956,15 +987,39 @@ dependencies = [
"futures-channel",
"futures-core",
"futures-util",
"h2",
"h2 0.2.7",
"http",
"http-body",
"http-body 0.3.1",
"httparse",
"httpdate",
"itoa",
"pin-project 1.0.2",
"pin-project 1.0.3",
"socket2",
"tokio",
"tokio 0.2.24",
"tower-service",
"tracing",
"want",
]
[[package]]
name = "hyper"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12219dc884514cb4a6a03737f4413c0e01c23a1b059b0156004b23f1e19dccbe"
dependencies = [
"bytes 1.0.0",
"futures-channel",
"futures-core",
"futures-util",
"h2 0.3.0",
"http",
"http-body 0.4.0",
"httparse",
"httpdate",
"itoa",
"pin-project 1.0.3",
"socket2",
"tokio 1.0.1",
"tower-service",
"tracing",
"want",
@ -978,31 +1033,14 @@ checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6"
dependencies = [
"bytes 0.5.6",
"futures-util",
"hyper",
"hyper 0.13.9",
"log",
"rustls",
"tokio",
"tokio 0.2.24",
"tokio-rustls",
"webpki",
]
[[package]]
name = "hyper-staticfile"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f059991575d4be26e3946276a4f3ee24bcf17a232449407354045eaf064d3475"
dependencies = [
"chrono",
"futures-util",
"http",
"hyper",
"mime_guess",
"percent-encoding",
"tokio",
"url",
"winapi 0.3.9",
]
[[package]]
name = "idna"
version = "0.2.0"
@ -1066,12 +1104,12 @@ dependencies = [
[[package]]
name = "indexmap"
version = "1.6.0"
version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
checksum = "4e47a3566dd4fd4eec714ae6ceabdee0caec795be835c223d92c2d40f1e8cf1c"
dependencies = [
"autocfg",
"hashbrown 0.9.1",
"hashbrown",
]
[[package]]
@ -1111,9 +1149,9 @@ checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135"
[[package]]
name = "itoa"
version = "0.4.6"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]]
name = "jieba-rs"
@ -1122,7 +1160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ca2de723e93727460917d9542f7ae35a74d03d93923f03380a0238d860d137c"
dependencies = [
"cedarwood",
"hashbrown 0.8.2",
"hashbrown",
"lazy_static",
"phf",
"phf_codegen",
@ -1396,9 +1434,9 @@ dependencies = [
[[package]]
name = "minify-html"
version = "0.3.9"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ac7185726f6e49b3a692680c54aeee49027351696a2db1bcebafdc33d077e3"
checksum = "dedb5736b6b92db14a164678219f6738bc1104bf66d915d7143efc825f551323"
dependencies = [
"aho-corasick",
"lazy_static",
@ -1437,12 +1475,25 @@ dependencies = [
"kernel32-sys",
"libc",
"log",
"miow",
"miow 0.2.2",
"net2",
"slab",
"winapi 0.2.8",
]
[[package]]
name = "mio"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7"
dependencies = [
"libc",
"log",
"miow 0.3.6",
"ntapi",
"winapi 0.3.9",
]
[[package]]
name = "mio-extras"
version = "2.0.6"
@ -1451,7 +1502,7 @@ checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
dependencies = [
"lazycell",
"log",
"mio",
"mio 0.6.23",
"slab",
]
@ -1467,6 +1518,16 @@ dependencies = [
"ws2_32-sys",
]
[[package]]
name = "miow"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
dependencies = [
"socket2",
"winapi 0.3.9",
]
[[package]]
name = "mockito"
version = "0.28.0"
@ -1479,7 +1540,7 @@ dependencies = [
"httparse",
"lazy_static",
"log",
"rand",
"rand 0.7.3",
"regex",
"serde_json",
"serde_urlencoded 0.6.1",
@ -1593,12 +1654,21 @@ dependencies = [
"fsevent-sys",
"inotify",
"libc",
"mio",
"mio 0.6.23",
"mio-extras",
"walkdir",
"winapi 0.3.9",
]
[[package]]
name = "ntapi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "num-integer"
version = "0.1.44"
@ -1783,7 +1853,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526"
dependencies = [
"phf_shared",
"rand",
"rand 0.7.3",
]
[[package]]
@ -1806,11 +1876,11 @@ dependencies = [
[[package]]
name = "pin-project"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7"
checksum = "5a83804639aad6ba65345661744708855f9fbcb71176ea8d28d05aeb11d975e7"
dependencies = [
"pin-project-internal 1.0.2",
"pin-project-internal 1.0.3",
]
[[package]]
@ -1826,9 +1896,9 @@ dependencies = [
[[package]]
name = "pin-project-internal"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f"
checksum = "b7bcc46b8f73443d15bc1c5fecbb315718491fa9187fa483f0e359323cde8b3a"
dependencies = [
"proc-macro2",
"quote",
@ -1843,9 +1913,9 @@ checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b"
[[package]]
name = "pin-project-lite"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c"
checksum = "e36743d754ccdf9954c2e352ce2d4b106e024c814f6499c2dadff80da9a442d8"
[[package]]
name = "pin-utils"
@ -1861,11 +1931,11 @@ checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
[[package]]
name = "plist"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b336d94e8e4ce29bf15bba393164629764744c567e8ad306cc1fdd0119967fd"
checksum = "4dc57ccf442c7414b790e8e7b72fb4d776a66c7680129360946d9aaa6f5311e9"
dependencies = [
"base64 0.12.3",
"base64 0.13.0",
"chrono",
"indexmap",
"line-wrap",
@ -1961,9 +2031,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quote"
version = "1.0.7"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
dependencies = [
"proc-macro2",
]
@ -1974,14 +2044,26 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom",
"getrandom 0.1.16",
"libc",
"rand_chacha",
"rand_core",
"rand_hc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc 0.2.0",
"rand_pcg",
]
[[package]]
name = "rand"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c24fcd450d3fa2b592732565aa4f17a27a61c65ece4726353e000939b0edee34"
dependencies = [
"libc",
"rand_chacha 0.3.0",
"rand_core 0.6.1",
"rand_hc 0.3.0",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
@ -1989,7 +2071,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core",
"rand_core 0.5.1",
]
[[package]]
name = "rand_chacha"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [
"ppv-lite86",
"rand_core 0.6.1",
]
[[package]]
@ -1998,7 +2090,16 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom",
"getrandom 0.1.16",
]
[[package]]
name = "rand_core"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5"
dependencies = [
"getrandom 0.2.1",
]
[[package]]
@ -2007,7 +2108,16 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core",
"rand_core 0.5.1",
]
[[package]]
name = "rand_hc"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [
"rand_core 0.6.1",
]
[[package]]
@ -2016,7 +2126,7 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
dependencies = [
"rand_core",
"rand_core 0.5.1",
]
[[package]]
@ -2122,9 +2232,9 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.10.9"
version = "0.10.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb15d6255c792356a0f578d8a645c677904dc02e862bebe2ecc18e0c01b9a0ce"
checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c"
dependencies = [
"base64 0.13.0",
"bytes 0.5.6",
@ -2132,8 +2242,8 @@ dependencies = [
"futures-core",
"futures-util",
"http",
"http-body",
"hyper",
"http-body 0.3.1",
"hyper 0.13.9",
"hyper-rustls",
"ipnet",
"js-sys",
@ -2142,16 +2252,15 @@ dependencies = [
"mime",
"mime_guess",
"percent-encoding",
"pin-project-lite 0.2.0",
"pin-project-lite 0.2.1",
"rustls",
"serde",
"serde_urlencoded 0.7.0",
"tokio",
"tokio 0.2.24",
"tokio-rustls",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test",
"web-sys",
"webpki-roots",
"winreg",
@ -2174,9 +2283,9 @@ dependencies = [
[[package]]
name = "roxmltree"
version = "0.11.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5001f134077069d87f77c8b9452b690df2445f7a43f1c7ca4a1af8dd505789d"
checksum = "dbf7d7b1ea646d380d0e8153158063a6da7efe30ddbf3184042848e3f8a6f671"
dependencies = [
"xmlparser",
]
@ -2247,12 +2356,6 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]]
name = "scoped_threadpool"
version = "0.1.9"
@ -2309,9 +2412,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.60"
version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779"
checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a"
dependencies = [
"indexmap",
"itoa",
@ -2345,9 +2448,9 @@ dependencies = [
[[package]]
name = "serde_yaml"
version = "0.8.14"
version = "0.8.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7baae0a99f1a324984bcdc5f0718384c1f69775f1c7eec8b859b71b443e3fd7"
checksum = "971be8f6e4d4a47163b405a3df70d14359186f9ab0f3a3ec37df144ca1ce089f"
dependencies = [
"dtoa",
"linked-hash-map",
@ -2436,19 +2539,18 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.5.1"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75"
checksum = "1a55ca5f3b68e41c979bf8c46a6f1da892ca4db8f94023ce0bd32407573b1ac0"
[[package]]
name = "socket2"
version = "0.3.17"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c29947abdee2a218277abeca306f25789c938e500ea5a9d4b12a5a504466902"
checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall",
"winapi 0.3.9",
]
@ -2515,9 +2617,9 @@ dependencies = [
[[package]]
name = "svg_metadata"
version = "0.4.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fe5b1fbd62339f055704951dcaf2e757c460b9f6abe17f6de0d2563da821c57"
checksum = "d39f36262efe61096a17aa42140b0e44b9189806c3fa71ab3cff123429938eb0"
dependencies = [
"doc-comment",
"lazy_static",
@ -2527,9 +2629,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.54"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44"
checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6"
dependencies = [
"proc-macro2",
"quote",
@ -2566,7 +2668,7 @@ checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
dependencies = [
"cfg-if 0.1.10",
"libc",
"rand",
"rand 0.7.3",
"redox_syscall",
"remove_dir_all",
"winapi 0.3.9",
@ -2610,9 +2712,9 @@ dependencies = [
[[package]]
name = "tera"
version = "1.5.0"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1381c83828bedd5ce4e59473110afa5381ffe523406d9ade4b77c9f7be70ff9a"
checksum = "eac6ab7eacf40937241959d540670f06209c38ceadb62116999db4a950fbf8dc"
dependencies = [
"chrono",
"chrono-tz",
@ -2622,7 +2724,7 @@ dependencies = [
"percent-encoding",
"pest",
"pest_derive",
"rand",
"rand 0.8.1",
"regex",
"serde",
"serde_json",
@ -2718,22 +2820,24 @@ dependencies = [
"iovec",
"lazy_static",
"memchr",
"mio",
"mio 0.6.23",
"num_cpus",
"pin-project-lite 0.1.11",
"slab",
"tokio-macros",
]
[[package]]
name = "tokio-macros"
version = "0.2.6"
name = "tokio"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a"
checksum = "d258221f566b6c803c7b4714abadc080172b272090cdc5e244a6d4dd13c3a6bd"
dependencies = [
"proc-macro2",
"quote",
"syn",
"autocfg",
"bytes 1.0.0",
"libc",
"memchr",
"mio 0.7.7",
"pin-project-lite 0.2.1",
]
[[package]]
@ -2744,10 +2848,21 @@ checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a"
dependencies = [
"futures-core",
"rustls",
"tokio",
"tokio 0.2.24",
"webpki",
]
[[package]]
name = "tokio-stream"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4cdeb73537e63f98adcd73138af75e3f368ccaecffaa29d7eb61b9f5a440457"
dependencies = [
"futures-core",
"pin-project-lite 0.2.1",
"tokio 1.0.1",
]
[[package]]
name = "tokio-util"
version = "0.3.1"
@ -2759,14 +2874,29 @@ dependencies = [
"futures-sink",
"log",
"pin-project-lite 0.1.11",
"tokio",
"tokio 0.2.24",
]
[[package]]
name = "tokio-util"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36135b7e7da911f5f8b9331209f7fab4cc13498f3fff52f72a710c78187e3148"
dependencies = [
"bytes 1.0.0",
"futures-core",
"futures-sink",
"log",
"pin-project-lite 0.2.1",
"tokio 1.0.1",
"tokio-stream",
]
[[package]]
name = "toml"
version = "0.5.7"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645"
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
dependencies = [
"serde",
]
@ -2785,7 +2915,7 @@ checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3"
dependencies = [
"cfg-if 1.0.0",
"log",
"pin-project-lite 0.2.0",
"pin-project-lite 0.2.1",
"tracing-core",
]
@ -3081,30 +3211,6 @@ version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158"
[[package]]
name = "wasm-bindgen-test"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0355fa0c1f9b792a09b6dcb6a8be24d51e71e6d74972f9eb4a44c4c004d24a25"
dependencies = [
"console_error_panic_hook",
"js-sys",
"scoped-tls",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test-macro",
]
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27e07b46b98024c2ba2f9e83a10c2ef0515f057f2da299c1762a2017de80438b"
dependencies = [
"proc-macro2",
"quote",
]
[[package]]
name = "web-sys"
version = "0.3.46"
@ -3202,9 +3308,9 @@ dependencies = [
"bytes 0.4.12",
"httparse",
"log",
"mio",
"mio 0.6.23",
"mio-extras",
"rand",
"rand 0.7.3",
"sha-1",
"slab",
"url",
@ -3246,9 +3352,9 @@ checksum = "114ba2b24d2167ef6d67d7d04c8cc86522b87f490025f39f0303b7db5bf5e3d8"
[[package]]
name = "yaml-rust"
version = "0.4.4"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d"
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]
@ -3264,8 +3370,7 @@ dependencies = [
"errors",
"front_matter",
"globset",
"hyper",
"hyper-staticfile",
"hyper 0.14.2",
"lazy_static",
"notify",
"open",
@ -3273,7 +3378,7 @@ dependencies = [
"serde_json",
"site",
"termcolor",
"tokio",
"tokio 1.0.1",
"url",
"utils",
"ws",

View file

@ -27,9 +27,8 @@ termcolor = "1.0.4"
# Used in init to ensure the url given as base_url is a valid one
url = "2"
# Below is for the serve cmd
hyper = { version = "0.13", default-features = false, features = ["runtime"] }
hyper-staticfile = "0.5"
tokio = { version = "0.2", default-features = false, features = [] }
hyper = { version = "0.14.1", default-features = false, features = ["runtime", "server", "http2", "http1"] }
tokio = { version = "1.0.1", default-features = false, features = ["rt", "fs"] }
notify = "4"
ws = "0.9"
ctrlc = "3"

View file

@ -29,9 +29,9 @@ use std::thread;
use std::time::{Duration, Instant};
use hyper::header;
use hyper::server::Server;
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Method, Request, Response, Server, StatusCode};
use hyper_staticfile::ResolveResult;
use hyper::{Body, Method, Request, Response, StatusCode};
use chrono::prelude::*;
use notify::{watcher, RecursiveMode, Watcher};
@ -70,7 +70,7 @@ static NOT_FOUND_TEXT: &[u8] = b"Not Found";
// This is dist/livereload.min.js from the LiveReload.js v3.2.4 release
const LIVE_RELOAD: &str = include_str!("livereload.js");
async fn handle_request(req: Request<Body>, root: PathBuf) -> Result<Response<Body>> {
async fn handle_request(req: Request<Body>, mut root: PathBuf) -> Result<Response<Body>> {
let mut path = RelativePathBuf::new();
for c in req.uri().path().split('/') {
@ -90,18 +90,37 @@ async fn handle_request(req: Request<Body>, root: PathBuf) -> Result<Response<Bo
return Ok(in_memory_html(content));
}
let result = hyper_staticfile::resolve(&root, &req).await.unwrap();
match result {
ResolveResult::MethodNotMatched => return Ok(method_not_allowed()),
ResolveResult::NotFound | ResolveResult::UriNotMatched => {
let not_found_path = RelativePath::new("404.html");
let content_404 = SITE_CONTENT.read().unwrap().get(not_found_path).cloned();
return Ok(not_found(content_404));
}
_ => (),
// Handle only `GET`/`HEAD` requests
match *req.method() {
Method::HEAD | Method::GET => {}
_ => return Ok(method_not_allowed()),
}
// Handle only simple path requests
if req.uri().scheme_str().is_some() || req.uri().host().is_some() {
return Ok(not_found());
}
// Remove the trailing slash from the request path
// otherwise `PathBuf` will interpret it as an absolute path
root.push(&req.uri().path()[1..]);
let result = tokio::fs::read(root).await;
let contents = match result {
Err(err) => match err.kind() {
std::io::ErrorKind::NotFound => return Ok(not_found()),
std::io::ErrorKind::PermissionDenied => {
return Ok(Response::builder()
.status(StatusCode::FORBIDDEN)
.body(Body::empty())
.unwrap())
}
_ => panic!("{}", err),
},
Ok(contents) => contents,
};
Ok(hyper_staticfile::ResponseBuilder::new().request(&req).build(result).unwrap())
Ok(Response::builder().status(StatusCode::OK).body(Body::from(contents)).unwrap())
}
fn livereload_js() -> Response<Body> {
@ -128,7 +147,10 @@ fn method_not_allowed() -> Response<Body> {
.expect("Could not build Method Not Allowed response")
}
fn not_found(content: Option<String>) -> Response<Body> {
fn not_found() -> Response<Body> {
let not_found_path = RelativePath::new("404.html");
let content = SITE_CONTENT.read().unwrap().get(not_found_path).cloned();
if let Some(body) = content {
return Response::builder()
.header(header::CONTENT_TYPE, "text/html")
@ -285,9 +307,8 @@ pub fn serve(
thread::spawn(move || {
let addr = address.parse().unwrap();
let mut rt = tokio::runtime::Builder::new()
let rt = tokio::runtime::Builder::new_current_thread()
.enable_all()
.basic_scheduler()
.build()
.expect("Could not build tokio runtime");