# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. --- includes/file.inc +++ includes/file.inc @@ -555,8 +555,17 @@ drupal_set_header($header); } - $source = file_create_path($source); + //$source = file_create_path($source); + $handler = variable_get('file_transfer_handler', 'file_transfer_default'); + call_user_func($handler, file_create_path($source)); + exit(); +} +/** + * + * @param $source File to transfer. + */ +function file_transfer_default($source){ // Transfer file in 1024 byte chunks to save memory usage. if ($fd = fopen($source, 'rb')) { while (!feof($fd)) { @@ -567,10 +576,21 @@ else { drupal_not_found(); } - exit(); } + /** + * + * @param $source File to transfer. + */ +function file_transfer_xsendfile($source) { + // Let the web server do the heavy lifting. + // TODO : add file path validation + header('X-Sendfile: '.variable_get('path_to_drupal_root', '').$source); + } + + +/** * Call modules that implement hook_file_download() to find out if a file is * accessible and what headers it should be transferred with. If a module * returns -1 drupal_access_denied() will be returned. If one or more modules