Skip to content
Browse files

API Remove content-length setting in HTTPResponse

It's not reliable. Started in c69381c, but only partially reverted.
  • Loading branch information...
1 parent 7c0240c commit e6fffb9ef910979eeef3a881744ecae8480bd164 @chillu chillu committed Feb 27, 2013
Showing with 0 additions and 21 deletions.
  1. +0 −4 control/HTTPResponse.php
  2. +0 −17 tests/control/HTTPResponseTest.php
View
4 control/HTTPResponse.php
@@ -150,10 +150,6 @@ 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');
}
public function getBody() {
View
17 tests/control/HTTPResponseTest.php
@@ -13,21 +13,4 @@ public function testStatusDescriptionStripsNewlines() {
);
}
- public function testContentLengthHeader() {
- $r = new SS_HTTPResponse('123ü');
- $this->assertNotNull($r->getHeader('Content-Length'), 'Content-length header is added');
- $this->assertEquals(
- 5,
- $r->getHeader('Content-Length'),
- 'Header matches actual content length in bytes'
- );
-
- $r->setBody('1234ü');
- $this->assertEquals(
- 6,
- $r->getHeader('Content-Length'),
- 'Header is updated when body is changed'
- );
- }
-
}

0 comments on commit e6fffb9

Please sign in to comment.
Something went wrong with that request. Please try again.