Ensure the etag doesn't match the getctag for the calendar.

Just in case a client somewhere is doing something silly with them
that would screw up in that situation.
This commit is contained in:
Andrew McMillan 2009-06-19 00:00:22 +12:00
parent 45072cbe6d
commit b5eeb796dd
16 changed files with 33 additions and 30 deletions

View File

@ -433,19 +433,20 @@ BEGIN
END IF;
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
-- On insert or update modified, we set the NEW collection tag to the etag of the
-- updated row which gives us something predictable for our regression tests.
-- On insert or update modified, we set the NEW collection tag to the md5 of the
-- etag of the updated row which gives us something predictable for our regression
-- tests, but something different from the actual etag of the new event.
UPDATE collection
SET modified = current_timestamp, dav_etag = NEW.dav_etag
SET modified = current_timestamp, dav_etag = md5(NEW.dav_etag)
WHERE collection_id = NEW.collection_id;
IF TG_OP = 'INSERT' THEN
RETURN NEW;
END IF;
END IF;
-- On delete or update modified, we set the OLD collection tag to the md5 of the old
-- path & the old etag, which again gives us something predictable for our regression tests.
IF TG_OP = 'DELETE' THEN
-- On delete we set the OLD collection tag to the md5 of the old path & the old
-- etag, which again gives us something predictable for our regression tests.
UPDATE collection
SET modified = current_timestamp, dav_etag = md5(OLD.dav_name::text||OLD.dav_etag)
WHERE collection_id = OLD.collection_id;
@ -453,6 +454,8 @@ BEGIN
END IF;
IF NEW.collection_id != OLD.collection_id THEN
-- If we've switched the collection_id of this event, then we also need to update
-- the etag of the old collection - as we do for delete.
UPDATE collection
SET modified = current_timestamp, dav_etag = md5(OLD.dav_name::text||OLD.dav_etag)
WHERE collection_id = OLD.collection_id;

View File

@ -1,7 +1,7 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
ETag: "6c77ce79527ae2380b02762fdad7284d"
ETag: "47169ed9310a6c14d267c78c17a2496b"
Content-Length: 475
Content-Type: text/xml; charset="utf-8"
@ -17,7 +17,7 @@ Content-Type: text/xml; charset="utf-8"
<C:schedule-calendar/>
</resourcetype>
<displayname>user1 home</displayname>
<getetag>"8f581a053df6d833254756dfd7553d37"</getetag>
<getetag>"f94fbdb733bc8367373bff1ec573ba36"</getetag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>

View File

@ -1,7 +1,7 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
ETag: "c0eb6835ba6844d697fce333ba20c9f5"
ETag: "b0f0e90505257a98010cd129bee559bc"
Content-Length: 590
Content-Type: text/xml; charset="utf-8"
@ -17,7 +17,7 @@ Content-Type: text/xml; charset="utf-8"
<C:schedule-calendar/>
</resourcetype>
<displayname>user1 home</displayname>
<getetag>"8f581a053df6d833254756dfd7553d37"</getetag>
<getetag>"f94fbdb733bc8367373bff1ec573ba36"</getetag>
<current-user-privilege-set>
<privilege>
<all/>

View File

@ -1,7 +1,7 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
ETag: "2cf6e0a2957298dc61c5a90b650d4d01"
ETag: "cc05bebfa735e4f0ece20d0881208947"
Content-Length: 4267
Content-Type: text/xml; charset="utf-8"
@ -17,7 +17,7 @@ Content-Type: text/xml; charset="utf-8"
<C:schedule-calendar/>
</resourcetype>
<displayname>user1 home</displayname>
<getetag>"8f581a053df6d833254756dfd7553d37"</getetag>
<getetag>"f94fbdb733bc8367373bff1ec573ba36"</getetag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>

View File

@ -1,7 +1,7 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
ETag: "011216f39423de4124355f9206c17c9c"
ETag: "fcfd5dbd83ac87dbad74ae839c8f9693"
Content-Length: 702
Content-Type: text/xml; charset="utf-8"
@ -17,7 +17,7 @@ Content-Type: text/xml; charset="utf-8"
<C:schedule-calendar/>
</resourcetype>
<displayname>user1 home</displayname>
<A:getctag>"421abf7e4848d2fecbf64217ed205d4b"</A:getctag>
<A:getctag>"2bf1cd7e851d3961aa84e201035fddda"</A:getctag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>

View File

@ -1,7 +1,7 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
ETag: "545766d81a49a63df297e625f510cbe1"
ETag: "a49a7e4a5017a52585a5fe3a3659542e"
Content-Length: 4135
Content-Type: text/xml; charset="utf-8"
@ -16,7 +16,7 @@ Content-Type: text/xml; charset="utf-8"
<C:calendar/>
<C:schedule-calendar/>
</resourcetype>
<getetag>"421abf7e4848d2fecbf64217ed205d4b"</getetag>
<getetag>"2bf1cd7e851d3961aa84e201035fddda"</getetag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>

View File

