diff --git a/core/lib/Foswiki/Engine/CGI.pm b/core/lib/Foswiki/Engine/CGI.pm index fcf5eb1677..6721d842d7 100644 --- a/core/lib/Foswiki/Engine/CGI.pm +++ b/core/lib/Foswiki/Engine/CGI.pm @@ -176,9 +176,6 @@ sub finalizeHeaders { my ( $this, $res, $req ) = @_; $this->SUPER::finalizeHeaders( $res, $req ); - # make sure we always generate a status for the response - print 'Status: ' . $res->status() - if ( $res->status() && !defined( $res->headers->{status} ) ); my $hdr = $res->printHeaders; print $hdr; } diff --git a/core/lib/Foswiki/Response.pm b/core/lib/Foswiki/Response.pm index db76352b33..0351389a8f 100644 --- a/core/lib/Foswiki/Response.pm +++ b/core/lib/Foswiki/Response.pm @@ -245,9 +245,13 @@ Return a string of all headers, separated by CRLF =cut sub printHeaders { - my ($this) = shift; - my $CRLF = "\x0D\x0A"; - my $hdr = ''; + my ($this) = shift; + my $CRLF = "\x0D\x0A"; + my $hdr = ''; + + # make sure we always generate a status for the response + $this->{headers}->{Status} = $this->status() + if ( $this->status() && !defined( $this->headers->{Status} ) ); foreach my $header ( keys %{ $this->{headers} } ) { $hdr .= $header . ': ' . $_ . $CRLF foreach $this->getHeader($header);