Skip to content
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

Closed
wants to merge 6 commits into from

Conversation

Beanow
Copy link

@Beanow Beanow commented Feb 28, 2015

Adds two options to a request. followRedirects and maxRedirects. Based mainly on how cURL supports it.

// case 308:

//Of course switch the location.
$this->url = $location;

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;

Copy link
Member

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

@Beanow
Copy link
Author

Beanow commented Jan 11, 2017

I gave edit rights for my branch to the maintainers.
Unfortunately I won't have time to apply any feedback myself.

@clue clue removed this from the v0.5.0 milestone Mar 20, 2017
@clue
Copy link
Member

clue commented Jan 18, 2018

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants