GNOME Bugzilla – Bug 630265
Refetches unchanged 'On The Web' calendar
Last modified: 2013-09-14 16:53:57 UTC
Evolution is repeatedly refetching a rather large calendar via HTTP when it hasn't changed. Isn't there some way (HTTP 'HEAD' request) that this could be avoided?
I'm afraid there isn't. CalDAV has an extension, called getctag, which is similar to etag in webdav, just the ctag is a 'calendar tag', and changes whenever the calendar is modified. Dan, do you know of any header suitable for "did it change" query for a web calendar, which is just a simple file download through libsoup? Something like last modification time or anything like that.
And/or the ETag... [dwmw2@i7 libical]$ telnet casper 80 Trying 2001:770:15f::2... Connected to casper. Escape character is '^]'. HEAD /whatever.ics HTTP/1.1 Host: david.woodhou.se HTTP/1.1 200 OK Date: Fri, 24 Sep 2010 14:25:28 GMT Server: Apache/2.2.15 (Fedora) Last-Modified: Fri, 30 Jul 2010 06:42:00 GMT ETag: "681e3-2a47-48c9525db7e00" Accept-Ranges: bytes Content-Length: 10823 Connection: close Content-Type: text/calendar Connection closed by foreign host.
you can do either If-Modified-Since: TIMESTAMP or If-None-Match: ETAG (where TIMESTAMP can be generated with soup_date_to_string() with SOUP_DATE_HTTP, or an equivalent strftime() invocation). If it hasn't changed you'll get back "304 Not Modified" and no body. (In theory. The server might not implement conditional requests, in which case it would ignore the If-* header and just return the full body anyway.)
Sounds perfect; thanks.
Created attachment 171226 [details] [review] eds patch for evolution-data-server; Thanks Dan. Because www.gnome.org also supports ETag, then I chose that one. The patch also fixes an issue with "Refresh" on a webcal calendar, it didn't work until the first refetch. I added a debugging with WEBCAL_DEBUG to it too, to see what is sent/received through libsoup.
Created commit cb78293 in eds master (2.91.1+) Created commit 66226a0 in eds gnome-2-32 (2.32.1+)
Works well here too; thanks. (I cherry-picked into my 2.30 build)