From 5c26ecadd9b78ad8b8b5dd571912c30728eb94db Mon Sep 17 00:00:00 2001 From: siddhantCodes Date: Wed, 17 Sep 2025 15:26:07 +0530 Subject: [PATCH 1/3] minor: flake update --- flake.lock | 16 +++++++++------- flake.nix | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index f9557d4a1f..055c143489 100644 --- a/flake.lock +++ b/flake.lock @@ -20,10 +20,12 @@ }, "nixpkgs": { "locked": { - "lastModified": 0, - "narHash": "sha256-ZHSasdLwEEjSOD/WTW1o7dr3/EjuYsdwYB4NSgICZ2I=", - "path": "/nix/store/zi50l9z7jjfv92nr6m12czq5qcrrmqdr-source", - "type": "path" + "lastModified": 1757746433, + "narHash": "sha256-fEvTiU4s9lWgW7mYEU/1QUPirgkn+odUBTaindgiziY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6d7ec06d6868ac6d94c371458fc2391ded9ff13d", + "type": "github" }, "original": { "id": "nixpkgs", @@ -44,11 +46,11 @@ ] }, "locked": { - "lastModified": 1750991972, - "narHash": "sha256-jzadGZL1MtqmHb5AZcjZhHpNulOdMZPxf8Wifg8e5VA=", + "lastModified": 1757903816, + "narHash": "sha256-bVi6V/HZtUedmLPM5OP/tYhwi6G7FIyFH6+/EFb7qGo=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "b6509555d8ffaa0727f998af6ace901c5b78dc26", + "rev": "11a559c0baf1019bde7bbf0363a22db978be4363", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 666da4e91e..4ef85843c1 100644 --- a/flake.nix +++ b/flake.nix @@ -28,7 +28,8 @@ openssl.dev diesel-cli rust-analyzer-unwrapped - ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Foundation ]; + git + ] ++ lib.optionals stdenv.isDarwin [ ]; shellHook = '' export PATH="$PATH:$HOME/.cargo/bin" From 7628bd4051a20b6f152505575d3952bda3d5ab11 Mon Sep 17 00:00:00 2001 From: siddhantCodes Date: Wed, 17 Sep 2025 15:26:25 +0530 Subject: [PATCH 2/3] fix: Do not override query params of http processor's target url The http processor `url` should not be manipulated by `current_request` properties. If the user code wants to inherit something from current request then they should explicitly add that property to the `url` (or custom headers) while using the `http` processor. This is an immediate fix for the following situation: An .ftd file for url /experts/?payment=true has a call to http processor like this: ```ftd -- expert-detail-response res: $processor$: pr.http method: GET url: /experts/?id=120 ``` The http processor overrides the `id` query param with the current request query params (payment=true), which is clearly wrong! The right thing is to not manipulate the user provided `url` at all. If the user want to append `payment=true` then they will have to change their ftd code so that the `url` becomes "/experts/?id=120&payment=true". --- fastn-core/src/library2022/processor/http.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fastn-core/src/library2022/processor/http.rs b/fastn-core/src/library2022/processor/http.rs index d6fe682007..b84875c2d9 100644 --- a/fastn-core/src/library2022/processor/http.rs +++ b/fastn-core/src/library2022/processor/http.rs @@ -121,12 +121,11 @@ pub async fn process( doc_id: doc.name.to_string(), line_number, })?; - if !req_config.request.query_string().is_empty() { - url.set_query(Some(req_config.request.query_string())); - } (url, mountpoint, conf) }; + tracing::info!(?url); + let mut body = serde_json::Map::new(); for header in headers.0 { if header.key.as_str() == ftd::PROCESSOR_MARKER From 885a27ad401b2d116eb9e7ae1ace31b6c0196133 Mon Sep 17 00:00:00 2001 From: siddhantCodes Date: Wed, 17 Sep 2025 15:37:51 +0530 Subject: [PATCH 3/3] cargo fmt && cargo clippy + prep for 0.4.113 release --- Cargo.lock | 2 +- Changelog.md | 6 ++++++ fastn-core/src/library2022/processor/http.rs | 19 ++++++++----------- fastn/Cargo.toml | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index adb7ff3bd9..9fd96336f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1798,7 +1798,7 @@ dependencies = [ [[package]] name = "fastn" -version = "0.4.112" +version = "0.4.113" dependencies = [ "actix-web", "camino", diff --git a/Changelog.md b/Changelog.md index 357051a0cd..597d46151b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,11 @@ # `fastn` Change Log +## 17 September 2025 + +### fastn: 0.4.113 + +- fix: Do not override query params of http processor's target url. PR #2209. + ## 20 August 2025 ### fastn: 0.4.112 diff --git a/fastn-core/src/library2022/processor/http.rs b/fastn-core/src/library2022/processor/http.rs index b84875c2d9..5012292208 100644 --- a/fastn-core/src/library2022/processor/http.rs +++ b/fastn-core/src/library2022/processor/http.rs @@ -112,17 +112,14 @@ pub async fn process( req_config.config.package.clone() }; - let (mut url, mountpoint, mut conf) = { - let (mut url, mountpoint, conf) = - fastn_core::config::utils::get_clean_url(&package, req_config, url.as_str()) - .await - .map_err(|e| ftd::interpreter::Error::ParseError { - message: format!("invalid url: {e:?}"), - doc_id: doc.name.to_string(), - line_number, - })?; - (url, mountpoint, conf) - }; + let (mut url, mountpoint, mut conf) = + fastn_core::config::utils::get_clean_url(&package, req_config, url.as_str()) + .await + .map_err(|e| ftd::interpreter::Error::ParseError { + message: format!("invalid url: {e:?}"), + doc_id: doc.name.to_string(), + line_number, + })?; tracing::info!(?url); diff --git a/fastn/Cargo.toml b/fastn/Cargo.toml index 81c19886e7..8b3eed62b2 100644 --- a/fastn/Cargo.toml +++ b/fastn/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fastn" -version = "0.4.112" +version = "0.4.113" authors.workspace = true edition.workspace = true license.workspace = true