1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Fixed logic of HTTPS downgrade detection for multiple redirections, and grant that redirection if followed for HTTP servers

This commit is contained in:
David A. Velasco 2014-08-06 11:16:17 +02:00
parent 07f3d9caae
commit e43e43f51a

View File

@ -85,12 +85,14 @@ public class GetRemoteStatusOperation extends RemoteOperation {
get.getResponseHeaders()
);
if (baseUrlSt.startsWith("https://")) {
String redirectedLocation = mLatestResult.getRedirectedLocation();
while (redirectedLocation != null && redirectedLocation.length() > 0
&& !mLatestResult.isSuccess()) {
isRedirectToNonSecureConnection = redirectedLocation.startsWith("http://");
isRedirectToNonSecureConnection |= (
baseUrlSt.startsWith("https://") &&
redirectedLocation.startsWith("http://")
);
get.releaseConnection();
get = new GetMethod(redirectedLocation);
status = client.executeMethod(
@ -103,7 +105,6 @@ public class GetRemoteStatusOperation extends RemoteOperation {
);
redirectedLocation = mLatestResult.getRedirectedLocation();
}
}
String response = get.getResponseBodyAsString();
if (status == HttpStatus.SC_OK) {