Phase 8 (Bridge): SID/phishing header passthrough, updated TODO
- proxy.rs: forward_to_core() now accepts the incoming headers vec and passes X-UT-SID, X-UT-PHISHING-TOKEN, and X-Request-ID through to Core on every mapped request (#19, #20) - TODO.md: mark #15-#20 as complete with implementation notes; update test counts; clean up duplicate #15 entry Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+14
-3
@@ -100,7 +100,7 @@ pub async fn catch_all_handler(
|
||||
);
|
||||
|
||||
let mut capture =
|
||||
CapturedRequest::new(&method, &path, query.as_deref(), headers, body_str.clone());
|
||||
CapturedRequest::new(&method, &path, query.as_deref(), headers.clone(), body_str.clone());
|
||||
|
||||
let (response_body, status_code): (Value, u16) =
|
||||
if let Some(mapping) = map_to_core(&method, &path) {
|
||||
@@ -116,6 +116,7 @@ pub async fn catch_all_handler(
|
||||
mapping.method,
|
||||
mapping.core_path,
|
||||
body_str.as_deref(),
|
||||
&headers,
|
||||
)
|
||||
.await
|
||||
{
|
||||
@@ -168,16 +169,26 @@ async fn forward_to_core(
|
||||
method: &str,
|
||||
path: &str,
|
||||
body: Option<&str>,
|
||||
incoming_headers: &[(String, String)],
|
||||
) -> anyhow::Result<(Value, u16)> {
|
||||
let url = format!("{}{}", state.config.core_url, path);
|
||||
let builder = match method {
|
||||
let mut builder = match method {
|
||||
"POST" => state.http_client.post(&url),
|
||||
"PUT" => state.http_client.put(&url),
|
||||
"DELETE" => state.http_client.delete(&url),
|
||||
_ => state.http_client.get(&url),
|
||||
};
|
||||
|
||||
let builder = if let Some(b) = body {
|
||||
// Pass through FUT session and anti-phishing headers so Core can log/correlate them.
|
||||
// These are used in #19 (X-UT-SID) and #20 (X-UT-PHISHING-TOKEN) passthrough.
|
||||
for (k, v) in incoming_headers {
|
||||
let lower = k.to_lowercase();
|
||||
if lower == "x-ut-sid" || lower == "x-ut-phishing-token" || lower == "x-request-id" {
|
||||
builder = builder.header(k.as_str(), v.as_str());
|
||||
}
|
||||
}
|
||||
|
||||
builder = if let Some(b) = body {
|
||||
builder
|
||||
.header("content-type", "application/json")
|
||||
.body(b.to_string())
|
||||
|
||||
Reference in New Issue
Block a user