0011778: webdav download of large files fails with debug log
authorCornelius Weiß <c.weiss@metaways.de>
Mon, 11 Apr 2016 13:22:10 +0000 (15:22 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 11 Apr 2016 17:03:18 +0000 (19:03 +0200)
Change-Id: Iad549cc3c7fbc13638eea259bda06f5f5f3c2e0c
Reviewed-on: http://gerrit.tine20.com/customers/3039
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Server/WebDAV.php

index cdee29f..5f95bdb 100644 (file)
@@ -134,18 +134,24 @@ class Tinebase_Server_WebDAV extends Tinebase_Server_Abstract implements Tinebas
         self::$_server->addPlugin(new Tinebase_WebDav_Plugin_PrincipalSearch());
         self::$_server->addPlugin(new \Sabre\DAV\Browser\Plugin());
         self::$_server->addPlugin(new Tinebase_WebDav_Plugin_SyncToken());
-        
-        if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
+
+        $contentType = self::$_server->httpRequest->getHeader('Content-Type');
+        $logOutput = Tinebase_Core::isLogLevel(Zend_Log::DEBUG) && preg_match('/^text/', $contentType);
+
+        if ($logOutput) {
             ob_start();
         }
         
         self::$_server->exec();
         
-        if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
+        if ($logOutput) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " >>> *DAV response:\n" . ob_get_contents());
             ob_end_flush();
+        } else {
+
+            Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " <<< *DAV response\n -- BINARY DATA --");
         }
-        
+
         Tinebase_Controller::getInstance()->logout($this->_request->getServer('REMOTE_ADDR'));
     }