Am 14.02.2013 13:18, schrieb Ján Máté:
Hi,
On Feb 14, 2013, at 10:12 AM, Sven Anders anders@anduras.de wrote:
Ok, I missed that. But I found a bug here. You can remove categories, even, if you are not in the edit mode.
I have a problem adding static .ics calendars.
I configured:
var thisyear = new Date().getFullYear(); var globalSubscribedCalendars={hrefLabel: 'Externe', showHeader: true, calendars: [{displayName: 'Feiertage', href: 'http://www.mozilla.org/projects/calendar/caldata/GermanHolidays.ics', userAuth: {userName: '', userPassword: ''}, ignoreAlarm: true, color: '#AACCAA'}, {displayName: 'Ferien '+thisyear, href: 'http://www.schulferien.org/iCal/Ferien/icals/Ferien_Niedersachsen_%27+thisye...', userAuth: {userName: '', userPassword: ''}, ignoreAlarm: true, color: '#AAAACC'} ]};
The calendar is queried:
OPTIONS /iCal/Ferien/icals/Ferien_Niedersachsen_2013.ics?_=1360831644748 HTTP/1.1 Host: www.schulferien.org [...]
We use the GET method ... the OPTIONS is a preflight request sent by your browser because (stupid) jQuery adds some additional headers to request, but CORS allows only "simple headers".
The bad news is that we cannot solve this problem (it is not possible to prevent jQuery to send these headers) :-/ ... So the solution is to copy the ics file to your server (for example by a cron job and wget) or create a simple web server proxy (an URL which redirects you to another server/another URL).
The same bug was reported to jQuery (and they said that it was fixed in 1.5.1, but the current version is still buggy /maybe a returning bug?/): http://bugs.jquery.com/ticket/8423
But the answer is empty:
HTTP/1.1 200 OK Date: Thu, 14 Feb 2013 08:47:24 GMT Server: Apache Allow: GET,HEAD,POST,OPTIONS Content-Length: 0 Keep-Alive: timeout=2, max=200 Connection: Keep-Alive Content-Type: text/calendar
The problems seems to be, that the public server only delivers the calendars, if queried with the GET method. I did not found a configuration option to force this... Maybe we should add an option or handle .ics calendars different.
Hmmm?! Copying the .ics file isn't a solution (only a temporary workaround).
But I do not understand. The OPTIONS preflight request succeeded (even if it's empty). So why does it not work? Is a valid answer expected from the preflight request before the GET request is sent? If so, why can we not ignore it? Is this hard coded in jquery?
I did a quick check and the fix from the bug report is still in the code. But I did not find this code anywhere in the used jquery library?!
The comment says: "(it can always be set on a per-request basis or even using ajaxSetup)" Is it turned on anywhere in the code, even if we do not want it here???
Regards Sven