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

Following links in a 301 response for a sparql query #385

Open
Catgolin opened this issue Sep 19, 2021 · 1 comment · May be fixed by #388
Open

Following links in a 301 response for a sparql query #385

Catgolin opened this issue Sep 19, 2021 · 1 comment · May be fixed by #388

Comments

@Catgolin
Copy link

Catgolin commented Sep 19, 2021

Current behavior

The following code throws a Http\Exception stating that the HTTP request for SPARQL query failed, and doesn't return any information about the response:

$sparql = new EasyRdf\Sparql\Client('http://uri/returning/a/redirecting/response');
$sparql->query('...');

Expected behavior

When there is a 301/302/303/307/308 HTTP response to the query and the Location header is set, we could automatically try again the query with the new Location instead of imediatly throwing the error. We could easily keep in sight the previous automatic redirections in order to make sure there is no circular redirections and throw the Exception it happends.

It would be useful to return the response headers in the thrown exception to better identify the error and take the appropriate steps (this second option could also be useful when we have other HTTP errors such as 401 where the body of the response doesn't always carry as much information).

@madbob
Copy link

madbob commented Sep 19, 2021

Mostly handled by PR #379, as the PSR HTTP client provided by implementor can be configured with desidered behaviour (handle as many redirects as required, or just fail when a redirect is found).

@Catgolin Catgolin linked a pull request Oct 9, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants