Fix bug 674088 - Lightning hammers webdav server with repeated OPTIONS and PROPFIND when incorrectly configured as caldav. r=MakeMyDay
authorPhilipp Kewisch <mozilla@kewis.ch>
Wed, 22 Jul 2015 20:38:16 +0200
changeset 22840 9a718ca3cae10186ae34102d18515a89bf5145fa
parent 22839 39e76d5e07164030472e53cd0189c85bf678253e
child 22841 c53da8a616fa0edf206fdb45184216ee6699c331
push id1443
push usermbanner@mozilla.com
push dateMon, 10 Aug 2015 18:31:17 +0000
treeherdercomm-beta@8fe07d686c22 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMakeMyDay
bugs674088
Fix bug 674088 - Lightning hammers webdav server with repeated OPTIONS and PROPFIND when incorrectly configured as caldav. r=MakeMyDay
calendar/providers/caldav/calDavCalendar.js
--- a/calendar/providers/caldav/calDavCalendar.js
+++ b/calendar/providers/caldav/calDavCalendar.js
@@ -1861,41 +1861,43 @@ calDavCalendar.prototype = {
             if (!resourceTypeXml) {
                 resourceType = kDavResourceTypeNone;
             } else if (caldavXPath(resourceTypeXml[0], "C:calendar")) {
                 resourceType = kDavResourceTypeCalendar;
             } else if (caldavXPath(resourceTypeXml[0], "D:collection")) {
                 resourceType = kDavResourceTypeCollection;
             }
 
-            if (resourceType == kDavResourceTypeNone &&
-                !thisCalendar.mDisabled) {
+            if (resourceType == kDavResourceTypeNone) {
                 cal.LOG("CalDAV: No resource type received, " + thisCalendar.name + " doesn't seem to point to a DAV resource");
                 thisCalendar.completeCheckServerInfo(aChangeLogListener,
                                                      Components.interfaces.calIErrors.DAV_NOT_DAV);
                 return;
             }
 
-            if ((resourceType == kDavResourceTypeCollection) &&
-                !thisCalendar.mDisabled) {
+            if (resourceType == kDavResourceTypeCollection) {
                 cal.LOG("CalDAV: " + thisCalendar.name + " points to a DAV resource, but not a CalDAV calendar");
                 thisCalendar.completeCheckServerInfo(aChangeLogListener,
                                                      Components.interfaces.calIErrors.DAV_DAV_NOT_CALDAV);
                 return;
             }
 
-            // if this calendar was previously offline we want to recover
-            if ((resourceType == kDavResourceTypeCalendar) &&
-                thisCalendar.mDisabled) {
-                thisCalendar.mDisabled = false;
-                thisCalendar.mReadOnly = false;
+            if (resourceType == kDavResourceTypeCalendar) {
+                // If this calendar was previously offline we want to recover
+                if (thisCalendar.mDisabled) {
+                    thisCalendar.mDisabled = false;
+                    thisCalendar.mReadOnly = false;
+                }
+                thisCalendar.setCalHomeSet(true);
+                thisCalendar.checkServerCaps(aChangeLogListener);
             }
 
-            thisCalendar.setCalHomeSet(true);
-            thisCalendar.checkServerCaps(aChangeLogListener);
+            // If we get here something must have gone wrong. Abort with a
+            // general error to avoid an endless loop.
+            thisCalendar.completeCheckServerInfo(aChangeLogListener, Components.results.NS_ERROR_FAILURE);
         };
 
         this.sendHttpRequest(this.makeUri(), queryXml, MIME_TEXT_XML, null, (channel) => {
             channel.setRequestHeader("Depth", "0", false);
             channel.requestMethod = "PROPFIND";
             return streamListener;
         }, () => {
             notifyListener(Components.results.NS_ERROR_NOT_AVAILABLE,