From 268cf0cb66876581c2bbae1306a4988920eb930f Mon Sep 17 00:00:00 2001 From: everflux Date: Sun, 28 Dec 2014 22:13:11 +0100 Subject: [PATCH] Provide content-length header if response has a body --- flight/net/Response.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flight/net/Response.php b/flight/net/Response.php index 0276846..5e3a998 100644 --- a/flight/net/Response.php +++ b/flight/net/Response.php @@ -191,7 +191,6 @@ class Response { $this->headers['Expires'] = gmdate('D, d M Y H:i:s', $expires) . ' GMT'; $this->headers['Cache-Control'] = 'max-age='.($expires - time()); } - return $this; } @@ -236,6 +235,11 @@ class Response { } } + // Send content length + if( ($length = strlen($this->body)) > 0) { + header("Content-Length: $length"); + } + return $this; }