Workaround for invalid redirect location

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1542 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-11-10 22:16:59 +00:00
parent f4ad37ee6f
commit 6277125a83
2 changed files with 8 additions and 2 deletions

View File

@ -148,10 +148,14 @@ public class EwsExchangeSession extends ExchangeSession {
// check EWS access
try {
checkEndPointUrl("/ews/exchange.asmx");
// workaround for Exchange bug: send fake request
internalGetFolder("");
} catch (IOException e) {
try {
// failover, try to retrieve EWS url from autodiscover
checkEndPointUrl(getEwsUrlFromAutoDiscover());
// workaround for Exchange bug: send fake request
internalGetFolder("");
} catch (IOException e2) {
// autodiscover failed and initial exception was authentication failure => throw original exception
if (e instanceof DavMailAuthenticationException) {
@ -164,8 +168,6 @@ public class EwsExchangeSession extends ExchangeSession {
try {
folderIdMap = new HashMap<String, String>();
// workaround for Exchange bug: send fake request
internalGetFolder("");
// load actual well known folder ids
folderIdMap.put(internalGetFolder(INBOX).folderId.value, INBOX);
folderIdMap.put(internalGetFolder(CALENDAR).folderId.value, CALENDAR);

View File

@ -303,6 +303,10 @@ public final class DavGatewayHttpClientFacade {
if (locationValue.indexOf('"') >= 0) {
locationValue = URIUtil.encodePath(locationValue);
}
// workaround for invalid relative location
if (locationValue.startsWith("./")) {
locationValue = locationValue.substring(1);
}
currentMethod.releaseConnection();
currentMethod = new GetMethod(locationValue);
currentMethod.setFollowRedirects(false);