Strip any protocol/host/port part from a MOVE Destination.

This commit is contained in:
Andrew McMillan 2011-09-11 00:45:29 +12:00
parent a4523dc7dd
commit 6f8e2b1d6e

View File

@ -85,6 +85,11 @@ class CalDAVRequest
*/
protected $exists;
/**
* The value of any 'Destionation:' header, if present.
*/
var $destination;
/**
* The decimal privileges allowed by this user to the identified resource.
*/
@ -166,7 +171,12 @@ class CalDAVRequest
/**
* MOVE/COPY use a "Destination" header and (optionally) an "Overwrite" one.
*/
if ( isset($_SERVER['HTTP_DESTINATION']) ) $this->destination = $_SERVER['HTTP_DESTINATION'];
if ( isset($_SERVER['HTTP_DESTINATION']) ) {
$this->destination = $_SERVER['HTTP_DESTINATION'];
if ( preg_match('{^(https?)://([a-z.-]+)(:[0-9]+)?(/.*)$}', $this->destination, $matches ) ) {
$this->destination = $matches[4];
}
}
$this->overwrite = ( isset($_SERVER['HTTP_OVERWRITE']) && ($_SERVER['HTTP_OVERWRITE'] == 'F') ? false : true ); // RFC4918, 9.8.4 says default True.
/**