From 24a47ccd70d9ec09891f8cca12bdafce383fdd66 Mon Sep 17 00:00:00 2001 From: int 80h Date: Fri, 8 May 2020 16:12:09 -0400 Subject: [PATCH] Port checked from config --- src/config.rs | 4 ++-- src/main.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 346cf59..7ac20a5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,7 +7,7 @@ use std::path::Path; #[derive(Debug, Deserialize, Clone)] pub struct Config { - pub port: i32, + pub port: u16, pub host: String, pub server: Vec, } @@ -30,7 +30,7 @@ pub struct ServerCfg { pub cert: String, pub cgi: String, pub usrdir: bool, - pub port: i32, + pub port: u16, } impl Config { diff --git a/src/main.rs b/src/main.rs index 5faf846..d7d94dd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -128,9 +128,9 @@ async fn handle_connection(mut con: conn::Connection, srv: &config::ServerCfg) - con.send_status(status::Status::ProxyRequestRefused, "Url doesn't match certificate!").await?; return Ok(()); } - // TODO get port from config + match url.port() { - Some(p) => { if p != 1965 { + Some(p) => { if p != srv.port { con.send_status(status::Status::ProxyRequestRefused, "Wrong Port!").await?; }}, None => {}