Browse files

Not sending a content-length for redirection status codes that are no…

…t supposed to have any content
  • Loading branch information...
1 parent aabfad9 commit 29ca42ed7ae5d0a1dcb257a93fb11b3a8a7c3b8b @lorenzo lorenzo committed Oct 28, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Cake/Network/CakeResponse.php
View
4 lib/Cake/Network/CakeResponse.php
@@ -351,8 +351,8 @@ public function send() {
$this->_sendHeader("{$this->_protocol} {$this->_status} {$codeMessage}");
$this->_sendHeader('Content-Type', "{$this->_contentType}; charset={$this->_charset}");
$shouldSetLength = empty($this->_headers['Content-Length']) && class_exists('Multibyte');
- $shouldSetLength = $shouldSetLength && !$this->outputCompressed();
- if ($shouldSetLength) {
+ $shouldSetLength = $shouldSetLength && !in_array($this->_status, range(301, 307));
+ if ($shouldSetLength && !$this->outputCompressed()) {
$this->_headers['Content-Length'] = mb_strlen($this->_body);
}
foreach ($this->_headers as $header => $value) {

0 comments on commit 29ca42e

Please sign in to comment.