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

From: Date: Fri, 11 Mar 2016 10:42:04 +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-199753@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:         jakub at zalas dot pl
 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:

Confirmed this is also an issue on PHP 5.5.30.


Previous Comments:
------------------------------------------------------------------------
[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


Thread (6 messages)

« previous php.bugs (#199753) next »