From 403c333a0ec5658ef01b6e55415883f34e2dfc41 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Wed, 20 Nov 2019 22:28:58 -0600 Subject: [PATCH] Don't show duplicate Date headers when running under PHPs server. Fixes #2375 --- system/HTTP/Response.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/HTTP/Response.php b/system/HTTP/Response.php index 80b9366ed620..384d12d0be0a 100644 --- a/system/HTTP/Response.php +++ b/system/HTTP/Response.php @@ -713,7 +713,7 @@ public function sendHeaders() // Per spec, MUST be sent with each request, if possible. // http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html - if (! isset($this->headers['Date'])) + if (! isset($this->headers['Date']) && php_sapi_name() !== 'cli-server') { $this->setDate(\DateTime::createFromFormat('U', (string) time())); } @@ -724,7 +724,7 @@ public function sendHeaders() // Send all of our headers foreach ($this->getHeaders() as $name => $values) { - header($name . ': ' . $this->getHeaderLine($name), false, $this->statusCode); + header($name . ': ' . $this->getHeaderLine($name), true, $this->statusCode); } return $this;