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

remove retrive cookies from middleware

This commit is contained in:
Christian Schabesberger 2021-09-01 17:34:01 +02:00
parent 2f952a3a09
commit 0d94058db9
2 changed files with 26 additions and 14 deletions

View File

@ -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.HttpClient;
import com.owncloud.android.lib.common.http.HttpConstants; 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.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.network.RedirectionPath;
import com.owncloud.android.lib.common.utils.RandomUtils; import com.owncloud.android.lib.common.utils.RandomUtils;
import com.owncloud.android.lib.resources.status.OwnCloudVersion; 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) { if (mCredentials.getHeaderAuth() != null && method.getRequestHeader(AUTHORIZATION_HEADER) == null) {
method.setRequestHeader(AUTHORIZATION_HEADER, mCredentials.getHeaderAuth()); method.setRequestHeader(AUTHORIZATION_HEADER, mCredentials.getHeaderAuth());
} }
status = method.execute();
stacklog(status, method);
/*
synchronized (mHoldRequests) { synchronized (mHoldRequests) {
while (mHoldRequests) { while (mHoldRequests) {
while (true) { while (true) {
try { try {
((String) null).toString(); throw new Exception("Stack log");
} catch (Exception e) { } catch (Exception e) {
Log.d("+++++++", Timber.d( "HATL BEFORE" +
"HATL BEFORE" +
"\nThread: " + Thread.currentThread().getName() + "\nThread: " + Thread.currentThread().getName() +
"\nobject: " + this.toString() + "\nobject: " + this.toString() +
"\nMethod: " + method.getHttpUrl() + "\nMethod: " + method.getHttpUrl() +
@ -134,10 +138,9 @@ public class OwnCloudClient extends HttpClient {
mHoldRequests = true; mHoldRequests = true;
while (mHoldRequests) { while (mHoldRequests) {
try { try {
((String) null).toString(); throw new Exception("Stack log");
} catch (Exception e) { } catch (Exception e) {
Log.d("+++++++", Timber.d( "HALT AFTER" +
"HALT AFTER" +
"\nresponsecode: " + Integer.toString(status) + "\nresponsecode: " + Integer.toString(status) +
"\nThread: " + Thread.currentThread().getName() + "\nThread: " + Thread.currentThread().getName() +
"\nobject: " + this.toString() + "\nobject: " + this.toString() +
@ -147,7 +150,9 @@ public class OwnCloudClient extends HttpClient {
Thread.sleep(40000); Thread.sleep(40000);
} }
} }
} }
*/
if (mFollowRedirects) { if (mFollowRedirects) {
status = followRedirection(method).getLastStatus(); status = followRedirection(method).getLastStatus();
@ -162,6 +167,21 @@ public class OwnCloudClient extends HttpClient {
return status; 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 { private int executeRedirectedHttpMethod(HttpBaseMethod method) throws Exception {
boolean repeatWithFreshCredentials; boolean repeatWithFreshCredentials;
int repeatCounter = 0; int repeatCounter = 0;

View File

@ -42,17 +42,9 @@ public class OwnCloudClientFactory {
*/ */
public static OwnCloudClient createOwnCloudClient(Uri uri, Context context, boolean followRedirects) { public static OwnCloudClient createOwnCloudClient(Uri uri, Context context, boolean followRedirects) {
OwnCloudClient client = new OwnCloudClient(uri); OwnCloudClient client = new OwnCloudClient(uri);
client.setFollowRedirects(followRedirects); client.setFollowRedirects(followRedirects);
HttpClient.setContext(context); HttpClient.setContext(context);
retrieveCookiesFromMiddleware(client);
return client; return client;
} }
private static void retrieveCookiesFromMiddleware(OwnCloudClient client) {
final GetRemoteStatusOperation statusOperation = new GetRemoteStatusOperation();
statusOperation.run(client);
}
} }