Skip to content

Commit

Permalink
Do not set Content-Length header if debug_profile is set
Browse files Browse the repository at this point in the history
Do not set Content-Length header if debug_profile is set, because $this->body doesn't contain output from Profiler.
Browser will not read more bytes than the Content-Length value and we won't get Profiler debug information.
  • Loading branch information
elvinas-liut committed Feb 2, 2013
1 parent b381e99 commit 626098b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions control/HTTPResponse.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ public function isError() {
public function setBody($body) { public function setBody($body) {
$this->body = $body; $this->body = $body;


// Set content-length in bytes. Use mbstring to avoid problems with mb_internal_encoding() and mbstring.func_overload if (Director::isLive() || !isset($_GET['debug_profile'])) {
$this->headers['Content-Length'] = mb_strlen($this->body,'8bit'); // Set content-length in bytes. Use mbstring to avoid problems with mb_internal_encoding() and mbstring.func_overload
$this->headers['Content-Length'] = mb_strlen($this->body,'8bit');
}
} }


public function getBody() { public function getBody() {
Expand Down

0 comments on commit 626098b

Please sign in to comment.