Caldav: fix bug 2896135, iCal login fails at iCal startup

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@895 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-12-22 21:47:43 +00:00
parent f4f472ed27
commit 3f22413dda
1 changed files with 14 additions and 12 deletions

View File

@ -786,7 +786,7 @@ public class CaldavConnection extends AbstractConnection {
} }
// send user outbox // send user outbox
if (request.hasProperty("schedule-outbox-URL")) { if (request.hasProperty("schedule-outbox-URL")) {
response.appendHrefProperty("C:schedule-outbox-URL", "/users/"+session.getEmail()+"/outbox" ); response.appendHrefProperty("C:schedule-outbox-URL", "/users/" + session.getEmail() + "/outbox");
} }
} }
@ -996,16 +996,18 @@ public class CaldavConnection extends AbstractConnection {
*/ */
public void sendHttpResponse(int status, Map<String, String> headers, String contentType, byte[] content, boolean keepAlive) throws IOException { public void sendHttpResponse(int status, Map<String, String> headers, String contentType, byte[] content, boolean keepAlive) throws IOException {
sendClient("HTTP/1.1 " + status + ' ' + HttpStatus.getStatusText(status)); sendClient("HTTP/1.1 " + status + ' ' + HttpStatus.getStatusText(status));
String version = DavGateway.getCurrentVersion(); if (status != HttpStatus.SC_UNAUTHORIZED) {
sendClient("Server: DavMail Gateway " + (version == null ? "" : version)); String version = DavGateway.getCurrentVersion();
sendClient("DAV: 1, calendar-access, calendar-schedule, calendarserver-private-events"); sendClient("Server: DavMail Gateway " + (version == null ? "" : version));
SimpleDateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH); sendClient("DAV: 1, calendar-access, calendar-schedule, calendarserver-private-events");
// force GMT timezone SimpleDateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
formatter.setTimeZone(ExchangeSession.GMT_TIMEZONE); // force GMT timezone
String now = formatter.format(new Date()); formatter.setTimeZone(ExchangeSession.GMT_TIMEZONE);
sendClient("Date: " + now); String now = formatter.format(new Date());
sendClient("Expires: " + now); sendClient("Date: " + now);
sendClient("Cache-Control: private, max-age=0"); sendClient("Expires: " + now);
sendClient("Cache-Control: private, max-age=0");
}
if (headers != null) { if (headers != null) {
for (Map.Entry<String, String> header : headers.entrySet()) { for (Map.Entry<String, String> header : headers.entrySet()) {
sendClient(header.getKey() + ": " + header.getValue()); sendClient(header.getKey() + ": " + header.getValue());
@ -1383,7 +1385,7 @@ public class CaldavConnection extends AbstractConnection {
if (subFolder == null || subFolder.length() == 0) { if (subFolder == null || subFolder.length() == 0) {
return getExchangeFolderPath(); return getExchangeFolderPath();
} else { } else {
return getExchangeFolderPath()+'/'+subFolder; return getExchangeFolderPath() + '/' + subFolder;
} }
} }
} }