Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/184997

Change subject: VCL: Be consistent about using vmod_header to append header 
items
......................................................................

VCL: Be consistent about using vmod_header to append header items

Change-Id: I57aa67dd6fb722e5319616a7e29dda960e7a95af
---
M templates/varnish/text-backend.inc.vcl.erb
M templates/varnish/text-frontend.inc.vcl.erb
M templates/varnish/zero.inc.vcl.erb
3 files changed, 8 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/97/184997/1

diff --git a/templates/varnish/text-backend.inc.vcl.erb 
b/templates/varnish/text-backend.inc.vcl.erb
index 3de0d48..acc113b 100644
--- a/templates/varnish/text-backend.inc.vcl.erb
+++ b/templates/varnish/text-backend.inc.vcl.erb
@@ -83,11 +83,7 @@
        if ((beresp.status == 301 || beresp.status == 302)
                && beresp.http.Location ~ "^http"
                && beresp.http.Vary !~ "X-Forwarded-Proto") {
-               if (beresp.http.Vary) {
-                       set beresp.http.Vary = beresp.http.Vary + 
",X-Forwarded-Proto";
-               } else {
-                       set beresp.http.Vary = "X-Forwarded-Proto";
-               }
+               header.append(beresp.http.Vary, "X-Forwarded-Proto");
        }
 
        if (beresp.ttl <= 0s || req.http.X-Wikimedia-Debug == "1") {
diff --git a/templates/varnish/text-frontend.inc.vcl.erb 
b/templates/varnish/text-frontend.inc.vcl.erb
index ae7fcc6..4fadd97 100644
--- a/templates/varnish/text-frontend.inc.vcl.erb
+++ b/templates/varnish/text-frontend.inc.vcl.erb
@@ -164,21 +164,13 @@
 <% end -%>
 
        // Assemble X-Analytics header
-       // Some of the headers used for X-Analytics are not varied on, so add 
them after the backend processing
-       // Note that vcl_deliver in other files may also modify X-Analytics.
+       // Some of the headers used for X-Analytics are not varied on, so add
+       // them after the backend processing. Note that vcl_deliver in other
+       // files may also modify X-Analytics.
        if (req.http.X-Forwarded-Proto) {
-               if (resp.http.X-Analytics) {
-                       set resp.http.X-Analytics = resp.http.X-Analytics + 
";https=1";
-               } else {
-                       set resp.http.X-Analytics = "https=1";
-               }
+               header.append(resp.http.X-Analytics, "https=1");
        }
-
        if (req.http.X-WMF-UUID) {
-               if (resp.http.X-Analytics) {
-                       set resp.http.X-Analytics = resp.http.X-Analytics + 
";wmfuuid=" + req.http.X-WMF-UUID;
-               } else {
-                       set resp.http.X-Analytics = "wmfuuid=" + 
req.http.X-WMF-UUID;
-               }
+               header.append(resp.http.X-Analytics, "wmfuuid=" + 
req.http.X-WMF-UUID);
        }
 }
diff --git a/templates/varnish/zero.inc.vcl.erb 
b/templates/varnish/zero.inc.vcl.erb
index 2e005ab..10890a0 100644
--- a/templates/varnish/zero.inc.vcl.erb
+++ b/templates/varnish/zero.inc.vcl.erb
@@ -155,21 +155,12 @@
         } else {
             set req.http.X-CS = "zero=" + req.http.X-CS;
         }
-
-        if (resp.http.X-Analytics) {
-            set resp.http.X-Analytics = resp.http.X-Analytics + ";" + 
req.http.X-CS;
-        } else {
-            set resp.http.X-Analytics = req.http.X-CS;
-        }
+        header.append(resp.http.X-Analytics, req.http.X-CS);
     } else {
         // Let's ensure no outbound X-CS if pre-analytics X-CS (as determined 
in corresponding if) was not set.
         unset resp.http.X-CS;
     }
     if (req.http.X-Forwarded-By2) {
-        if (resp.http.X-Analytics) {
-            set resp.http.X-Analytics = resp.http.X-Analytics + ";proxy=" + 
req.http.X-Forwarded-By2;
-        } else {
-            set resp.http.X-Analytics = "proxy=" + req.http.X-Forwarded-By2;
-        }
+        header.append(resp.http.X-Analytics, "proxy=" + 
req.http.X-Forwarded-By2);
     }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/184997
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57aa67dd6fb722e5319616a7e29dda960e7a95af
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to