Better debuggability of content-length mismatch
parent
8491a21d41
commit
1fe5064560
|
@ -286,7 +286,12 @@ class RemoteFilesystem
|
||||||
$contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
|
$contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
|
||||||
if ($contentLength && Platform::strlen($result) < $contentLength) {
|
if ($contentLength && Platform::strlen($result) < $contentLength) {
|
||||||
// alas, this is not possible via the stream callback because STREAM_NOTIFY_COMPLETED is documented, but not implemented anywhere in PHP
|
// alas, this is not possible via the stream callback because STREAM_NOTIFY_COMPLETED is documented, but not implemented anywhere in PHP
|
||||||
throw new TransportException('Content-Length mismatch');
|
$e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
|
||||||
|
$e->setHeaders($http_response_header);
|
||||||
|
$e->setStatusCode($this->findStatusCode($http_response_header));
|
||||||
|
$e->setResponse($result);
|
||||||
|
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
|
if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
|
||||||
|
|
Loading…
Reference in New Issue