Fix to get iCal in OS X 10.6 working (again):

WebDAV RFC 4918 allows a full url or a path as <D:href>:
        http://www.webdav.org/specs/rfc4918.html#ELEMENT_href
Some clients can NOT deal with one or the other:
- KAddressbook (at least in 3.5) can NOT subscribe to addressbooks (it
  does not find them) if just a path is used
- iCal in OS X 10.6 generates wrong requests, if a full url is used
This commit is contained in:
Ralf Becker 2009-09-14 08:48:30 +00:00
parent 910b08dd27
commit 53b5e86323
2 changed files with 26 additions and 4 deletions

View File

@ -51,6 +51,14 @@ class HTTP_WebDAV_Server
*/
var $base_uri;
/**
* Set if client requires <D:href> to be a url (true) or a path (false).
* RFC 4918 allows both: http://www.webdav.org/specs/rfc4918.html#ELEMENT_href
* But some clients can NOT deal with one or the other!
*
* @var boolean
*/
var $client_require_href_as_url;
/**
* URI path for this request
@ -142,11 +150,15 @@ class HTTP_WebDAV_Server
return;
}
// default is currently to use just the path, extending class can set $this->client_require_href_as_url depending on user-agent
if ($this->client_require_href_as_url)
{
// default uri is the complete request uri
$uri = (@$this->_SERVER["HTTPS"] === "on" ? "https:" : "http:");
$uri = (@$this->_SERVER["HTTPS"] === "on" ? "https:" : "http:") . '//'.$this->_SERVER['HTTP_HOST'];
}
// we cant use SCRIPT_NAME, because it fails, if there's any url rewriting
//error_log("pathinfo:\n". $this->_urldecode($this->_SERVER['REQUEST_URI']).":\n".$this->_SERVER['PATH_INFO']);
$uri.= '//'.$this->_SERVER['HTTP_HOST'].substr($this->_urldecode($this->_SERVER['REQUEST_URI']),0,-strlen($this->_SERVER["PATH_INFO"]));
$uri .= substr($this->_urldecode($this->_SERVER['REQUEST_URI']),0,-strlen($this->_SERVER["PATH_INFO"]));
$path_info = empty($this->_SERVER["PATH_INFO"]) ? "/" : $this->_SERVER["PATH_INFO"];
@ -971,7 +983,7 @@ class HTTP_WebDAV_Server
* GET method handler
*
* @param void
* @returns void
* @return void
*/
function http_GET()
{

View File

@ -90,6 +90,16 @@ class groupdav extends HTTP_WebDAV_Server
{
if ($this->debug > 2) error_log('groupdav: $_SERVER='.array2string($_SERVER));
// identify clients, which do NOT support path AND full url in <D:href> of PROPFIND request
switch(groupdav_handler::get_agent())
{
case 'kde': // KAddressbook (at least in 3.5 can NOT subscribe / does NOT find addressbook)
$this->client_require_href_as_url = true;
break;
case 'davkit': // iCal app in OS X 10.6 created wrong request, if full url given
$this->client_require_href_as_url = false;
break;
}
parent::HTTP_WebDAV_Server();
$this->translation =& $GLOBALS['egw']->translation;