|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3299 Unwanted `Content-Type' header
Submitted: 2000-01-24 13:13 UTC Modified: 2000-05-30 19:22 UTC
From: teo at digiro dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 3 OS: RH6.0
Private report: No CVE-ID: None
 [2000-01-24 13:13 UTC] teo at digiro dot net
<? Header ("HTTP/1.1 204  No Content"); ?>

will fail because PHP will automatically append 
a ``Content-Type: text/html'' which screws up the logics.
(no response body is expected for 204 but `content type'
announce one)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-30 19:22 UTC] stas at cvs dot php dot net
RFC 2616 says 204 can contain no body, but may contain headers.
PHP is in compliance. 
 [2002-10-15 07:15 UTC] vesely at tana dot it
Yes, rfc say that 1xx, 204 and 304 MUST NOT contain
a body, but they don't explicitely say that the
content-type header is allowed in such cases.

RFC 2616 in section 14.17 says

"The Content-Type entity-header field indicates the
"media type of the entity-body sent to the recipient
"or, in the case of the HEAD method, the media type
"that would have been sent had the request been a GET.

No mention of a "default content-type" for the body
that would have been sent had the response code been
different. Hence the following is illegal:

HTTP/1.1 204 No Content
Date: Tue, 15 Oct 2002 12:03:34 GMT
Server: Apache/1.3.19
Connection: close
Content-Type: text/html

Furthermore, the "Status:" header may be
misinterpreted by the httpd server, resulting
in output as the one below:

HTTP/1.1 200 OK
Date: Tue, 15 Oct 2002 12:02:40 GMT
Server: Apache/1.3.19
status: 204 No Content
Connection: close
Content-Type: text/html

Please reopen this bug.

Ale Vesely
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 01 21:01:27 2023 UTC