Browse Source

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.
rust-volume-server
Chris Lu 3 days ago
parent
commit
45f059a93e
  1. 8
      seaweed-volume/src/server/handlers.rs

8
seaweed-volume/src/server/handlers.rs

@ -1006,9 +1006,7 @@ async fn get_or_head_handler_inner(
resp.headers_mut() resp.headers_mut()
.insert(header::LAST_MODIFIED, lm.parse().unwrap()); .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; return resp;
} }
} }
@ -1025,9 +1023,7 @@ async fn get_or_head_handler_inner(
resp.headers_mut() resp.headers_mut()
.insert(header::LAST_MODIFIED, lm.parse().unwrap()); .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; return resp;
} }
} }

Loading…
Cancel
Save