Port checked from config
This commit is contained in:
@@ -7,7 +7,7 @@ use std::path::Path;
|
|||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub port: i32,
|
pub port: u16,
|
||||||
pub host: String,
|
pub host: String,
|
||||||
pub server: Vec<Server>,
|
pub server: Vec<Server>,
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ pub struct ServerCfg {
|
|||||||
pub cert: String,
|
pub cert: String,
|
||||||
pub cgi: String,
|
pub cgi: String,
|
||||||
pub usrdir: bool,
|
pub usrdir: bool,
|
||||||
pub port: i32,
|
pub port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
|
|||||||
@@ -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?;
|
con.send_status(status::Status::ProxyRequestRefused, "Url doesn't match certificate!").await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
// TODO get port from config
|
|
||||||
match url.port() {
|
match url.port() {
|
||||||
Some(p) => { if p != 1965 {
|
Some(p) => { if p != srv.port {
|
||||||
con.send_status(status::Status::ProxyRequestRefused, "Wrong Port!").await?;
|
con.send_status(status::Status::ProxyRequestRefused, "Wrong Port!").await?;
|
||||||
}},
|
}},
|
||||||
None => {}
|
None => {}
|
||||||
|
|||||||
Reference in New Issue
Block a user