Bug #70189 [Opn->Ver]: CLI server sends empty Content-Type when default_mimetype=''
| From: | cmb@php.net | Date: | Mon, 03 Aug 2015 14:47:46 +0000 |
| Subject: | Bug #70189 [Opn->Ver]: CLI server sends empty Content-Type when default_mimetype='' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194943@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: cmb@php.net
Reported by: bugs dot php dot net at majkl578 dot cz
Summary: CLI server sends empty Content-Type when
default_mimetype=''
-Status: Open
+Status: Verified
Type: Bug
-Package: Built-in web server
+Package: *Web Server problem
-Operating System: Linux
+Operating System: *
PHP Version: 7.0.0beta2
Block user comment: N
Private report: N
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[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