From 78ce98b8de8a889fb44515abe6b1085d5aff47db Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 25 Nov 2007 12:42:40 +1300 Subject: [PATCH] Consistently use URL without protocol://host:port prefix. --- inc/caldav-PROPFIND.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 4efca8b6..94289283 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -322,9 +322,7 @@ function collection_to_xml( $collection ) { $url = $c->protocol_server_port_script . $collection->dav_name; $url = preg_replace( '#^(https?://.+)//#', '$1/', $url ); // Ensure we don't double any '/' - if ( preg_match( '/ iCal 3\.0/', $_SERVER['HTTP_USER_AGENT'] ) ) { - $url = preg_replace('#^https?://[^/]+#', '', $url ); - } + $url = preg_replace('#^https?://[^/]+#', '', $url ); $resourcetypes = array( new XMLElement("collection") ); @@ -481,7 +479,10 @@ function item_to_xml( $item ) { $item->properties = get_arbitrary_properties($item->dav_name); - $url = $_SERVER['SCRIPT_NAME'] . $item->dav_name; + $url = $c->protocol_server_port_script . $item->dav_name; + $url = preg_replace( '#^(https?://.+)//#', '$1/', $url ); // Ensure we don't double any '/' + $url = preg_replace('#^https?://[^/]+#', '', $url ); + $prop = new XMLElement("prop"); $not_found = new XMLElement("prop"); $denied = new XMLElement("prop");