ezelkow1 commented on code in PR #13776:
URL: https://github.com/apache/trafficserver/pull/13776#discussion_r4162567978
##########
plugins/compress/compress.cc:
##########
@@ -811,6 +810,65 @@ add_vary_header_to_client_response(TSHttpTxn txnp)
TSHandleMLocRelease(resp_buf, TS_NULL_MLOC, resp_loc);
}
+// A 304 carries the origin's strong ETag, which the cache would merge over
the weakened ETag of a
+// stored compressed copy. Keep it weak when both name the same entity and the
stored copy is
+// encoded; an identity copy's ETag is the origin's own, so it may
legitimately become strong.
+static void
+keep_cached_etag_weak(TSHttpTxn txnp)
+{
+ TSMBuffer srv_buf;
+ TSMLoc srv_loc;
+
+ if (TS_SUCCESS != TSHttpTxnServerRespGet(txnp, &srv_buf, &srv_loc)) {
+ return;
+ }
+ ts::PostScript srv_defer([&]() -> void { TSHandleMLocRelease(srv_buf,
TS_NULL_MLOC, srv_loc); });
+
+ if (TSHttpHdrStatusGet(srv_buf, srv_loc) != TS_HTTP_STATUS_NOT_MODIFIED) {
+ return;
+ }
+
+ TSMBuffer cached_buf;
+ TSMLoc cached_loc;
+
+ if (TS_SUCCESS != TSHttpTxnCachedRespGet(txnp, &cached_buf, &cached_loc)) {
+ return;
Review Comment:
Follow-up: the approach in my previous reply (keying off the client's weak
validator) has been replaced after further review (da65f74254, 1be07624a0). The
304 hook is now registered only where `transformable()` decides the 200 for the
request would be compressed, and it weakens the outgoing 304 based on that
rather than on the client's validator. With `cache false`, the stored identity
copy still keeps its strong tag; only the client's 304 is weakened. For a
forwarded conditional with nothing stored to judge by, the request is left
untouched; an origin 304 for a GET/HEAD is weakened only when the client's
`If-None-Match` holds the weak form of its strong ETag. Details in
https://github.com/apache/trafficserver/pull/13776#discussion_r4162548629 and
https://github.com/apache/trafficserver/pull/13776#discussion_r4162603969.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]