mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-03-13 08:00:15 +00:00
Support start or end missing from free-busy-query REPORT
Previously if either start or end were missing then the current time was used. This would almost never be the expected behaviour.
This commit is contained in:
parent
014ee35372
commit
9c10ef5eb2
@ -1,3 +1,7 @@
|
||||
2024-03-02 Andrew Ruthve <andrew@etc.gen.nz>
|
||||
* Fix free-busy-query REPORT if start/end is missing, previously the
|
||||
current timestamp was used for missing values.
|
||||
|
||||
2023-03-02 Florian Schlichting <fsfs@debian.org>
|
||||
* release davical 1.1.12
|
||||
* add Debian autopkgtests
|
||||
|
||||
@ -10,9 +10,34 @@ $fbq_end = $fbq_content[0]->GetAttribute('end');
|
||||
if ( ! ( isset($fbq_start) || isset($fbq_end) ) ) {
|
||||
$request->DoResponse( 400, 'All valid freebusy requests MUST contain a time-range filter' );
|
||||
}
|
||||
$range_start = new RepeatRuleDateTime($fbq_start);
|
||||
$range_end = new RepeatRuleDateTime($fbq_end);
|
||||
|
||||
if ( isset($fbq_start) ) {
|
||||
$range_start = new RepeatRuleDateTime($fbq_start);
|
||||
} else {
|
||||
# RFC 4791 Section 9.9 says that if start isn't set, then -infinity
|
||||
# should be used. We can't specify that in PHP, and
|
||||
# expand_event_instances has '-6 weeks' as the default.
|
||||
# That's a bit short, go for one year prior to end, if defined,
|
||||
# otherwise 1 year prior to now now.
|
||||
if ( isset($fbq_end) ) {
|
||||
$range_start = new RepeatRuleDateTime($fbq_end);
|
||||
} else {
|
||||
$range_start = new RepeatRuleDateTime;
|
||||
}
|
||||
|
||||
$range_start->modify('-365 days');
|
||||
}
|
||||
|
||||
if ( isset($fbq_end) ) {
|
||||
$range_end = new RepeatRuleDateTime($fbq_end);
|
||||
} else {
|
||||
# RFC 4791 Section 9.9 says that if end isn't set, then +infinity
|
||||
# should be used. We can't specify that in PHP, and
|
||||
# expand_event_instances has '+ 6 weeks' as the default. That's a
|
||||
# bit short, go for two years from the start.
|
||||
$range_end = clone($range_start);
|
||||
$range_end->modify('+730 days');
|
||||
}
|
||||
|
||||
/** We use the same code for the REPORT, the POST and the freebusy GET... */
|
||||
$freebusy = get_freebusy( '^' . $request->path . $request->DepthRegexTail(true), $range_start, $range_end );
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
HTTP/1.1 400 Bad Request
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
Content-Length: 60
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
|
||||
All valid freebusy requests MUST contain a time-range filter
|
||||
@ -0,0 +1,20 @@
|
||||
#
|
||||
# Request a REPORT with no start end end set, should return an error.
|
||||
#
|
||||
TYPE=REPORT
|
||||
URL=http://regression.host/caldav.php/user1/291-test-fb-rr-changes/
|
||||
HEADER=Accept: text/calendar
|
||||
HEADER=Content-Type: text/xml
|
||||
HEADER=Depth: 1
|
||||
HEAD
|
||||
|
||||
AUTH=user4:user4
|
||||
|
||||
BEGINDATA
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<C:free-busy-query xmlns:C="urn:ietf:params:xml:ns:caldav">
|
||||
<C:time-range />
|
||||
</C:free-busy-query>
|
||||
ENDDATA
|
||||
|
||||
REPLACE=/^DTSTAMP:\d{8}T\d{6}Z\r?$/DTSTAMP:yyyymmddThhmmssZ/
|
||||
@ -0,0 +1,21 @@
|
||||
HTTP/1.1 200 OK
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
Content-Length: 398
|
||||
Content-Type: text/calendar;charset=UTF-8
|
||||
|
||||
BEGIN:VCALENDAR
|
||||
PRODID:-//davical.org//NONSGML AWL Calendar//EN
|
||||
VERSION:2.0
|
||||
CALSCALE:GREGORIAN
|
||||
BEGIN:VFREEBUSY
|
||||
DTSTAMP:yyyymmddThhmmssZ
|
||||
DTSTART:20230416T140000Z
|
||||
DTEND:20250415T140000Z
|
||||
FREEBUSY:20230416T210000Z/20230416T212500Z
|
||||
FREEBUSY:20230418T230000Z/20230418T232500Z
|
||||
FREEBUSY:20230419T210000Z/20230419T212500Z
|
||||
FREEBUSY:20230420T210000Z/20230420T212500Z
|
||||
END:VFREEBUSY
|
||||
END:VCALENDAR
|
||||
@ -0,0 +1,21 @@
|
||||
#
|
||||
P
|
||||
# Request a REPORT with only start set, end should be sometime in the future.
|
||||
#
|
||||
TYPE=REPORT
|
||||
URL=http://regression.host/caldav.php/user1/291-test-fb-rr-changes/
|
||||
HEADER=Accept: text/calendar
|
||||
HEADER=Content-Type: text/xml
|
||||
HEADER=Depth: 1
|
||||
HEAD
|
||||
|
||||
AUTH=user4:user4
|
||||
|
||||
BEGINDATA
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<C:free-busy-query xmlns:C="urn:ietf:params:xml:ns:caldav">
|
||||
<C:time-range start="20230416T140000Z" />
|
||||
</C:free-busy-query>
|
||||
ENDDATA
|
||||
|
||||
REPLACE=/^DTSTAMP:\d{8}T\d{6}Z\r?$/DTSTAMP:yyyymmddThhmmssZ/
|
||||
@ -0,0 +1,21 @@
|
||||
HTTP/1.1 200 OK
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
Content-Length: 398
|
||||
Content-Type: text/calendar;charset=UTF-8
|
||||
|
||||
BEGIN:VCALENDAR
|
||||
PRODID:-//davical.org//NONSGML AWL Calendar//EN
|
||||
VERSION:2.0
|
||||
CALSCALE:GREGORIAN
|
||||
BEGIN:VFREEBUSY
|
||||
DTSTAMP:yyyymmddThhmmssZ
|
||||
DTSTART:20220421T220000Z
|
||||
DTEND:20230421T220000Z
|
||||
FREEBUSY:20230416T210000Z/20230416T212500Z
|
||||
FREEBUSY:20230418T230000Z/20230418T232500Z
|
||||
FREEBUSY:20230419T210000Z/20230419T212500Z
|
||||
FREEBUSY:20230420T210000Z/20230420T212500Z
|
||||
END:VFREEBUSY
|
||||
END:VCALENDAR
|
||||
@ -0,0 +1,21 @@
|
||||
#
|
||||
P
|
||||
# Request a REPORT with only end set, start should be sometime in the past.
|
||||
#
|
||||
TYPE=REPORT
|
||||
URL=http://regression.host/caldav.php/user1/291-test-fb-rr-changes/
|
||||
HEADER=Accept: text/calendar
|
||||
HEADER=Content-Type: text/xml
|
||||
HEADER=Depth: 1
|
||||
HEAD
|
||||
|
||||
AUTH=user4:user4
|
||||
|
||||
BEGINDATA
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<C:free-busy-query xmlns:C="urn:ietf:params:xml:ns:caldav">
|
||||
<C:time-range end="20230421T220000Z" />
|
||||
</C:free-busy-query>
|
||||
ENDDATA
|
||||
|
||||
REPLACE=/^DTSTAMP:\d{8}T\d{6}Z\r?$/DTSTAMP:yyyymmddThhmmssZ/
|
||||
Loading…
x
Reference in New Issue
Block a user