diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/dav/client.php b/snappymail/v/0.0.0/app/libraries/snappymail/dav/client.php index 4db7b64bf..2bcff53d5 100644 --- a/snappymail/v/0.0.0/app/libraries/snappymail/dav/client.php +++ b/snappymail/v/0.0.0/app/libraries/snappymail/dav/client.php @@ -46,7 +46,7 @@ class Client } $this->baseUri = $settings['baseUri']; - $this->HTTP = \SnappyMail\HTTP\Request::factory('socket'); + $this->HTTP = \SnappyMail\HTTP\Request::factory(/*'socket'*/); $this->HTTP->proxy = $settings['proxy'] ?? null; $this->HTTP->setAuth(3, $settings['userName'] ?? '', $settings['password'] ?? ''); $this->HTTP->max_response_kb = 0; diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/http/request/curl.php b/snappymail/v/0.0.0/app/libraries/snappymail/http/request/curl.php index 313b83797..013e1f20b 100644 --- a/snappymail/v/0.0.0/app/libraries/snappymail/http/request/curl.php +++ b/snappymail/v/0.0.0/app/libraries/snappymail/http/request/curl.php @@ -94,7 +94,13 @@ class CURL extends \SnappyMail\HTTP\Request protected function fetchHeader($ch, $header) { - $this->response_headers[] = \rtrim($header); + static $headers = []; + if (!\strlen(\rtrim($header))) { + $this->response_headers = $headers; + $headers = []; + } else { + $headers[] = \rtrim($header); + } return \strlen($header); } diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/http/request/socket.php b/snappymail/v/0.0.0/app/libraries/snappymail/http/request/socket.php index e490c2a63..f37dbff51 100644 --- a/snappymail/v/0.0.0/app/libraries/snappymail/http/request/socket.php +++ b/snappymail/v/0.0.0/app/libraries/snappymail/http/request/socket.php @@ -91,7 +91,7 @@ class Socket extends \SnappyMail\HTTP\Request $response_headers[] = $data; $chunked |= \preg_match('#Transfer-Encoding:.*chunked#i', $data); - if (401 === $code && $this->auth['user']) { + if (401 === $code && $this->auth['user'] && !isset($extra_headers['Authorization'])) { // Basic authentication if ($this->auth['type'] & self::AUTH_BASIC && \preg_match("/WWW-Authenticate:\\s+Basic\\s+realm=([^\\r\\n]*)/i", $data, $match)) { $extra_headers['Authorization'] = "Authorization: Basic " . \base64_encode($this->auth['user'] . ':' . $this->auth['pass']);