Permalink
Browse files

Merge pull request #21 from jbroadway/master

Fixed exception on relative redirects by adding the scheme://host back into the request
  • Loading branch information...
2 parents d33078c + 7c1ffc6 commit eb5facdaae45449b3c880aec2943193ae4bcb8ac @rmccue committed May 19, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 library/Requests.php
View
@@ -416,6 +416,10 @@ protected static function parse_response($headers, $url, $req_headers, $req_data
}
$options['redirected']++;
$location = $return->headers['location'];
+ if (strpos ($location, '/') === 0) {
+ // relative redirect, for compatibility make it absolute
+ $location = Requests_IRI::absolutize($url, $location);
+ }
$redirected = self::request($location, $req_headers, $req_data, false, $options);
$redirected->history[] = $return;
return $redirected;

0 comments on commit eb5facd

Please sign in to comment.