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

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


The following commit(s) were added to refs/heads/9.2.x by this push:
     new fbefbdd1b3 Fix case where 206 could be returned for range revalidates 
(#11308) (#11351)
fbefbdd1b3 is described below

commit fbefbdd1b35a1ff523b04e6ae747a2365040c19a
Author: Chris McFarlen <ch...@mcfarlen.us>
AuthorDate: Tue May 14 15:27:35 2024 -0500

    Fix case where 206 could be returned for range revalidates (#11308) (#11351)
---
 proxy/http/HttpSM.cc                                 | 11 +++++++----
 .../cache/replay/cache-range-response.replay.yaml    | 20 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index ab269fbbdf..750531f872 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4777,10 +4777,13 @@ HttpSM::do_range_setup_if_necessary()
         }
       } else {
         // if revalidating and cache is stale we want to transform
-        if (t_state.cache_info.action == HttpTransact::CACHE_DO_REPLACE &&
-            t_state.hdr_info.server_response.status_get() == HTTP_STATUS_OK) {
-          Debug("http_range", "Serving transform after stale cache re-serve");
-          do_transform = true;
+        if (t_state.cache_info.action == HttpTransact::CACHE_DO_REPLACE) {
+          if (t_state.hdr_info.server_response.status_get() == HTTP_STATUS_OK) 
{
+            Debug("http_range", "Serving transform after stale cache 
re-serve");
+            do_transform = true;
+          } else {
+            Debug("http_range", "Not transforming after revalidate");
+          }
         } else if (cache_sm.cache_read_vc && 
cache_sm.cache_read_vc->is_pread_capable()) {
           // If only one range entry and pread is capable, no need transform 
range
           t_state.range_setup = HttpTransact::RANGE_NOT_TRANSFORM_REQUESTED;
diff --git a/tests/gold_tests/cache/replay/cache-range-response.replay.yaml 
b/tests/gold_tests/cache/replay/cache-range-response.replay.yaml
index 768f0ddd18..0bb4d2271e 100644
--- a/tests/gold_tests/cache/replay/cache-range-response.replay.yaml
+++ b/tests/gold_tests/cache/replay/cache-range-response.replay.yaml
@@ -111,3 +111,23 @@ sessions:
             fields:
               - [ Content-Range, { value: "bytes 0-10/100", as: equal}]
               - [ Via, { value: "uIcSsSfUpSeN:t cCSp sS", as: contains }]
+      # Revalidate and replace still returns appropriate server error
+      - client-request:
+          method: "GET"
+          version: "1.1"
+          url: /some/path
+          headers:
+            fields:
+              - [ Host, example.com ]
+              - [ uuid, 5 ]
+              - [ Range, bytes=0-10 ]
+              - [ If-Modified-Since, "Wed, 16 Mar 2022 22:52:09 GMT"]
+        server-response:
+          status: 404
+          reason: Not Found
+          headers:
+            fields:
+              - [ Content-Length, 10 ]
+              - [ Cache-Control, max-age=300 ]
+        proxy-response:
+          status: 404

Reply via email to