You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ez...@apache.org on 2021/04/15 22:07:25 UTC

[trafficserver] branch 8.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) (#7650)

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

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


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

commit ffdbd722877ca09ae3e0074c8d2eed9df344fd1e
Author: Evan Zelkowitz <ez...@apache.org>
AuthorDate: Thu Apr 15 16:07:06 2021 -0600

    Add a check for compress response, if from server and 304, then check cache for headers instead of the 304 response (#7564) (#7650)
    
    (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 b7325c0..b51800e 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);