Update common.php
This commit is contained in:
parent
ec74945e71
commit
998e97aa99
|
@ -240,7 +240,7 @@ function curl_request($url, $data = false, $headers = [])
|
||||||
list($response['header'], $response['body']) = explode("\r\n\r\n", curl_exec($ch));
|
list($response['header'], $response['body']) = explode("\r\n\r\n", curl_exec($ch));
|
||||||
$response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
$response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
error_log($response['header']);
|
//error_log($response['header']);
|
||||||
if ($response['stat']==0) return curl_request($url, $data, $headers);
|
if ($response['stat']==0) return curl_request($url, $data, $headers);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
@ -623,12 +623,17 @@ function main($path)
|
||||||
if (getConfig('proxydownload')) {
|
if (getConfig('proxydownload')) {
|
||||||
$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-1048575' ];
|
else $header = [ 'Range' => 'Range: bytes=0-102399' ];//1048575
|
||||||
|
error_log('Header2MS:'.$header);
|
||||||
$response = curl_request( $files['@microsoft.graph.downloadUrl'], '', $header );
|
$response = curl_request( $files['@microsoft.graph.downloadUrl'], '', $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]!='') $head[$a[0]] = $a[1];
|
||||||
}
|
}
|
||||||
|
//Content-Length: 387780
|
||||||
|
//Content-Range: bytes 0-387779/387780
|
||||||
|
// $head['Content-Range']
|
||||||
|
error_log('Header2usr:'.$head);
|
||||||
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