When sync-collection is asked for data, only return it if < 50 rows.

The resource data element is not *actually* allowed, per the spec, but
some clients do use it, and some servers do support it.  In the case
of an initial sync which requests it we don't want to send down a huge
response to an ill-considered client.
This commit is contained in:
Andrew McMillan 2011-05-13 14:53:43 +12:00
parent 54bc63e90f
commit b301a36aca
2 changed files with 5 additions and 0 deletions

View File

@ -1597,6 +1597,7 @@ EOQRY;
case 'urn:ietf:params:xml:ns:carddav:address-data':
case 'urn:ietf:params:xml:ns:caldav:calendar-data':
if ( $this->_is_collection ) return false;
if ( !isset($c->sync_resource_data_ok) || $c->sync_resource_data_ok == false ) return false;
if ( !isset($this->resource) ) $this->FetchResource();
$reply->NSElement($prop, $tag, $this->resource->caldav_data );
break;

View File

@ -91,6 +91,10 @@ EOSQL;
$first_status = 0;
if ( $qry->Exec("REPORT",__LINE__,__FILE__) ) {
if ( $qry->rows() > 50 ) {
// If there are more than 50 rows to send we should not send full data in response ...
$c->sync_resource_data_ok = false;
}
while( $object = $qry->Fetch() ) {
if ( $object->dav_name == $last_dav_name ) {
/** The complex case: this is the second or subsequent for this dav_id */