1
0
Fork 0

fail download on content-length mismatch

pull/5137/head
David Zuelke 2016-04-01 01:36:05 +02:00
parent e8b1a5f357
commit 5dd4d69a6d
1 changed files with 5 additions and 0 deletions

View File

@ -277,6 +277,11 @@ class RemoteFilesystem
try { try {
$result = file_get_contents($fileUrl, false, $ctx); $result = file_get_contents($fileUrl, false, $ctx);
if ($this->bytesMax && strlen($result) < $this->bytesMax) {
// 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');
}
if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) { if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
// Emulate fingerprint validation on PHP < 5.6 // Emulate fingerprint validation on PHP < 5.6
$params = stream_context_get_params($ctx); $params = stream_context_get_params($ctx);