Merge branch 'Ragazzo-partial-response-enh'

* Ragazzo-partial-response-enh:
  refactored web/Response::sendFile()
  Display Name of HttpException instead of classname
  string helper fixed, mime-type reverted
  code style fix
  partial response added, new code-style applied
This commit is contained in:
Carsten Brandt
2013-05-15 20:42:25 +02:00
3 changed files with 150 additions and 10 deletions

View File

@@ -75,8 +75,11 @@ class ErrorHandler extends Component
\Yii::$app->runAction($this->errorAction);
} elseif (\Yii::$app instanceof \yii\web\Application) {
if (!headers_sent()) {
$errorCode = $exception instanceof HttpException ? $exception->statusCode : 500;
header("HTTP/1.0 $errorCode " . get_class($exception));
if ($exception instanceof HttpException) {
header('HTTP/1.0 ' . $exception->statusCode . ' ' . $exception->getName());
} else {
header('HTTP/1.0 500 ' . get_class($exception));
}
}
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') {
\Yii::$app->renderException($exception);