-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: follow redirects #20
Conversation
// case 308: | ||
|
||
//Of course switch the location. | ||
$this->url = $location; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to refer relativ redirect locations we need a test and url rebuild.
//Of course switch the location.
if (is_null(parse_url($location, PHP_URL_HOST))) {
$path = parse_url($location, PHP_URL_PATH) ?: '/';
$queryString = parse_url($location, PHP_URL_QUERY);
$location = $this->getScheme() . '://' . $this->getHost() . $path . ($queryString ? "?$queryString" : '');
}
$this->url = $location;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to do that is to use PSR7 and resolve two URI's with https://github.com/guzzle/psr7/blob/master/src/UriResolver.php
I gave edit rights for my branch to the maintainers. |
As much as I'd love to get this feature in, I'm having to close this for now as it hasn't received any input in a while and it's unlikely this will get traction any time soon. The feature request is still open in #40 and we'll look into this in the not too far future 👍 I believe that getting this in is also far more reasonable once the PSR-7 support is in via #41. If you feel this was closed prematurely or want to pick this up again, please let us know and we can reopen this. Thank you for your effort! |
Adds two options to a request.
followRedirects
andmaxRedirects
. Based mainly on how cURL supports it.