Skip to content

Commit

Permalink
BUGFIX Less strict checks for relative URL normalization in SS_HTTPRe…
Browse files Browse the repository at this point in the history
…quest (regression from recent security fixes to Director::is_absolute_url()) (fixes #7359)
  • Loading branch information
chillu committed May 20, 2012
1 parent 18fa9cd commit fedb337
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions control/HTTPRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit fedb337

Please sign in to comment.