From 45f059a93e714b8b4e95dc81dac29059f3f0ab19 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 17 Mar 2026 21:38:59 -0700 Subject: [PATCH] Do not include ETag in 304 responses matching Go's GetOrHeadHandler Go sets ETag at L235 AFTER the If-Modified-Since and If-None-Match 304 return paths, so Go's 304 responses do not include the ETag header. The Rust code was incorrectly including ETag in both 304 response paths. --- seaweed-volume/src/server/handlers.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/seaweed-volume/src/server/handlers.rs b/seaweed-volume/src/server/handlers.rs index da97099f9..1308c47ea 100644 --- a/seaweed-volume/src/server/handlers.rs +++ b/seaweed-volume/src/server/handlers.rs @@ -1006,9 +1006,7 @@ async fn get_or_head_handler_inner( resp.headers_mut() .insert(header::LAST_MODIFIED, lm.parse().unwrap()); } - // Go sets ETag before conditional checks, so 304 includes it - resp.headers_mut() - .insert(header::ETAG, etag.parse().unwrap()); + // Go sets ETag AFTER the 304 return paths (L235), so 304 does NOT include ETag return resp; } } @@ -1025,9 +1023,7 @@ async fn get_or_head_handler_inner( resp.headers_mut() .insert(header::LAST_MODIFIED, lm.parse().unwrap()); } - // Go sets ETag before conditional checks, so 304 includes it - resp.headers_mut() - .insert(header::ETAG, etag.parse().unwrap()); + // Go sets ETag AFTER the 304 return paths (L235), so 304 does NOT include ETag return resp; } }