agate

Simple gemini server for static files
git clone https://github.com/mbrubeck/agate.git
Log | Files | Refs | README

commit b5fa24cb5b8e2d7eaec66466f7911e31e634dc50
parent beb48937e03be8bd2392a7670b8f3fe56a252b0e
Author: Johann150 <johann.galle@protonmail.com>
Date:   Fri, 19 Feb 2021 12:01:59 +0100

resolve TODO comment for Url

Diffstat:
MCargo.lock | 20++++++++++----------
MCargo.toml | 2+-
Msrc/main.rs | 5+++--
3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -43,9 +43,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bumpalo" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "bytes" @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", "percent-encoding", @@ -125,9 +125,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "idna" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" +checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" dependencies = [ "matches", "unicode-bidi", @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" +checksum = "dc250d6848c90d719ea2ce34546fb5df7af1d3fd189d10bf7bad80bfcebecd95" dependencies = [ "libc", "log", @@ -433,9 +433,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" +checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" dependencies = [ "form_urlencoded", "idna", diff --git a/Cargo.toml b/Cargo.toml @@ -21,7 +21,7 @@ mime_guess = "2.0" once_cell = "1.5" percent-encoding = "2.1" rustls = "0.19.0" -url = "2.2" +url = "2.2.1" glob = "0.3" configparser = "2.0" diff --git a/src/main.rs b/src/main.rs @@ -305,8 +305,9 @@ impl RequestHandle { } if let Some(host) = url.host() { - // TODO: to_owned can be removed in next version of url https://github.com/servo/rust-url/pull/651 - if !ARGS.hostnames.is_empty() && !ARGS.hostnames.contains(&host.to_owned()) { + // do not use "contains" here since it requires the same type and does + // not allow to check for Host<&str> if the vec contains Hostname<String> + if !ARGS.hostnames.is_empty() && !ARGS.hostnames.iter().any(|h| h == &host) { return Err((53, "Proxy request refused")); } } else {