You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/03/09 17:10:16 UTC

[trafficserver] branch 9.1.x updated: Add a check for compress response, if from server and 304, then check cache for headers instead of the 304 response (#7564)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.1.x by this push:
     new 087f9cc  Add a check for compress response, if from server and 304, then check cache for headers instead of the 304 response (#7564)
087f9cc is described below

commit 087f9cc4fe1733763708b9d1aebc1e4d260e48ca
Author: Evan Zelkowitz <ez...@apache.org>
AuthorDate: Thu Mar 4 14:33:12 2021 -0800

    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 f0b1d8a..13e5f97 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);