Bug #64878 [Opn->Ana]: 304 responses return Content-Type header
| From: | cmb@php.net | Date: | Mon, 18 May 2015 19:38:42 +0000 |
| Subject: | Bug #64878 [Opn->Ana]: 304 responses return Content-Type header | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192739@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64878&edit=1
ID: 64878
Updated by: cmb@php.net
Reported by: jdesrosi at gmail dot com
Summary: 304 responses return Content-Type header
-Status: Open
+Status: Analyzed
Type: Bug
Package: Built-in web server
Operating System: Fedora 18
PHP Version: 5.4.15
Block user comment: N
Private report: N
New Comment:
According to RFC 7232 (which obsoletes RFC 2616), section 4.1, the
restrictions on sending a Content-Type header with 304 responses
have been slightly loosened (SHOULD NOT). So the behavior is not
necessarily a bug. However, it still seems reasonable to suppress
the default Content-Type header for 304 responses. I've submitted
a respective PR.
Previous Comments:
------------------------------------------------------------------------
[2013-05-19 19:58:34] jdesrosi at gmail dot com
Description:
------------
I have discovered that the built-in php web server sends a default Content-Type
header (text/html) when responding with HTTP/1.1 304 Not Modified. This clobbers
the Content-Type stored in a cache and violates RFC2616-10.3.5
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5)
"If the conditional GET used a strong cache validator (see section 13.3.3), the
response SHOULD NOT include other entity-headers. Otherwise (i.e., the
conditional GET used a weak validator), the response MUST NOT include other
entity-headers; this prevents inconsistencies between cached entity-bodies and
updated headers."
I have found related tickets related the Apache. This ticket differs only in
that it refers to the built-in web server.
Test script:
---------------
<?php
header('HTTP/1.1 304 Not Modified');
Expected result:
----------------
HTTP/1.1 304 Not Modified
Host: localhost:8001
Connection: close
X-Powered-By: PHP/5.4.14
Actual result:
--------------
HTTP/1.1 304 Not Modified
Host: localhost:8001
Connection: close
X-Powered-By: PHP/5.4.14
Content-type: text/html
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64878&edit=1