Update common.php
This commit is contained in:
parent
cfe58c24e3
commit
00110c04f3
|
@ -624,19 +624,29 @@ function main($path)
|
||||||
$header = [];
|
$header = [];
|
||||||
if (isset($_SERVER['HTTP_RANGE'])) $header = [ 'Range' => $_SERVER['HTTP_RANGE'] ];
|
if (isset($_SERVER['HTTP_RANGE'])) $header = [ 'Range' => $_SERVER['HTTP_RANGE'] ];
|
||||||
//else $header = [ 'Range' => 'Range: bytes=0-102399' ];//1048575
|
//else $header = [ 'Range' => 'Range: bytes=0-102399' ];//1048575
|
||||||
error_log('SERVER:'.json_encode($_SERVER,JSON_PRETTY_PRINT));
|
//error_log('SERVER:'.json_encode($_SERVER,JSON_PRETTY_PRINT));
|
||||||
error_log('Header2MS:'.json_encode($header,JSON_PRETTY_PRINT));
|
//error_log('Header2MS:'.json_encode($header,JSON_PRETTY_PRINT));
|
||||||
$response = curl_request( $files['@microsoft.graph.downloadUrl'], '', $header );
|
$response = curl_request( $files['@microsoft.graph.downloadUrl'], '', $header );
|
||||||
|
$header = [];
|
||||||
foreach (explode("\r\n", $response['header']) as $h) {
|
foreach (explode("\r\n", $response['header']) as $h) {
|
||||||
$a=explode(": ", $h);
|
$a=explode(": ", $h);
|
||||||
if ($a[1]!='') $head[$a[0]] = $a[1];
|
if ($a[1]!='') $header[$a[0]] = $a[1];
|
||||||
}
|
}
|
||||||
//Content-Length: 387780
|
//Content-Length: 387780
|
||||||
//Content-Range: bytes 0-387779/387780
|
//Content-Range: bytes 0-387779/387780
|
||||||
//"Content-Type": "application\/octet-stream",
|
//"Content-Type": "application\/octet-stream",
|
||||||
//"Accept-Ranges": "bytes",
|
//"Accept-Ranges": "bytes",
|
||||||
// $head['Content-Range']
|
$head['Content-Length'] = $header['Content-Length'];
|
||||||
error_log('Header2usr:'.json_encode($head,JSON_PRETTY_PRINT));
|
$head['Content-Range'] = $header['Content-Range'];
|
||||||
|
$head['Content-Type'] = $header['Content-Type'];
|
||||||
|
$head['Accept-Ranges'] = $header['Accept-Ranges'];
|
||||||
|
$range = $head['Content-Range'];
|
||||||
|
$e = explode("-", $range)[1];
|
||||||
|
$t = explode("/", $e)[1];
|
||||||
|
$e = explode("-", $e)[0];
|
||||||
|
error_log('Range:'.$head['Content-Range'].' end:'.$e.' total:'.$t);
|
||||||
|
//if ($e+1==$t)
|
||||||
|
//error_log('Header2usr:'.json_encode($head,JSON_PRETTY_PRINT));
|
||||||
return output( $response['body'], $response['stat'], $head, true );
|
return output( $response['body'], $response['stat'], $head, true );
|
||||||
} else return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]);
|
} else return output('', 302, [ 'Location' => $files['@microsoft.graph.downloadUrl'] ]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue