From 0b2a58794cc23a07b049245c1c9229c9f15c9973 Mon Sep 17 00:00:00 2001 From: Evan Zelkowitz Date: Thu, 4 Mar 2021 14:33:12 -0800 Subject: [PATCH] Add a check for compress response, if from server and 304, then check cache for headers instead of the 304 response (#7564) (cherry picked from commit b1a5cbd8e46b3dbffa7fb73bf6c100b84cbee239) --- plugins/compress/compress.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/compress/compress.cc b/plugins/compress/compress.cc index b7325c0bf4d..b51800eacaa 100644 --- a/plugins/compress/compress.cc +++ b/plugins/compress/compress.cc @@ -663,6 +663,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);