Beispiel #1
0
 /**
  * Sets the content length header (with possible workarounds)
  * @param string|int|float $length Length to be sent
  */
 public static function setContentLengthHeader($length)
 {
     if (PHP_INT_SIZE === 4) {
         if ($length > PHP_INT_MAX && stripos(PHP_SAPI, 'apache') === 0) {
             // Apache PHP SAPI casts Content-Length headers to PHP integers.
             // This enforces a limit of PHP_INT_MAX (2147483647 on 32-bit
             // platforms). So, if the length is greater than PHP_INT_MAX,
             // we just do not send a Content-Length header to prevent
             // bodies from being received incompletely.
             return;
         }
         // Convert signed integer or float to unsigned base-10 string.
         $lfh = new \OC\LargeFileHelper();
         $length = $lfh->formatUnsignedInteger($length);
     }
     header('Content-Length: ' . $length);
 }
Beispiel #2
0
	public function filesize($path) {
		if ($this->is_dir($path)) {
			return 0;
		}
		$fullPath = $this->getSourcePath($path);
		if (PHP_INT_SIZE === 4) {
			$helper = new \OC\LargeFileHelper;
			return $helper->getFilesize($fullPath);
		}
		return filesize($fullPath);
	}