#26440 [Asn->Csd]: headers not passed in stream context
| From: | iliaa@php.net | Date: | Thu, 27 Nov 2003 23:59:44 +0000 |
| Subject: | #26440 [Asn->Csd]: headers not passed in stream context | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51185@lists.php.net to get a copy of this message | ||
ID: 26440
Updated by: iliaa@php.net
Reported By: steven at pearavenue dot com
-Status: Assigned
+Status: Closed
Bug Type: HTTP related
Operating System: Linux
PHP Version: 4.3.4
Assigned To: pollita
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
The memory leak is not fixed. After the fix the script works as
expected, fopen() fails because the return code is 304 (what you
wanted) and not 200.
Previous Comments:
------------------------------------------------------------------------
[2003-11-27 18:37:32] steven at pearavenue dot com
It fails with HEAD too under the release 4.3.4. Thanks for confirming.
------------------------------------------------------------------------
[2003-11-27 18:11:48] sniper@php.net
PHP_4_3: Reproduced with latest CVS, here's some leaks:
/usr/src/web/php/php4/Zend/zend_hash.c(450) : Freeing 0x086510CC (64
bytes), script=t.php
/usr/src/web/php/php4/Zend/zend_hash.c(416) : Freeing 0x08651074 (35
bytes), script=t.php
Last leak repeated 8 times
/usr/src/web/php/php4/ext/standard/file.c(616) : Freeing 0x086505AC
(44 bytes), script=t.php
/usr/src/web/php/php4/Zend/zend_variables.c(122) : Actual location
(location was relayed)
/usr/src/web/php/php4/ext/standard/file.c(997) : Freeing 0x08650494
(44 bytes), script=t.php
/usr/src/web/php/php4/Zend/zend_API.c(562) : Actual location (location
was relayed)
/usr/src/web/php/php4/ext/standard/http_fopen_wrapper.c(372) : Freeing
0x08650EAC (25 bytes), script=t.php
Last leak repeated 7 times
/usr/src/web/php/php4/ext/standard/http_fopen_wrapper.c(370) : Freeing
0x08650E6C (12 bytes), script=t.php
Last leak repeated 7 times
/usr/src/web/php/php4/ext/standard/http_fopen_wrapper.c(316) : Freeing
0x086502F4 (18 bytes), script=t.php
/usr/src/web/php/php4/ext/standard/http_fopen_wrapper.c(296) : Freeing
0x086502B4 (12 bytes), script=t.php
/usr/src/web/php/php4/Zend/zend_hash.c(188) : Freeing 0x0864DD1C (32
bytes), script=t.php
/usr/src/web/php/php4/ext/standard/file.c(614) : Freeing 0x0864DC9C
(12 bytes), script=t.php
/usr/src/web/php/php4/main/streams.c(2884) : Freeing 0x08652A44 (57
bytes), script=t.php
/usr/src/web/php/php4/Zend/zend_variables.c(111) : Actual location
(location was relayed)
/usr/src/web/php/php4/main/streams.c(2882) : Freeing 0x08652A04 (12
bytes), script=t.php
Seems to work with HEAD, but still some leaks:
/usr/src/web/php/php5/main/streams/streams.c(1694) : Freeing
0x40E49B98 (57 bytes), script=t.php
/usr/src/web/php/php5/Zend/zend_variables.c(137) : Actual location
(location was relayed)
/usr/src/web/php/php5/main/streams/streams.c(1692) : Freeing
0x40E49B54 (16 bytes), script=t.php
=== Total 2 memory leaks detected ===
------------------------------------------------------------------------
[2003-11-27 17:10:36] steven at pearavenue dot com
Of course, I don't mean a 304 "error" - I mean a 304 response
------------------------------------------------------------------------
[2003-11-27 17:03:06] steven at pearavenue dot com
Description:
------------
Context passed to fopen does not appear to include header in request.
Reproduce code:
---------------
$uri = 'http://www.what-it-all-means.com/index.rdf';
$agent = "First-Say-RSS-AGGREGATOR/0.0.2.4 http://www.firstsay.net";
$since = 'Thu, 27 Nov 2003 06:03:08 GMT';
$etag = '"7051a-36a7-3fc5939c"';
$opts = array(
'http' => array(
'method' => "GET",
'header' => "If-None-Match: $etag\r\n".
"If-Modified-Since: $since\r\n",
'user_agent' => $agent
)
);
$context = stream_context_create($opts);
$fp = @fopen($uri, 'rb', false, $context);
if (!is_resource($fp)) {
echo "error";
}
var_dump(stream_context_get_options($fp) );
echo "\n:::::\n";
var_dump ( stream_get_meta_data($fp) );
fclose($fp);
Expected result:
----------------
With the appropriate URL, http-date and etag (you may have to change
those above) this should produce a 304 error
Actual result:
--------------
produces a 200, as though the header is ignored.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26440&edit=1