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

Commit

Permalink
Merge branch 'master' into feature/math-biginteger
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
13 changes: 3 additions & 10 deletions src/Client/Cookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,8 @@ public function addCookie($cookie, $ref_uri = null)
* @param Response $response
* @param Uri\Uri|string $ref_uri Requested URI
*/
public function addCookiesFromResponse($response, $ref_uri)
public function addCookiesFromResponse(Response $response, $ref_uri)
{
if (!$response instanceof Response) {
throw new Exception\InvalidArgumentException('$response is expected to be a Response object');
}

$cookie_hdrs = $response->headers()->get('Set-Cookie');

if (is_array($cookie_hdrs)) {
Expand Down Expand Up @@ -182,8 +178,7 @@ public function getMatchingCookies($uri, $matchSessionCookies = true,
{
if (is_string($uri)) {
$uri = Uri\UriFactory::factory($uri, 'http');
}
if (!$uri instanceof Uri\Uri) {
} elseif (!$uri instanceof Uri\Uri) {
throw new Exception\InvalidArgumentException("Invalid URI string or object passed");
}

Expand Down Expand Up @@ -221,9 +216,7 @@ public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT)
{
if (is_string($uri)) {
$uri = Uri\UriFactory::factory($uri, 'http');
}

if (!$uri instanceof Uri\Uri) {
} elseif (!$uri instanceof Uri\Uri) {
throw new Exception\InvalidArgumentException('Invalid URI specified');
}

Expand Down
13 changes: 3 additions & 10 deletions src/Cookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,8 @@ public function addCookie(Cookie $cookie, $ref_uri = null)
* @param Response $response
* @param Uri\Uri|string $ref_uri Requested URI
*/
public function addCookiesFromResponse($response, $ref_uri)
public function addCookiesFromResponse(Response $response, $ref_uri)
{
if (!$response instanceof Response) {
throw new Exception\InvalidArgumentException('$response is expected to be a Response object');
}

$cookie_hdrs = $response->headers()->get('Set-Cookie');

if (is_array($cookie_hdrs)) {
Expand Down Expand Up @@ -185,8 +181,7 @@ public function getMatchingCookies($uri, $matchSessionCookies = true,
{
if (is_string($uri)) {
$uri = Uri\UriFactory::factory($uri, 'http');
}
if (!$uri instanceof Uri\Uri) {
} elseif (!$uri instanceof Uri\Uri) {
throw new Exception\InvalidArgumentException("Invalid URI string or object passed");
}

Expand Down Expand Up @@ -224,9 +219,7 @@ public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT)
{
if (is_string($uri)) {
$uri = Uri\UriFactory::factory($uri, 'http');
}

if (!$uri instanceof Uri\Uri) {
} elseif (!$uri instanceof Uri\Uri) {
throw new Exception\InvalidArgumentException('Invalid URI specified');
}

Expand Down
6 changes: 6 additions & 0 deletions src/PhpEnvironment/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ protected function detectRequestUri()
if ($httpXRewriteUrl !== null) {
$requestUri = $httpXRewriteUrl;
}

// Check for IIS 7.0 or later with ISAPI_Rewrite
$httpXOriginalUrl = $this->server()->get('HTTP_X_ORIGINAL_URL');
if ($httpXOriginalUrl !== null) {
$requestUri = $httpXOriginalUrl;
}

// IIS7 with URL Rewrite: make sure we get the unencoded url
// (double slash problem).
Expand Down

0 comments on commit 63f13f6

Please sign in to comment.