From 7edefc3b152dd04190bc200ca96fc567bd15a237 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Tue, 14 Sep 2010 13:52:27 +1200 Subject: [PATCH] [sync-caldav] When we PUT the request, save the request/response headers. We do a HEAD if we didn't get the ETag back from the PUT, but the server at the other end may have sent us a new location for the resource and we'll need to handle that at a higher level, so we make sure to preserve the original response from the PUT. --- inc/caldav-client-v2.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/caldav-client-v2.php b/inc/caldav-client-v2.php index 2b5f40b2..85f715a4 100644 --- a/inc/caldav-client-v2.php +++ b/inc/caldav-client-v2.php @@ -401,11 +401,15 @@ class CalDAVClient { if ( preg_match( '{^ETag:\s+"([^"]*)"\s*$}im', $this->httpResponseHeaders, $matches ) ) $etag = $matches[1]; if ( !isset($etag) || $etag == '' ) { printf( "No etag in:\n%s\n", $this->httpResponseHeaders ); + $save_request = $this->httpRequest; + $save_response_headers = $this->httpResponseHeaders; $this->DoHEADRequest( $url ); if ( preg_match( '{^Etag:\s+"([^"]*)"\s*$}im', $this->httpResponseHeaders, $matches ) ) $etag = $matches[1]; if ( !isset($etag) || $etag == '' ) { printf( "Still No etag in:\n%s\n", $this->httpResponseHeaders ); } + $this->httpRequest = $save_request; + $this->httpResponseHeaders = $save_response_headers; } return $etag; }