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

peryder pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new c06ec2e  Make cachekey plugin responsible for range header when 
caching_range_requests (#3452)
c06ec2e is described below

commit c06ec2edcf1b4d963be85d2a1803c856e99f66aa
Author: Eric Friedrich <[email protected]>
AuthorDate: Fri Apr 12 11:58:12 2019 -0400

    Make cachekey plugin responsible for range header when 
caching_range_requests (#3452)
---
 traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm |  4 ++--
 traffic_ops/app/lib/UI/ConfigFiles.pm                  |  4 ++--
 traffic_ops/app/lib/UI/DeliveryService.pm              | 12 ++++++++++--
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm 
b/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
index ab942ce..e4a286c 100755
--- a/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
+++ b/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
@@ -2774,7 +2774,7 @@ sub remap_dot_config {
                                $mid_remap{ $ds->{org} } .= " 
\@plugin=header_rewrite.so \@pparam=" . $ds->{mid_hdr_rw_file};
                        }
                        if ( $ds->{qstring_ignore} == 1 ) {
-                               $mid_remap{ $ds->{org} } .= 
UI::DeliveryService::get_qstring_ignore_remap(UI::DeliveryService::get_ats_major_version(
 $self, $server_obj ));
+                               $mid_remap{ $ds->{org} } .= 
UI::DeliveryService::get_qstring_ignore_remap(UI::DeliveryService::get_ats_major_version(
 $self, $server_obj ), $ds->{range_request_handling});
                        }
                        if ( defined( $ds->{cacheurl} ) && $ds->{cacheurl} ne 
"" ) {
                                $mid_remap{ $ds->{org} } .= " 
\@plugin=cacheurl.so \@pparam=" . $ds->{cacheurl_file};
@@ -2893,7 +2893,7 @@ sub build_remap_line {
                }
                else {
                        #If we are on ats 6 and later we want to use the 
cachekey plugin, otherwise we have to use cacheurl
-                       $text .= 
UI::DeliveryService::get_qstring_ignore_remap(UI::DeliveryService::get_ats_major_version($self,
 $server_obj ));
+                       $text .= 
UI::DeliveryService::get_qstring_ignore_remap(UI::DeliveryService::get_ats_major_version($self,
 $server_obj ), $ds->{range_request_handling});
                }
        }
        if ( defined( $remap->{cacheurl} ) && $remap->{cacheurl} ne "" ) {
diff --git a/traffic_ops/app/lib/UI/ConfigFiles.pm 
b/traffic_ops/app/lib/UI/ConfigFiles.pm
index 73c97f1..9a33a57 100644
--- a/traffic_ops/app/lib/UI/ConfigFiles.pm
+++ b/traffic_ops/app/lib/UI/ConfigFiles.pm
@@ -1113,7 +1113,7 @@ sub remap_dot_config {
                                $mid_remap{ $remap->{org} } .= " 
\@plugin=header_rewrite.so \@pparam=" . $remap->{mid_hdr_rw_file};
                        }
                        if ( $remap->{qstring_ignore} == 1 ) {
-                               $mid_remap{ $remap->{org} } .= 
UI::DeliveryService::get_qstring_ignore_remap(UI::DeliveryService::get_ats_major_version($self,
 $server));
+                               $mid_remap{ $remap->{org} } .= 
UI::DeliveryService::get_qstring_ignore_remap(UI::DeliveryService::get_ats_major_version($self,
 $server), $remap->{range_request_handling});
                        }
                        if ( defined( $remap->{cacheurl} ) && 
$remap->{cacheurl} ne "" ) {
                                $mid_remap{ $remap->{org} } .= " 
\@plugin=cacheurl.so \@pparam=" . $remap->{cacheurl_file};
@@ -1192,7 +1192,7 @@ sub build_remap_line {
                }
                else {
                        #If we are on ats 6 and later we want to use the 
cachekey plugin, otherwise we have to use cacheurl
-                       $text .= 
UI::DeliveryService::get_qstring_ignore_remap(UI::DeliveryService::get_ats_major_version($self,
 $server));
+                       $text .= 
UI::DeliveryService::get_qstring_ignore_remap(UI::DeliveryService::get_ats_major_version($self,
 $server), $remap->{range_request_handling});
                }
        }
        if ( defined( $remap->{cacheurl} ) && $remap->{cacheurl} ne "" ) {
diff --git a/traffic_ops/app/lib/UI/DeliveryService.pm 
b/traffic_ops/app/lib/UI/DeliveryService.pm
index 578538d..97a5da7 100644
--- a/traffic_ops/app/lib/UI/DeliveryService.pm
+++ b/traffic_ops/app/lib/UI/DeliveryService.pm
@@ -1430,9 +1430,17 @@ sub get_ats_major_version {
 
 sub get_qstring_ignore_remap {
        my $ats_major_version = shift;
-
+       my $range_request_handling = shift;
+       
        if ($ats_major_version >= 6) {
-               return " \@plugin=cachekey.so \@pparam=--separator= 
\@pparam=--remove-all-params=true \@pparam=--remove-path=true 
\@pparam=--capture-prefix-uri=/^([^?]*)/\$1/";
+               my $remap_text = " \@plugin=cachekey.so \@pparam=--separator= 
\@pparam=--remove-all-params=true \@pparam=--remove-path=true 
\@pparam=--capture-prefix-uri=/^([^?]*)/\$1/";
+
+               # ATS only lets you set cache key once per txn. 
+               # Add range header into the single setting of the cachekey
+               if ( $range_request_handling == RRH_CACHE_RANGE_REQUEST ) {
+                   $remap_text .= " \@pparam=--include-headers=Range"
+               }       
+               return $remap_text;
        }
        else {
                return " \@plugin=cacheurl.so \@pparam=cacheurl_qstring.config";

Reply via email to