From ad07e0e0338324f8ec8414b8a75e91d950f81342 Mon Sep 17 00:00:00 2001 From: Evan Zelkowitz Date: Fri, 26 Feb 2021 17:39:27 +0000 Subject: [PATCH] Add a check for compress response, if from server and 304, then check cache for headers instead of the 304 response --- plugins/compress/compress.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/compress/compress.cc b/plugins/compress/compress.cc index f0b1d8aa0b8..13e5f97dd97 100644 --- a/plugins/compress/compress.cc +++ b/plugins/compress/compress.cc @@ -657,6 +657,16 @@ transformable(TSHttpTxn txnp, bool server, HostConfiguration *host_configuration return 0; } + // We got a server response but it was a 304 + // we need to update our data to come from cache instead of + // the 304 response which does not need to include all headers + if ((server) && (resp_status == TS_HTTP_STATUS_NOT_MODIFIED)) { + TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc); + if (TS_SUCCESS != TSHttpTxnCachedRespGet(txnp, &bufp, &hdr_loc)) { + return 0; + } + } + if (TS_SUCCESS != TSHttpTxnClientReqGet(txnp, &cbuf, &chdr)) { info("cound not get client request"); TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);