satishsoni1 / clients-oriented-ftp

Automatically exported from code.google.com/p/clients-oriented-ftp
0 stars 0 forks source link

Implement mod_xsendfile for downloads. #383

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Just wanted to share this.  Update 514 is nice!
I have mod_xsendfile running on my Apache server and wanted to implement it 
with PS.  
(Be sure to configure xsendfile correctly in your .conf for apache server... 
set the path to your PS/upload/files folder)  

I believe its working good... files get downloaded and the downloads are 
resumable, however I can't actually see the headers being sent via any 
developer tools for the file.

In file process.php add the following

Line 7
// STOP COMPRESSION   
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);

Line 132 (after adding at Line 7)
// DON'T NEED ALL THIS FOR X_SENDFILE SO COMMENT EXISTING CODE
/*            while (ob_get_level()) ob_end_clean();
              header('Content-Type: application/octet-stream');
              header('Content-Disposition: attachment; filename='.basename($this->real_file));
              header('Expires: 0');
              header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
              header('Pragma: public');
              header('Cache-Control: private',false);
              header('Content-Length: ' . get_real_size($this->real_file));
              header('Connection: close');
              readfile($this->real_file);
              exit; 
*/
// ADD FOR X_SENDFILE
              $path = ($this->real_file);
              header("X-Sendfile: $path");
              header("Content-Type: application/octet-stream");
              header("Content-Disposition: attachment; filename=\"".basename($this->real_file)."\"");
              exit;
// END X_SENDFILE ADDITION

Original issue reported on code.google.com by jerome.c...@gmail.com on 31 Oct 2013 at 3:46