BBlack has uploaded a new change for review.
https://gerrit.wikimedia.org/r/274085
Change subject: normalize_path: optional forward-slash, RB variant
......................................................................
normalize_path: optional forward-slash, RB variant
Bug: T127387
Change-Id: I7823c0ea1535b441c3ec95d09078fb0b44e7acf7
---
M templates/varnish/normalize_path.inc.vcl.erb
M templates/varnish/text-frontend.inc.vcl.erb
2 files changed, 13 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/85/274085/1
diff --git a/templates/varnish/normalize_path.inc.vcl.erb
b/templates/varnish/normalize_path.inc.vcl.erb
index 8050fd3..e145508 100644
--- a/templates/varnish/normalize_path.inc.vcl.erb
+++ b/templates/varnish/normalize_path.inc.vcl.erb
@@ -12,7 +12,7 @@
#define NP_IS_HEX(c) (NP_HEX_DIGIT(c) != -1)
#define NP_HEXCHAR(c1, c2) (char)( (NP_HEX_DIGIT(c1) << 4) | NP_HEX_DIGIT(c2) )
-void raw_normalize_path(struct sess *sp) {
+void raw_normalize_path(struct sess *sp, const int doslash) {
/* Rewrite the path part of the URL, replacing unnecessarily escaped
* punctuation with the actual characters. The character list is from
* MediaWiki's wfUrlencode(), so the URLs produced here will be the
same as
@@ -45,8 +45,8 @@
|| c == '('
|| c == ')'
|| c == ','
- || c == '/'
- || c == ':')
+ || c == ':'
+ || (doslash && c == '/'))
{
destBuffer[outPos++] = c;
dirty = 1;
@@ -83,6 +83,10 @@
}C
-sub normalize_path {
- C{ raw_normalize_path(sp); }C
+sub normalize_mediawiki_path {
+ C{ raw_normalize_path(sp, 1); }C
+}
+
+sub normalize_rest_path {
+ C{ raw_normalize_path(sp, 0); }C
}
diff --git a/templates/varnish/text-frontend.inc.vcl.erb
b/templates/varnish/text-frontend.inc.vcl.erb
index cfdc299..7d7b7fc 100644
--- a/templates/varnish/text-frontend.inc.vcl.erb
+++ b/templates/varnish/text-frontend.inc.vcl.erb
@@ -123,8 +123,10 @@
}
// Don't decode percent-encoded slashes in paths for REST APIs
- if (req.url !~ "^/api/rest_v1/" && req.http.host !~
"cxserver|citoid|restbase|^rest\.") {
- call normalize_path;
+ if (req.url ~ "^/api/rest_v1/" || req.http.host ~
"cxserver|citoid|restbase|^rest\.") {
+ call normalize_rest_path;
+ } else {
+ call normalize_mediawiki_path;
}
call mobile_redirect;
--
To view, visit https://gerrit.wikimedia.org/r/274085
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7823c0ea1535b441c3ec95d09078fb0b44e7acf7
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits