Req #46703 [Opn->Bgs]: default headers blocks correct http responce
Edit report at http://bugs.php.net/bug.php?id=46703&edit=1
ID: 46703
Updated by: jani@php.net
Reported by: zent at piments dot com
Summary: default headers blocks correct http responce
-Status: Open
+Status: Bogus
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: linux
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
Just set the correct header with header(). No bug here.
Previous Comments:
------------------------------------------------------------------------
[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
Thread (4 messages)