Permalink
Browse files

Do not set Content-Length header if debug_profile is set

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...
1 parent b381e99 commit 626098bb70e61ceba953124333cf4158355c6f7d @uniun uniun committed Feb 2, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 control/HTTPResponse.php
View
@@ -151,8 +151,10 @@ public function isError() {
public function setBody($body) {
$this->body = $body;
- // 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');
+ if (Director::isLive() || !isset($_GET['debug_profile'])) {
+ // 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() {

0 comments on commit 626098b

Please sign in to comment.