diff options
author | Alex Auvolat <alex@adnab.me> | 2021-12-08 22:58:19 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-12-08 22:58:19 +0100 |
commit | ca8c5aad2378dd9f8ec525b3b0779f5c53cfe9eb (patch) | |
tree | ba5ac35eeacd9ee85363c231030313e7204ecc63 /src/proxy_config.rs | |
parent | 55f57df82e8486065bd563c21e1ea858c9f8969d (diff) | |
download | tricot-ca8c5aad2378dd9f8ec525b3b0779f5c53cfe9eb.tar.gz tricot-ca8c5aad2378dd9f8ec525b3b0779f5c53cfe9eb.zip |
Handle HTTPS targets
Diffstat (limited to 'src/proxy_config.rs')
-rw-r--r-- | src/proxy_config.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/proxy_config.rs b/src/proxy_config.rs index 8a64f53..2c55eb5 100644 --- a/src/proxy_config.rs +++ b/src/proxy_config.rs @@ -41,6 +41,7 @@ impl HostDescription { #[derive(Debug)] pub struct ProxyEntry { pub target_addr: SocketAddr, + pub https_target: bool, pub host: HostDescription, pub path_prefix: Option<String>, @@ -55,6 +56,9 @@ pub struct ProxyEntry { impl std::fmt::Display for ProxyEntry { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if self.https_target { + write!(f, "https://")?; + } write!(f, "{} ", self.target_addr)?; match &self.host { HostDescription::Hostname(h) => write!(f, "{}", h)?, @@ -94,7 +98,8 @@ fn parse_tricot_tag( add_headers: &[(String, String)], ) -> Option<ProxyEntry> { let splits = tag.split(' ').collect::<Vec<_>>(); - if (splits.len() != 2 && splits.len() != 3) || splits[0] != "tricot" { + if (splits.len() != 2 && splits.len() != 3) + || (splits[0] != "tricot" && splits[0] != "tricot-https") { return None; } @@ -121,6 +126,7 @@ fn parse_tricot_tag( Some(ProxyEntry { target_addr, + https_target: (splits[0] == "tricot-https"), host, path_prefix, priority, |