diff options
| author | czaks <marcin@6irc.net> | 2013-08-04 22:12:21 -0400 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-05 04:51:48 -0400 |
| commit | 67daf109f2b10846230115a92ddd964af14299e0 (patch) | |
| tree | a2b3c0d25b23df1232bfb1e255a64b2b803d2783 /inc/functions.php | |
| parent | f1e3c53d8d504cfd2ad34b948462f0486c02cc65 (diff) | |
fix Varnish compatibility when characters such as * are in use for a boardname
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/inc/functions.php b/inc/functions.php index 01fdb18e..74ab96e9 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -388,9 +388,12 @@ function purge($uri) { global $config, $debug; // Fix for Unicode - $uri = urlencode($uri); - $uri = str_replace("%2F", "/", $uri); - $uri = str_replace("%3A", ":", $uri); + $uri = rawurlencode($uri); + + $noescape = "/!~*()+:"; + $noescape = preg_split('//', $noescape); + $noescape_url = array_map("rawurlencode", $noescape); + $uri = str_replace($noescape_url, $noescape, $uri); if (preg_match($config['referer_match'], $config['root']) && isset($_SERVER['REQUEST_URI'])) { $uri = (str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) == '/' ? '/' : str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) . '/') . $uri; |
