From 045444dee303d60e74edd8efa28ebc0fbd7907d1 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 22 Jun 2020 11:43:12 +0200 Subject: mirror.php: give estimate of size in Header --- mirror.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mirror.php b/mirror.php index 8701035..0cc2836 100644 --- a/mirror.php +++ b/mirror.php @@ -74,6 +74,14 @@ } } if (! file_exists($pfad)) { + $size = shell_exec( + "curl -ILs -A 'Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0' '".$quelle."' " . + "| sed '" . + "s/^Content-Length: //;t;d" . + "'" + ); + if (! empty($size)) + header('Content-Length: ' . $size); passthru( "mkdir -p '".dirname($pfad)."'; ". "( ". @@ -85,6 +93,7 @@ ); } else { + header('Content-Length: ' . $stat['size']); $handle = fopen($pfad); fpassthru($handle); fclose($handle); -- cgit v1.2.3-54-g00ecf