Skip to content

Commit

Permalink
Merge pull request #103 from ozh/relative_redirects
Browse files Browse the repository at this point in the history
Follow relative redirects correctly
  • Loading branch information
rmccue committed Feb 11, 2014
2 parents a689479 + 35f235b commit 5c54aaa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ protected static function parse_response($headers, $url, $req_headers, $req_data
}
$options['redirected']++;
$location = $return->headers['location'];
if (strpos ($location, '/') === 0) {
if (strpos ($location, 'http://') !== 0 && strpos ($location, 'https://') !== 0) {
// relative redirect, for compatibility make it absolute
$location = Requests_IRI::absolutize($url, $location);
$location = $location->uri;
Expand Down

0 comments on commit 5c54aaa

Please sign in to comment.