From 0c6a68addf4895336fee3af4bf2fd946fcd37d73 Mon Sep 17 00:00:00 2001 From: Ruslan Pislari Date: Fri, 4 Apr 2025 13:11:31 +0300 Subject: [PATCH 1/2] fix: backend request authority --- crates/http-service/src/state.rs | 20 +++++--------------- src/context.rs | 5 ++++- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/crates/http-service/src/state.rs b/crates/http-service/src/state.rs index df1bd57..063914a 100644 --- a/crates/http-service/src/state.rs +++ b/crates/http-service/src/state.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Error}; +use anyhow::Error; use dictionary::Dictionary; use http::request::Parts; use http::uri::Scheme; @@ -71,31 +71,21 @@ impl BackendRequest for HttpState { headers.extend(self.propagate_headers.clone()); - let host = canonical_host_name(&headers, &original_url)?; - let uri = canonical_url(&original_url, &host, self.uri.path())?; - - head.uri = uri; - head.headers = headers; - let authority = self .http_backend .uri() .authority() .map(|a| a.as_str().to_string()) .unwrap_or("localhost:10080".to_string()); + let uri = canonical_url(&original_url, &authority, self.uri.path())?; + + head.uri = uri; + head.headers = headers; Ok((authority, head)) } } -// extract canonical host name -fn canonical_host_name(headers: &HeaderMap, original_uri: &Uri) -> anyhow::Result { - let host = headers.get(header::HOST).and_then(|v| v.to_str().ok()); - host.or_else(|| original_uri.host()) - .ok_or(anyhow!("Could determine a Host header")) - .map(|h| h.to_string()) -} - // make canonical uri for backend fn canonical_url( original_url: &Uri, diff --git a/src/context.rs b/src/context.rs index c919f1a..4a985ee 100644 --- a/src/context.rs +++ b/src/context.rs @@ -74,7 +74,10 @@ impl ContextT for Context { } fn make_key_value_store(&self, stores: &Vec) -> KeyValueStore { - let stores = stores.iter().map(|s| (s.name.clone(), s.param.clone())).collect(); + let stores = stores + .iter() + .map(|s| (s.name.clone(), s.param.clone())) + .collect(); KeyValueStore::new(stores, Arc::new(CliStoreManager)) } } From c2c030e85f35b4fc772f8eb2cc842d8cbef50738 Mon Sep 17 00:00:00 2001 From: Ruslan Pislari Date: Fri, 4 Apr 2025 13:35:37 +0300 Subject: [PATCH 2/2] chore: Release --- CHANGELOG.md | 10 ++++++++++ Cargo.lock | 16 ++++++++-------- Cargo.toml | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8380c9c..a2216eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,22 @@ All notable changes to this project will be documented in this file. +## [0.11.6] - 2025-04-04 + +### 🐛 Bug Fixes + +- Backend request authority + ## [0.11.5] - 2025-04-03 ### 🐛 Bug Fixes - Mapping store name with db url +### ⚙️ Miscellaneous Tasks + +- Release + ## [0.11.4] - 2025-04-02 ### 🚜 Refactor diff --git a/Cargo.lock b/Cargo.lock index 33373e7..e740d5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -781,7 +781,7 @@ dependencies = [ [[package]] name = "dictionary" -version = "0.11.5" +version = "0.11.6" dependencies = [ "async-trait", "reactor", @@ -955,7 +955,7 @@ dependencies = [ [[package]] name = "fastedge-run" -version = "0.11.5" +version = "0.11.6" dependencies = [ "anyhow", "async-trait", @@ -1528,7 +1528,7 @@ dependencies = [ [[package]] name = "http-backend" -version = "0.11.5" +version = "0.11.6" dependencies = [ "anyhow", "claims", @@ -1571,7 +1571,7 @@ dependencies = [ [[package]] name = "http-service" -version = "0.11.5" +version = "0.11.6" dependencies = [ "anyhow", "async-trait", @@ -1962,7 +1962,7 @@ dependencies = [ [[package]] name = "key-value-store" -version = "0.11.5" +version = "0.11.6" dependencies = [ "async-trait", "reactor", @@ -2801,7 +2801,7 @@ dependencies = [ [[package]] name = "reactor" -version = "0.11.5" +version = "0.11.6" dependencies = [ "wasmtime", ] @@ -2912,7 +2912,7 @@ dependencies = [ [[package]] name = "runtime" -version = "0.11.5" +version = "0.11.6" dependencies = [ "anyhow", "async-trait", @@ -3093,7 +3093,7 @@ dependencies = [ [[package]] name = "secret" -version = "0.11.5" +version = "0.11.6" dependencies = [ "anyhow", "reactor", diff --git a/Cargo.toml b/Cargo.toml index 81dc1ea..8c466a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["crates/*"] resolver = "2" [workspace.package] -version = "0.11.5" +version = "0.11.6" edition = "2021" publish = false authors = ["FastEdge Development Team"]