From 0d94058db912f1056eeb6405f741b6a29b763ab1 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Wed, 1 Sep 2021 17:34:01 +0200 Subject: [PATCH] remove retrive cookies from middleware --- .../android/lib/common/OwnCloudClient.java | 32 +++++++++++++++---- .../lib/common/OwnCloudClientFactory.java | 8 ----- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java index bca78b1f..50dbecf7 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java @@ -38,6 +38,7 @@ import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory import com.owncloud.android.lib.common.http.HttpClient; import com.owncloud.android.lib.common.http.HttpConstants; import com.owncloud.android.lib.common.http.methods.HttpBaseMethod; +import com.owncloud.android.lib.common.http.methods.nonwebdav.HttpMethod; import com.owncloud.android.lib.common.network.RedirectionPath; import com.owncloud.android.lib.common.utils.RandomUtils; import com.owncloud.android.lib.resources.status.OwnCloudVersion; @@ -113,14 +114,17 @@ public class OwnCloudClient extends HttpClient { if (mCredentials.getHeaderAuth() != null && method.getRequestHeader(AUTHORIZATION_HEADER) == null) { method.setRequestHeader(AUTHORIZATION_HEADER, mCredentials.getHeaderAuth()); } + + status = method.execute(); + stacklog(status, method); + /* synchronized (mHoldRequests) { while (mHoldRequests) { while (true) { try { - ((String) null).toString(); + throw new Exception("Stack log"); } catch (Exception e) { - Log.d("+++++++", - "HATL BEFORE" + + Timber.d( "HATL BEFORE" + "\nThread: " + Thread.currentThread().getName() + "\nobject: " + this.toString() + "\nMethod: " + method.getHttpUrl() + @@ -134,10 +138,9 @@ public class OwnCloudClient extends HttpClient { mHoldRequests = true; while (mHoldRequests) { try { - ((String) null).toString(); + throw new Exception("Stack log"); } catch (Exception e) { - Log.d("+++++++", - "HALT AFTER" + + Timber.d( "HALT AFTER" + "\nresponsecode: " + Integer.toString(status) + "\nThread: " + Thread.currentThread().getName() + "\nobject: " + this.toString() + @@ -147,7 +150,9 @@ public class OwnCloudClient extends HttpClient { Thread.sleep(40000); } } + } + */ if (mFollowRedirects) { status = followRedirection(method).getLastStatus(); @@ -162,6 +167,21 @@ public class OwnCloudClient extends HttpClient { return status; } + private void stacklog(int status, HttpBaseMethod method) { + try { + throw new Exception("Stack log"); + } catch(Exception e) { + Timber.d("\n---------------------------" + + "\nresponsecode: " + status + + "\nThread: " + Thread.currentThread().getName() + + "\nobject: " + this.toString() + + "\nMethod: " + method.toString() + + "\nUrl: " + method.getHttpUrl() + + "\ntrace: " + ExceptionUtils.getStackTrace(e) + + "---------------------------"); + } + } + private int executeRedirectedHttpMethod(HttpBaseMethod method) throws Exception { boolean repeatWithFreshCredentials; int repeatCounter = 0; diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java index 948e8a07..f9f0dbfa 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java @@ -42,17 +42,9 @@ public class OwnCloudClientFactory { */ public static OwnCloudClient createOwnCloudClient(Uri uri, Context context, boolean followRedirects) { OwnCloudClient client = new OwnCloudClient(uri); - client.setFollowRedirects(followRedirects); - HttpClient.setContext(context); - retrieveCookiesFromMiddleware(client); return client; } - - private static void retrieveCookiesFromMiddleware(OwnCloudClient client) { - final GetRemoteStatusOperation statusOperation = new GetRemoteStatusOperation(); - statusOperation.run(client); - } }