support upgrade-insecure-requests option

This commit is contained in:
Jun Kurihara 2022-07-10 04:28:50 +09:00
commit 1a80e405b5
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
8 changed files with 112 additions and 29 deletions

View file

@ -3,6 +3,7 @@ use crate::error::*;
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
pub enum UpstreamOption {
OverrideHost,
UpgradeInsecureRequests,
// TODO: Adds more options for heder override
}
impl TryFrom<&str> for UpstreamOption {
@ -10,6 +11,7 @@ impl TryFrom<&str> for UpstreamOption {
fn try_from(val: &str) -> Result<Self> {
match val {
"override_host" => Ok(Self::OverrideHost),
"upgrade_insecure_requests" => Ok(Self::UpgradeInsecureRequests),
_ => Err(anyhow!("Unsupported header option")),
}
}