Req #46703 [Bgs]: default headers blocks correct http responce
| From: | zent at piments dot com | Date: | Sat, 09 Apr 2011 05:52:34 +0000 |
| Subject: | Req #46703 [Bgs]: default headers blocks correct http responce | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160056@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=46703&edit=1
ID: 46703
User updated by: zent at piments dot com
Reported by: zent at piments dot com
Summary: default headers blocks correct http responce
Status: Bogus
Type: Feature/Change Request
Package: *General Issues
Operating System: linux
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
using an extra step : using header() as you suggest is a workaround and
does not make the bug "bogus".
As I said in the bug report, not sending a header is legit according to
the spec and would produce correct results but for this BUG inserting
*incorrect* headers without being asked.
Sorry that's a bug. Your suggested solution is a workaround for that
bug.
Previous Comments:
------------------------------------------------------------------------
[2011-04-08 20:50:58] jani@php.net
Just set the correct header with header(). No bug here.
------------------------------------------------------------------------
[2008-11-27 23:47:52] zent at piments dot com
Description:
------------
if no call is made to header() , php inserts Content-Type: text/html
this may well be incorrect, as for example in creating image/png
HTTP spec allows sending content without a content-type header and
allows the client to detect type from the data, in this case first four
bytes are %PNG
However, this content sniffing is allowed "if and only if" there are no
headers explicitly present.
Thus in adding a default text (or other inappropriate default) header
php is preventing the client from correctly displaying the data.
Reproduce code:
---------------
<?php
$i=imagecreate(....);
imagepng($i);
imagedestroy($i);
?>
Expected result:
----------------
data served without content-type header and correctly interpreted by
client sniffing content as defined in spec.
Actual result:
--------------
incorrect insertion of erroneous header forces image data to be
displayed as text.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=46703&edit=1