Bug #70189 [Ver->Csd]: CLI server sends empty Content-Type when default_mimetype=''
| From: | krakjoe@php.net | Date: | Sun, 27 Mar 2016 05:51:14 +0000 |
| Subject: | Bug #70189 [Ver->Csd]: CLI server sends empty Content-Type when default_mimetype='' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200142@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70189&edit=1
ID: 70189
Updated by: krakjoe@php.net
Reported by: bugs dot php dot net at majkl578 dot cz
Summary: CLI server sends empty Content-Type when
default_mimetype=''
-Status: Verified
+Status: Closed
Type: Bug
Package: *Web Server problem
Operating System: *
PHP Version: 7.0.0beta2
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=28f66763a436066d51b21dcf9d6ac3f5a0b33df7
Log: fix #70189 (SAPI sends empty Content-Type when default_mimetype is empty)
Previous Comments:
------------------------------------------------------------------------
[2016-03-11 10:42:00] jakub at zalas dot pl
Confirmed this is also an issue on PHP 5.5.30.
------------------------------------------------------------------------
[2015-09-19 18:25:48] j dot tvr at centrum dot cz
This issue is still valid with PHP 7.0.0-RC3. This fix should be very simple and straightforward,
could someone look into it?
------------------------------------------------------------------------
[2015-08-03 14:47:45] cmb@php.net
Confirmed for PHP 5.6.11 as well. That appears to be a general
SAPI issue[1]. If get_default_content_type() returns an empty
string, the Content-Type header is send nonetheless, what is wrong
anyway.
RFC 7231 states[2]:
| A sender that generates a message containing a payload body
| SHOULD generate a Content-Type header field in that message
| unless the intended media type of the enclosed representation is
| unknown to the sender.
So yes, not sending any Content-Type header seems to be reasonable
in this case.
[1] <https://github.com/php/php-src/blob/php-7.0.0beta2/main/SAPI.c#L862-L873>
[2] <http://tools.ietf.org/html/rfc7231#section-3.1.1.5>
------------------------------------------------------------------------
[2015-08-03 13:41:46] bugs dot php dot net at majkl578 dot cz
Description:
------------
When the configuration directive default_mimetype is not set (empty), the CLI server sends an empty
Content-Type header, which violates RFC 2616.
FPM, for example, does not send the header at all (expected behavior).
Test script:
---------------
<?php
ini_set('default_mimetype', '');
Expected result:
----------------
$ curl -I http://example.com/test.php
HTTP/1.1 200 OK
Host: example.com
Connection: close
X-Powered-By: PHP/7.0.0beta2
Actual result:
--------------
$ curl -I http://example.com/test.php
HTTP/1.1 200 OK
Host: example.com
Connection: close
X-Powered-By: PHP/7.0.0beta2
Content-type:
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70189&edit=1