OSDN Git Service

BugTrack/2102 Disable output buffering on sending an file
authorumorigu <umorigu@gmail.com>
Tue, 22 Aug 2017 21:02:56 +0000 (06:02 +0900)
committerumorigu <umorigu@gmail.com>
Sat, 26 Aug 2017 21:37:12 +0000 (06:37 +0900)
plugin/attach.inc.php
plugin/dump.inc.php
plugin/ref.inc.php

index 4699d81..d0ccb43 100644 (file)
@@ -2,7 +2,7 @@
 // PukiWiki - Yet another WikiWikiWeb clone
 // attach.inc.php
 // Copyright
-//   2003-2016 PukiWiki Development Team
+//   2003-2017 PukiWiki Development Team
 //   2002-2003 PANDA <panda@arino.jp> http://home.arino.jp/
 //   2002      Y.MASUI <masui@hisec.co.jp> http://masui.net/pukiwiki/
 //   2001-2002 Originally written by yu-ji
@@ -746,7 +746,11 @@ EOD;
                        . '"; filename*=utf-8\'\'' . rawurlencode($utf8filename));
                header('Content-Length: ' . $this->size);
                header('Content-Type: '   . $this->type);
-
+               // Disable output bufferring
+               while (ob_get_level()) {
+                       ob_end_flush();
+               }
+               flush();
                @readfile($this->filename);
                exit;
        }
index b9ecdec..7f637d7 100644 (file)
@@ -2,7 +2,7 @@
 // PukiWiki - Yet another WikiWikiWeb clone
 // dump.inc.php
 // Copyright
-//   2004-2016 PukiWiki Development Team
+//   2004-2017 PukiWiki Development Team
 //   2004      teanan / Interfair Laboratory
 // License: GPL v2 or (at your option) any later version
 //
@@ -204,6 +204,11 @@ function download_tarfile($tempnam, $arc_kind)
        header('Content-Length: ' . $size);
        header('Content-Type: application/octet-stream');
        header('Pragma: no-cache');
+       // Disable output bufferring
+       while (ob_get_level()) {
+               ob_end_flush();
+       }
+       flush();
        @readfile($tempnam);
 }
 
index f6ec8b5..cb1996a 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone
-// $Id: ref.inc.php,v 1.51 2011/01/25 15:01:01 henoheno Exp $
-// Copyright (C)
-//   2002-2006 PukiWiki Developers Team
+// ref.inc.php
+// Copyright
+//   2002-2017 PukiWiki Development Team
 //   2001-2002 Originally written by yu-ji
 // License: GPL v2 or (at your option) any later version
 //
@@ -430,6 +430,11 @@ function plugin_ref_action()
                .'"; filename*=utf-8\'\'' . rawurlencode($utf8filename));
        header('Content-Length: ' . $size);
        header('Content-Type: '   . $type);
+       // Disable output bufferring
+       while (ob_get_level()) {
+               ob_end_flush();
+       }
+       flush();
        @readfile($ref);
        exit;
 }