With the appropriate config option enabled, Jirafeau will send the
X-Sendfile header instead of sending the file itself. As a result,
Apache/lighttpd will send the file without the intervention of Jirafeau,
and download resumes/seeking will also be enabled for this download.
If the user requested an encrypted file then this will not work, but it
should work in all other cases.
 }
 /* Read file. */
 else {
-    $r = fopen(VAR_FILES . $p . $link['hash'], 'r');
-    while (!feof($r)) {
-        print fread($r, 1024);
+    if ($cfg['use_xsendfile']) {
+        $file_web_path = preg_replace('#^' . $_SERVER['DOCUMENT_ROOT'] . '#', '', VAR_FILES);
+        header('X-Sendfile: ' . $file_web_path . $p . $link['hash']);
+    } else {
+        $r = fopen(VAR_FILES . $p . $link['hash'], 'r');
+        while (!feof($r)) {
+            print fread($r, 1024);
+        }
+        fclose($r);
     }
-    fclose($r);
 }
 
 if ($link['onetime'] == 'O') {
 
  */
 $cfg['litespeed_workaround'] = false;
 
+/* Use the X-Sendfile header which should cause your webserver to handle
+ * the sending of the file. The webserver must be configured to do this
+ * using the mod_xsendfile module in Apache or the appropriate config in
+ * lighttpd. The offload will not happen in the case of server-side encrypted
+ * files, but all other cases should work. Benefits include being able
+ * to resume downloads and seek instantly in media players like VLC or
+ * the Firefox/Discord/Chrome embedded player.
+ */
+$cfg['use_xsendfile'] = false;
+
 /* Store uploader's IP along with 'link' file.
  * Depending of your legislation, you may have to adjust this parameter.
  */