Attempt better debug for #79

This commit is contained in:
djmaze 2021-04-12 13:39:57 +02:00
parent 673815364f
commit 971bd70314

View file

@ -113,7 +113,9 @@ class Client
'Content-Type: application/xml' 'Content-Type: application/xml'
)); ));
if (301 == $response->status) { if (301 == $response->status) {
$url = preg_replace('@^(https?:)?//[^/]+/@', '/', $result->getRedirectLocation()); $location = $result->getRedirectLocation();
\trigger_error("Redirect {$url} to {$location}");
$url = \preg_replace('@^(https?:)?//[^/]+/@', '/', $location);
$parts = \parse_url($this->baseUri); $parts = \parse_url($this->baseUri);
$url = $parts['scheme'] . '://' . $parts['host'] . (isset($parts['port'])?':' . $parts['port']:'') . $url; $url = $parts['scheme'] . '://' . $parts['host'] . (isset($parts['port'])?':' . $parts['port']:'') . $url;
$response = $this->HTTP->doRequest('PROPFIND', $url, $body, array( $response = $this->HTTP->doRequest('PROPFIND', $url, $body, array(
@ -122,7 +124,7 @@ class Client
)); ));
} }
if (300 <= $response->status) { if (300 <= $response->status) {
throw new \SnappyMail\HTTP\Exception('', $response->status, $response); throw new \SnappyMail\HTTP\Exception("PROPFIND {$url}", $response->status, $response);
} }
/** /**