Bug #70189 [Com]: CLI server sends empty Content-Type when default_mimetype=''

From: Date: Sat, 19 Sep 2015 18:25:50 +0000
Subject: Bug #70189 [Com]: CLI server sends empty Content-Type when default_mimetype=''
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196090@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 Comment by: j dot tvr at centrum dot cz Reported by: bugs dot php dot net at majkl578 dot cz Summary: CLI server sends empty Content-Type when default_mimetype='' Status: Verified Type: Bug Package: *Web Server problem Operating System: * PHP Version: 7.0.0beta2 Block user comment: N Private report: N New Comment: This issue is still valid with PHP 7.0.0-RC3. This fix should be very simple and straightforward, could someone look into it? Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#196090) next »