Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
fixed http request if query contains full url
Browse files Browse the repository at this point in the history
  • Loading branch information
AlloVince committed Oct 23, 2012
1 parent 0e70e04 commit 9409976
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Zend/Http/PhpEnvironment/Request.php
Expand Up @@ -439,7 +439,7 @@ protected function detectRequestUri()
}

if ($requestUri !== null) {
return preg_replace('#^[^:]+://[^/]+#', '', $requestUri);
return preg_replace('#^[^/:]+://[^/]+#', '', $requestUri);
}

// IIS 5.0, PHP as CGI.
Expand Down
23 changes: 23 additions & 0 deletions tests/ZendTest/Http/PhpEnvironment/RequestTest.php
Expand Up @@ -204,6 +204,17 @@ public static function baseUrlAndPathProvider()
'/html/index.php',
'/html'
),

//Test when url quert contains a full http url
array(
array(
'REQUEST_URI' => '/html/index.php?url=http://test.example.com/path/&foo=bar',
'PHP_SELF' => '/html/index.php',
'SCRIPT_FILENAME' => '/var/web/html/index.php',
),
'/html/index.php',
'/html'
),
);
}

Expand Down Expand Up @@ -357,6 +368,18 @@ public static function serverHostnameProvider()
'443',
'/news',
),

//Test when url quert contains a full http url
array(
array(
'SERVER_NAME' => 'test.example.com',
'REQUEST_URI' => '/html/index.php?url=http://test.example.com/path/&foo=bar',
),
'test.example.com',
'80',
'/html/index.php?url=http://test.example.com/path/&foo=bar',
),

);
}

Expand Down

0 comments on commit 9409976

Please sign in to comment.