initial proxy impl

This commit is contained in:
rustysec
2020-03-13 11:28:50 -07:00
committed by Martin Algesten
parent 2956683870
commit 3b0df412ef
6 changed files with 190 additions and 11 deletions

View File

@@ -23,6 +23,12 @@ pub enum Error {
BadHeader,
/// Some unspecified `std::io::Error`. Synthetic error `500`.
Io(IoError),
/// Proxy information was not properly formatted
BadProxy,
/// Proxy credentials were not properly formatted
BadProxyCreds,
/// Proxy could not connect
ProxyConnect,
}
impl Error {
@@ -47,6 +53,9 @@ impl Error {
Error::BadStatus => 500,
Error::BadHeader => 500,
Error::Io(_) => 500,
Error::BadProxy => 500,
Error::BadProxyCreds => 500,
Error::ProxyConnect => 500,
}
}
@@ -62,6 +71,9 @@ impl Error {
Error::BadStatus => "Bad Status",
Error::BadHeader => "Bad Header",
Error::Io(_) => "Network Error",
Error::BadProxy => "Malformed proxy",
Error::BadProxyCreds => "Failed to parse proxy credentials",
Error::ProxyConnect => "Proxy failed to connect",
}
}
@@ -77,6 +89,9 @@ impl Error {
Error::BadStatus => "Bad Status".to_string(),
Error::BadHeader => "Bad Header".to_string(),
Error::Io(ioe) => format!("Network Error: {}", ioe),
Error::BadProxy => "Malformed proxy".to_string(),
Error::BadProxyCreds => "Failed to parse proxy credentials".to_string(),
Error::ProxyConnect => "Proxy failed to connect".to_string(),
}
}
}