[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.
This commit is contained in:
Andrew McMillan 2010-09-14 13:52:27 +12:00
parent 7ab8a3a3bb
commit 7edefc3b15

View File

@ -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;
}