Skip to content

Commit

Permalink
https://github.com/WWBN/AVideo/issues/5287
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielnetoDotCom committed Jun 10, 2021
1 parent de8a58a commit 8b82d76
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Options All -Indexes
RewriteRule ^videos/([A-Za-z0-9-_.]+(/[A-Za-z0-9-_.]+)?([^!#$&'()*+,:;=?@[\]]+(\.(m3u8\.mp4)))) xsendfile.php?playHLSasMP4=1&file=$1 [QSA]
RewriteRule ^videos/([A-Za-z0-9-_.]+(/[A-Za-z0-9-_.]+)?([^!#$&'()*+,:;=?@[\]]+(\.(mp4|webm|m3u8|mp3|ogg)))) xsendfile.php?file=$1 [QSA]
RewriteRule ^videos/([A-Za-z0-9-_.]+/[A-Za-z0-9-_.].key)$ xsendfile.php?file=$1 [QSA]
RewriteRule ^test$ xsendfile.php?test=1 [QSA]
</IfModule>
</IfModule>
<IfModule mod_deflate.c>
Expand Down
18 changes: 16 additions & 2 deletions xsendfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
require_once './functions.php';
session_write_close();

if ($_GET['test']) {
$path = getcwd().'/xtest.txt';
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename=successtest.txt');
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header("X-Sendfile: {$path}");
header('Content-Length: ' . filesize($path));
exit;
}

if (empty($_GET['file'])) {
error_log("XSENDFILE GET file not found ");
die('GET file not found');
Expand Down Expand Up @@ -78,13 +92,13 @@
header('Pragma: public');
} else if (!empty($_GET['playHLSasMP4'])) {
playHLSasMP4($path);
}
}
header("X-Sendfile: {$path}");
if (empty($_GET['download'])) {
header("Content-type: " . mime_content_type($path));
}
header('Content-Length: ' . filesize($path));
die();
}else {
} else {
error_log("XSENDFILE ERROR: Not exists {$path} = " . json_encode($path_parts));
}
1 change: 1 addition & 0 deletions xtest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Your XSend File is working

0 comments on commit 8b82d76

Please sign in to comment.