Browse Source

Include ETag header in 304 Not Modified responses matching Go behavior

Go sets ETag on the response writer (via SetEtag) before the
If-Modified-Since and If-None-Match conditional checks, so both
304 response paths include the ETag header. The Rust implementation
was only adding ETag to 200 responses.
rust-volume-server
Chris Lu 2 days ago
parent
commit
3deb58d241
  1. 6
      seaweed-volume/src/server/handlers.rs

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

@ -1006,6 +1006,9 @@ 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());
return resp;
}
}
@ -1022,6 +1025,9 @@ 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());
return resp;
}
}

Loading…
Cancel
Save