@ -1,7 +1,7 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
ETag: "d572340caf57bae1197d72a287654356"
ETag: "d4bcb58c32706d332ffd4234c2280d89"
Content-Length: 3560
Content-Type: text/xml; charset="utf-8"
@ -40,7 +40,7 @@ Content-Type: text/xml; charset="utf-8"
<C:schedule-calendar/>
</resourcetype>
<displayname>user2 home</displayname>
<A:getctag>"13249ced6c7527191a003f54f7e3cd25"</A:getctag>
<A:getctag>"876883ebf6e5e80fb501f490c70803b5"</A:getctag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>

View File

@ -14,7 +14,7 @@
<displayname>user1 home</displayname>
<getlastmodified>Dow, 01 Jan 2000 00:00:00 GMT</getlastmodified>
<creationdate>Dow, 01 Jan 2000 00:00:00 GMT</creationdate>
<getetag>"8600dc4a1b264a09a5f741d710497cba"</getetag>
<getetag>"735679d819034badbcddd8aa6029bc3d"</getetag>
<acl>
<ace>
<principal>

View File

@ -21,7 +21,7 @@ Content-Type: text/xml; charset="utf-8"
<displayname>user1 home</displayname>
<getlastmodified>Dow, 01 Jan 2000 00:00:00 GMT</getlastmodified>
<creationdate>Dow, 01 Jan 2000 00:00:00 GMT</creationdate>
<getetag>"8600dc4a1b264a09a5f741d710497cba"</getetag>
<getetag>"735679d819034badbcddd8aa6029bc3d"</getetag>
<getcontentlanguage/>
<supportedlock>
<lockentry>

View File

@ -14,7 +14,7 @@
<displayname>user1 home</displayname>
<getlastmodified>Dow, 01 Jan 2000 00:00:00 GMT</getlastmodified>
<creationdate>Dow, 01 Jan 2000 00:00:00 GMT</creationdate>
<getetag>"8600dc4a1b264a09a5f741d710497cba"</getetag>
<getetag>"735679d819034badbcddd8aa6029bc3d"</getetag>
<getcontentlanguage/>
<supportedlock>
<lockentry>

View File

@ -14,7 +14,7 @@
<displayname>user1 home</displayname>
<getlastmodified>Dow, 01 Jan 2000 00:00:00 GMT</getlastmodified>
<creationdate>Dow, 01 Jan 2000 00:00:00 GMT</creationdate>
<getetag>"8600dc4a1b264a09a5f741d710497cba"</getetag>
<getetag>"735679d819034badbcddd8aa6029bc3d"</getetag>
<getcontentlanguage/>
</prop>
<status>HTTP/1.1 200 OK</status>

View File

@ -1,7 +1,7 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
ETag: "86838b0daef6fe98323edd166b5eb5f8"
ETag: "d52f0e3e3e3613d59611af4ca000c3c6"
Content-Length: 519
Content-Type: text/xml; charset="utf-8"
@ -17,7 +17,7 @@ Content-Type: text/xml; charset="utf-8"
<C:schedule-calendar/>
</resourcetype>
<displayname>user2 home</displayname>
<A:getctag>"13249ced6c7527191a003f54f7e3cd25"</A:getctag>
<A:getctag>"876883ebf6e5e80fb501f490c70803b5"</A:getctag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>

View File

@ -1,7 +1,7 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
ETag: "2956e44dbda09298b4bc353c27de7bc5"
ETag: "df869ffbdcfc5abd7d56c9c54d6b181e"
Content-Length: 1670
Content-Type: text/xml; charset="utf-8"
@ -11,8 +11,8 @@ Content-Type: text/xml; charset="utf-8"
<href>/caldav.php/user2/home/</href>
<propstat>
<prop>
<A:getctag>"13249ced6c7527191a003f54f7e3cd25"</A:getctag>
<getetag>"13249ced6c7527191a003f54f7e3cd25"</getetag>
<A:getctag>"876883ebf6e5e80fb501f490c70803b5"</A:getctag>
<getetag>"876883ebf6e5e80fb501f490c70803b5"</getetag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>

View File

@ -2,7 +2,7 @@ HTTP/1.1 200 OK
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
Content-Length: 9698
Etag: "8600dc4a1b264a09a5f741d710497cba"
Etag: "735679d819034badbcddd8aa6029bc3d"
Content-Type: text/calendar
BEGIN:VCALENDAR

View File

@ -2,7 +2,7 @@ HTTP/1.1 200 OK
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
Content-Length: 24642
Etag: "06663804d3bec5b85580d89056bcf54e"
Etag: "a52157c35d64e6051e54024625d3a94a"
Content-Type: text/calendar
BEGIN:VCALENDAR

View File

@ -1,7 +1,7 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
ETag: "9e78ea005d3f6d76f51990c052218f91"
ETag: "19ae9b52cb321d7735b6000bf6983b5a"
Content-Length: 3128
Content-Type: text/xml; charset="utf-8"
@ -40,7 +40,7 @@ Content-Type: text/xml; charset="utf-8"
<C:schedule-calendar/>
</resourcetype>
<displayname>User Six home</displayname>
<A:getctag>"6cc47e929c65c2342a578dcba09a2492"</A:getctag>
<A:getctag>"759d51f273f3a052dc930a6795f6e070"</A:getctag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>