hky

ByteHoard x-sendfile patch

ByteHoard is a PHP-based web storage system, providing a web interface for users to upload, download, share and edit files, all via their browser. Includes thumbnails for images, multiple database support, skinning support, directory support and much more
But it lacks of x-sendfile support. When you use ByteHoard to serve large file and many concurrent user, i’m pretty sure your server will be out of resource immediately. So, why don’t serve those files direct to webserver, It will safe your resource.

This is a patch for ByteHoard 2.1 Epsilon.
Around line 104 on your filelink.php file, change the line :

[php]$fileobj->readfile()[/php]

with :

for Lighttpd 1.4
[php]header("X-LIGHTTPD-send-file: /path/to/upload-data" . $filepath);[/php]

for Lighttpd 1.5 and Apache2 with mod_xsendfile
[php]header("X-Sendfile: /path/to/upload-data" . $filepath);[/php]

for nginx
[php]header("X-Accel-Redirect: /path/to/upload-data" . $filepath);[/php]

Comments

Proudly published with Hexo