mirror of
https://github.com/moparisthebest/davmail
synced 2024-11-10 19:35:08 -05:00
Improve error handling: detect redirect to reason=0 as session expired
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1539 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
90d6648413
commit
1b2c7c720c
@ -602,10 +602,6 @@ public final class DavGatewayHttpClientFacade {
|
||||
if (followRedirects) {
|
||||
String queryString = method.getQueryString();
|
||||
checkExpiredSession(queryString);
|
||||
if (queryString != null && queryString.contains("reason=2")) {
|
||||
LOGGER.warn("GET failed, session expired at " + method.getURI() + ": " + method.getResponseBodyAsString());
|
||||
throw DavGatewayHttpClientFacade.buildHttpException(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,8 +613,8 @@ public final class DavGatewayHttpClientFacade {
|
||||
}
|
||||
|
||||
private static void checkExpiredSession(String queryString) throws DavMailAuthenticationException {
|
||||
if (queryString != null && queryString.contains("reason=2")) {
|
||||
LOGGER.warn("Request failed, session expired (reason=2) ");
|
||||
if (queryString != null && (queryString.contains("reason=2") || queryString.contains("reason=0"))) {
|
||||
LOGGER.warn("Request failed, session expired");
|
||||
throw new DavMailAuthenticationException("EXCEPTION_SESSION_EXPIRED");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user