@@ -86,15 +86,6 @@ private static function sendHeaders($filename, $name, $zip = false) {
8686 */
8787 public static function get ($ dir , $ files , $ only_header = false ) {
8888 $ view = \OC \Files \Filesystem::getView ();
89- $ xsendfile = false ;
90- if (\OC ::$ server ->getLockingProvider () instanceof NoopLockingProvider) {
91- if (isset ($ _SERVER ['MOD_X_SENDFILE_ENABLED ' ]) ||
92- isset ($ _SERVER ['MOD_X_SENDFILE2_ENABLED ' ]) ||
93- isset ($ _SERVER ['MOD_X_ACCEL_REDIRECT_ENABLED ' ])
94- ) {
95- $ xsendfile = true ;
96- }
97- }
9889
9990 if (is_array ($ files ) && count ($ files ) === 1 ) {
10091 $ files = $ files [0 ];
@@ -129,9 +120,6 @@ public static function get($dir, $files, $only_header = false) {
129120
130121 if ($ get_type === self ::FILE ) {
131122 $ zip = false ;
132- if ($ xsendfile && \OC ::$ server ->getEncryptionManager ()->isEnabled ()) {
133- $ xsendfile = false ;
134- }
135123 } else {
136124 $ zip = new ZipStreamer (false );
137125 }
@@ -176,17 +164,7 @@ public static function get($dir, $files, $only_header = false) {
176164 $ zip ->finalize ();
177165 set_time_limit ($ executionTime );
178166 } else {
179- if ($ xsendfile ) {
180- /** @var $storage \OC\Files\Storage\Storage */
181- list ($ storage ) = $ view ->resolvePath ($ filename );
182- if ($ storage ->isLocal ()) {
183- self ::addSendfileHeader ($ filename );
184- } else {
185- \OC \Files \Filesystem::readfile ($ filename );
186- }
187- } else {
188- \OC \Files \Filesystem::readfile ($ filename );
189- }
167+ \OC \Files \Filesystem::readfile ($ filename );
190168 }
191169 if ($ get_type === self ::FILE ) {
192170 $ view ->unlockFile ($ filename , ILockingProvider::LOCK_SHARED );
@@ -202,40 +180,6 @@ public static function get($dir, $files, $only_header = false) {
202180 }
203181 }
204182
205- /**
206- * @param false|string $filename
207- */
208- private static function addSendfileHeader ($ filename ) {
209- if (isset ($ _SERVER ['MOD_X_SENDFILE_ENABLED ' ])) {
210- $ filename = \OC \Files \Filesystem::getLocalFile ($ filename );
211- header ("X-Sendfile: " . $ filename );
212- }
213- if (isset ($ _SERVER ['MOD_X_SENDFILE2_ENABLED ' ])) {
214- $ filename = \OC \Files \Filesystem::getLocalFile ($ filename );
215- if (isset ($ _SERVER ['HTTP_RANGE ' ]) &&
216- preg_match ("/^bytes=([0-9]+)-([0-9]*)$/ " , $ _SERVER ['HTTP_RANGE ' ], $ range )) {
217- $ filelength = filesize ($ filename );
218- if ($ range [2 ] === "" ) {
219- $ range [2 ] = $ filelength - 1 ;
220- }
221- header ("Content-Range: bytes $ range [1 ]- $ range [2 ]/ " . $ filelength );
222- header ("HTTP/1.1 206 Partial content " );
223- header ("X-Sendfile2: " . str_replace (", " , "%2c " , rawurlencode ($ filename )) . " $ range [1 ]- $ range [2 ]" );
224- } else {
225- header ("X-Sendfile: " . $ filename );
226- }
227- }
228-
229- if (isset ($ _SERVER ['MOD_X_ACCEL_REDIRECT_ENABLED ' ])) {
230- if (isset ($ _SERVER ['MOD_X_ACCEL_REDIRECT_PREFIX ' ])) {
231- $ filename = $ _SERVER ['MOD_X_ACCEL_REDIRECT_PREFIX ' ] . \OC \Files \Filesystem::getLocalFile ($ filename );
232- } else {
233- $ filename = \OC ::$ WEBROOT . '/data ' . \OC \Files \Filesystem::getRoot () . $ filename ;
234- }
235- header ("X-Accel-Redirect: " . $ filename );
236- }
237- }
238-
239183 /**
240184 * @param string $dir
241185 * @param ZipStreamer $zip
0 commit comments