Skip to content

Commit a976069

Browse files
authored
Merge pull request #2422 from codeigniter4/dupheaders
Don't show duplicate Date headers when running under PHPs server. Fixes #2375
2 parents 0595045 + 403c333 commit a976069

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

system/HTTP/Response.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ public function sendHeaders()
713713

714714
// Per spec, MUST be sent with each request, if possible.
715715
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
716-
if (! isset($this->headers['Date']))
716+
if (! isset($this->headers['Date']) && php_sapi_name() !== 'cli-server')
717717
{
718718
$this->setDate(\DateTime::createFromFormat('U', (string) time()));
719719
}
@@ -724,7 +724,7 @@ public function sendHeaders()
724724
// Send all of our headers
725725
foreach ($this->getHeaders() as $name => $values)
726726
{
727-
header($name . ': ' . $this->getHeaderLine($name), false, $this->statusCode);
727+
header($name . ': ' . $this->getHeaderLine($name), true, $this->statusCode);
728728
}
729729

730730
return $this;

0 commit comments

Comments
 (0)