From fedb337aa50770e5605a8fe772570f5905be6bbe Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 20 May 2012 11:16:34 +0200 Subject: [PATCH] BUGFIX Less strict checks for relative URL normalization in SS_HTTPRequest (regression from recent security fixes to Director::is_absolute_url()) (fixes #7359) --- control/HTTPRequest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/control/HTTPRequest.php b/control/HTTPRequest.php index 3e263711d..f2e1b4f6b 100644 --- a/control/HTTPRequest.php +++ b/control/HTTPRequest.php @@ -90,8 +90,9 @@ class SS_HTTPRequest implements ArrayAccess { function __construct($httpMethod, $url, $getVars = array(), $postVars = array(), $body = null) { $this->httpMethod = strtoupper(self::detect_method($httpMethod, $postVars)); $this->url = $url; - - if(Director::is_relative_url($url)) { + + // Normalize URL if its relative (strictly speaking), or has leading slashes + if(Director::is_relative_url($url) || preg_match('/^\//', $url)) { $this->url = preg_replace(array('/\/+/','/^\//', '/\/$/'),array('/','',''), $this->url); } if(preg_match('/^(.*)\.([A-Za-z][A-Za-z0-9]*)$/', $this->url, $matches)) {