Revproxy can't connect

This commit is contained in:
int 80h
2020-05-08 16:02:55 -04:00
parent a066e54acc
commit 839c6bbf81
3 changed files with 61 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ mod config;
mod status;
mod tls;
mod conn;
mod revproxy;
fn get_mime(path: &PathBuf) -> String {
let mut mime = "text/gemini";
@@ -124,6 +125,16 @@ async fn handle_connection(mut con: conn::Connection, srv: &config::ServerCfg) -
}
};
if srv.proxy.len() != 0 {
match srv.proxy.get(url.path()) {
Some(p) => {
revproxy::proxy(p.to_string(), url).await?;
return Ok(());
},
None => {},
}
}
if Some(srv.hostname.as_str()) != url.host_str() {
con.send_status(status::Status::ProxyRequestRefused, "Url doesn't match certificate!").await?;
return Ok(());