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

Should handle 301 redirection #15

Closed
pmaziere opened this issue Dec 22, 2015 · 9 comments
Closed

Should handle 301 redirection #15

pmaziere opened this issue Dec 22, 2015 · 9 comments

Comments

@pmaziere
Copy link

When configured with a path not ending with a slash , eg: example.com/photobackup , my server response is a redirection to example.com/photobackup/
The expected response from the client should be to resend the request to the redirected url, but it does not.

@zealot128
Copy link
Contributor

Can you try again with the latest version? @stephanepechard ripped out the old http client and the new one seems to follow redirects automatically. But maybe, because we are using a POST, that will not trigger a redirect.

On the other hand, following redirects is not very efficient, as the Photo would be uploaded twice every single time...
Question is, if it also POST a request again, which is not very

@stephanepechard
Copy link
Member

OkHttp is not that great in handling 30X status. I have to work on it a bit.
In any case, it seems the status should be either 307 (temporary) or 308 (permanent redirection), not 301 or 302, which do not make the client resubmit the request as the first one (a POST is transformed as a GET, don't ask me why).

@stephanepechard
Copy link
Member

Please try with the latest 0.9.0 version. As @zealot128 said, I modified the upload library, this one should handle redirection more properly. As for myself, it redirects correctly from a http:// to a https:// address.

@pmaziere
Copy link
Author

pmaziere commented Aug 14, 2016

It may handle redirection more properly, but I just can't get through the test step :(
I went back to 0.8 the test is successful, so I guess something was changed in the test data transmission

@stephanepechard
Copy link
Member

stephanepechard commented Aug 14, 2016

Would you allow me to test your configuration? I would need the URL and the associated password. You can send it by mail or any other way of your convenience.
Thanks for your input.

@pmaziere
Copy link
Author

Sorry, but that's not possible.

It is a standard installation and the URL is protected by basic http auth.
When I access the URL with curl:
curl -u mylogin -d password=$(echo -n "mypassword" | sha512sum) https://example.com/PhotoBackup/index.php/test
it ends up with an expected 200 HTTP code

When I use the android client 0.9, the web server log shows a 401 HTTP code with an empty HTTP authentication login
Since 0.8 works fine in the same conditions, and 401 is only sent by PhotoBackup when the PhotoBackup password is not set, I guess there is an issue with how http authentication is handled in 0.9

@stephanepechard
Copy link
Member

Ok, I will check on your Auth problem. I already looked at redirection and it should be covered, at least it works for me on http => https redirection (307 though, not 301 as it alters the request).

stephanepechard added a commit that referenced this issue Aug 15, 2016
Redirections should be honored and followed. It rewrites the server url and persists the new one.
stephanepechard added a commit that referenced this issue Aug 15, 2016
Cleaning comments
@stephanepechard
Copy link
Member

Please try v0.10.0 which tries to honor redirections

@stephanepechard
Copy link
Member

Should be ok now

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

No branches or pull requests

3 participants