Closed
Bug 498690
Opened 17 years ago
Closed 16 years ago
support for webdav-sync spec
Categories
(Calendar :: Provider: CalDAV, enhancement)
Calendar
Provider: CalDAV
Tracking
(Not tracked)
RESOLVED
FIXED
1.0b2
People
(Reporter: WSourdeau, Assigned: nomisvai)
References
()
Details
Attachments
(1 file, 4 obsolete files)
|
63.42 KB,
patch
|
Fallen
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fr; rv:1.9.0.10) Gecko/2009042805 Iceweasel/3.0.9 (Debian-3.0.9-1)
Build Identifier: 20090608035852
Retrieving event etags is definitely not scalable. The reason is that as calendar tend to grow, the ratio of changed events/total events will reduce very much, while still increasing the resource used on the servers.
The webdav-sync spec of Cyrus Daboo seems to address that issue and I think it would be interesting to integrate it in Lightning, in order to reduce the server load in wide environment.
Reproducible: Always
| Reporter | ||
Comment 1•17 years ago
|
||
For those who don't see the url field above easily: http://ietfreport.isoc.org/idref/draft-daboo-webdav-sync/
Comment 2•17 years ago
|
||
Sounds interesting. Does sogo support this spec yet? Does apple's calendar server support the spec?
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Reporter | ||
Comment 3•17 years ago
|
||
SOGo doesn't support it yet but we would be willing to do so if it is accepted in Lightning. We would even implement it ourselves and provide a patch. The idea would be to keep different ways of doing synchronization depending on the server capabilities and degrade gracefully between the different implementations.
| Reporter | ||
Comment 4•17 years ago
|
||
As for the iCal server, it doesn't support it yet. But I think it should not preclude Lightning from implementing it, especially since it's relatively well thought and could easily be implemented in other servers as time goes. Note that the spec is quite new too so I am not sure many people know about it yet either.
Comment 5•17 years ago
|
||
Of course it will be accepted, especially since it will not be in the way for servers that don't support it and it increases performance for servers that implement it. Looking forward to your patches :-)
Assignee: nobody → WSourdeau
Status: NEW → ASSIGNED
| Assignee | ||
Comment 6•16 years ago
|
||
I have adapted Wolfgang's patch he did for Lightning 0.9.x Inverse Edition. With a few changes:
- Add support for upcoming webdav sync draft #3
- Not getting the ctag anymore since it's redundant with webdav sync
| Assignee | ||
Updated•16 years ago
|
Attachment #424013 -
Flags: review?(philipp)
Comment 7•16 years ago
|
||
Comment on attachment 424013 [details] [diff] [review]
I have adapted Wolfgang's patch he did for Lightning 0.9.x Inverse Edition.
Just a shallow review for now, in general I have a good feeling about this patch though.
Please take a look at the style guide (https://wiki.mozilla.org/Calendar:Style_Guide), the most obvious Problems were redundant whitespaces.
>-
>+
>+ mWebdavSyncToken: null,
>+
>+ mHasWebdavSyncSupport: false,
I'd appreciate if you could add a one-line comment for each of these attributes. Also, make sure you don't add extra whitespaces, like in the line above mWebdavSyncToken.
>+ addTargetCalendarItem : function caldav_addTargetCalendarItem(href,calData,aUri, etag, aListener) {
I realize you've mostly copied and pasted this function, but I'd appreciate if you could change the var's to let's.
>+
>+ LOG("CalDAV: deleteTargetCalendarItem href: " + path + ", uid: " + foundItem.id);
Please Use cal.LOG, we are transitioning away from diectly using functions from calUtils.js and instead want to use the functions imported through modules/calUtils.jsm. These are all prefixed with "cal.".
>+ isDeleted=true;
Blanks around operators.
>+ finalizeUpdatedItems: function calDav_finalizeUpdatedItems(aChangeLogListener, calendarURI) {
I'd appreciate function header documentation here and for the last two functions.
>+ }
>+ },
> /**
> * Retrieves a specific item from the CalDAV store.
Please leave a blank line between closing the function and the comment.
>+ if (!this.mCtag || this.mHasWebdavSyncSupport || !this.mFirstRefreshDone) {
>+
This function used to only be called when there was no ctag at all, why does this have to be done each time when webdav sync support is enabled?
>+
>+ if (this.mHasWebdavSyncSupport) {
>+ webDavSync = new webDavSyncHandler(this,aUri,aChangeLogListener);
>+ webDavSync.doWebDAVSync();
>+ return;
>+ }
Maybe you can add an inline comment here so its harder to miss that the function may be returning here.
>+ thisCalendar.addTargetCalendarItem(href,calData,aUri,etag, aListener);
Please add a space betwen the parameters, as between etag and aListener.
>+ let webDavSyncFeatureEnabled=getPrefSafe("calendar.caldav.webdavsync.enabled", true)
Do you consider this feature very experimental? If not and you think this can coexist with most servers regardless of if they support webdav sync or not, I think we don't need a pref for this.
>+ for (var i = 0;
>+ !thisCalendar.mHasWebdavSyncSupport && i < reportSet..D::["report"].length();
>+ i++) {
>+ var reportName = reportSet..D::["report"][i].*[0].localName();
>+ if (reportName == "sync-collection") {
>+ LOG("[CalDAV] collection has webdav sync support");
>+ thisCalendar.mHasWebdavSyncSupport = true;
>+ }
>+ }
>+ }
I believe you can write this like:
if (thisCalendar.mHasWebdavSyncSypport &&
reportSet..D::["report"]..sync-collection) {
cal.LOG("[CalDAV] collection has webdav sync support");
thisCalendar.mHasWebdavSyncSupport = true;
}
If not like that, there is a similar syntax that allows you to specifically retrieve the node with the given tag name. I believe this is faster than manually iterating through all nodes in DAV:report. You could make the selector even more specific (i.e avoiding the .. subselector) to improve performance minimally.
>+ cal.WARN("websync - No response status doing webdav sync for calendar " + this.calendar.name);
Please prefix with CalDAV: instead of websync -, here and elsewhere.
>+ // Invalidate sync token with 40x errors that could indicate the
>+ // sync token has become invalid and do a refresh
>+ else if (this.calendar.mWebdavSyncToken != null &&
>+ (responseStatus == 400 ||
>+ responseStatus == 403 ||
>+ responseStatus == 409)) {
You could shorten this by checking (responseStatus / 100 == 4)
>+ onDataAvailable: function wSL_onDataAvailable(request, context, inputStream, offset, count) {
>+ if (this._reader) {
>+ // No reader means request error
>+ this._reader.onDataAvailable(request, context, inputStream, offset, count);
>+ }
>+ },
>+
>+
>+ /**
>+ * @see nsISAXErrorHandler
>+ */
>+ fatalError: function wH_fatalError() {
>+ WARN("websync - Fatal Error doing webdav sync for " + this.calendar.name);
>+ },
One empty line between functions is sufficient.
>+ if (this.isInPropStat) {
>+ this.tag = "propstat."+aLocalName;
>+ }
>+ else {
>+ this.tag = aLocalName;
>+ }
if (...) {
} else {
}
>+ processingInstruction: function wH_processingInstruction(aTarget, aData) { }
>+};
>\ No newline at end of file
Please make sure your editor adds a newline to the end of files. If there is no setting, you may have to just add a blank line at the end.
I'll give this patch a test as soon as I am out of my exams, then we can take care of the final review. I'm going to r- for now to fix the minor nits. As said, aside from that the patch looks fine though!
Attachment #424013 -
Flags: review?(philipp) → review-
| Assignee | ||
Updated•16 years ago
|
Assignee: WSourdeau → simon.at.orcl
| Assignee | ||
Comment 8•16 years ago
|
||
Attachment #424013 -
Attachment is obsolete: true
Attachment #424264 -
Flags: review?(philipp)
| Assignee | ||
Comment 9•16 years ago
|
||
Attachment #424264 -
Attachment is obsolete: true
Attachment #425205 -
Flags: review?(philipp)
Attachment #424264 -
Flags: review?(philipp)
Comment 10•16 years ago
|
||
Comment on attachment 425205 [details] [diff] [review]
Patch v3, successfully tested against Oracle, Apple and Sun servers
I've just tested this with Google's caldav implementation and unfortunately it fails. Looks like Google doesn't support the sync-collection request. Their message from the http response is:
> bad root element in REPORT body: [Element: <sync-collection [Namespace: DAV:]/>]
If the webdav/caldav specs require sync-collection, I'll be happy to file a bug on google's issue tracker, but we should handle this client side too. I get the following error console messages:
> CalDAV: sync start token: null
> Warning: CalDAV: Error doing webdav sync: 400
> Warning: There has been an error reading data for calendar: kewisch.moz caldav. However, this error is believed to be minor, so the program will attempt to continue. Error code: DAV_REPORT_ERROR. Description: There has been an error reading data for calendar: https://www.google.com/calendar/dav/kewisch.moz%40gmail.com/events/. It has been disabled until it is safe to use it.
> Warning: There has been an error reading data for calendar: kewisch.moz caldav. However, this error is believed to be minor, so the program will attempt to continue. Error code: READ_FAILED. Description:
> CalDAV: recv:
> CalDAV: onStopRequest: no reader
Instead of failing, we should merely note that the server doesn't support webdav sync and then carry on. This needs to be fixed for r+.
Your patch also contains a lot of extra whitespaces at line endings. I've fixed this locally since I didn't expect the patch to fail, so I'll upload that to save you some work.
Attachment #425205 -
Flags: review?(philipp) → review-
Comment 11•16 years ago
|
||
Attachment #425205 -
Attachment is obsolete: true
Attachment #427372 -
Flags: review-
| Assignee | ||
Comment 12•16 years ago
|
||
This patch adds to the original fixes:
1) The Webdav sync e4x detection issue
2) There was a similar e4x issue with the way supported-calendar-component-set was dealt with, it is also fixed in this patch.
3) When testing with google calendar I noticed that some servers (google) return the hrefs in either encoded urls(etag search) or not encoded (multiget), I believe this is the cause of bug 462110. This would confuse the href comparison done in the etag handler. I have fixed the issue by decoding all hrefs from xml reports before adding them to the local tables.
Attachment #427372 -
Attachment is obsolete: true
| Assignee | ||
Updated•16 years ago
|
Attachment #427765 -
Flags: review?(philipp)
Comment 13•16 years ago
|
||
Comment on attachment 427765 [details] [diff] [review]
Fix webdavsync detection + url encoding issue
I've removed some LOG statements that cause a lot of output, otherwise r=philipp
Attachment #427765 -
Flags: review?(philipp) → review+
Comment 14•16 years ago
|
||
Pushed to comm-central <http://hg.mozilla.org/comm-central/rev/adc24a08b1b4>
-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
OS: Linux → All
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: --- → 1.0b2
You need to log in
before you can comment on or make changes to this bug.
Description
•