#45092 [Opn]: header HTTP context option not being used
| From: | nweibley at gmail dot com | Date: | Mon, 26 May 2008 15:27:38 +0000 |
| Subject: | #45092 [Opn]: header HTTP context option not being used | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125261@lists.php.net to get a copy of this message | ||
ID: 45092
User updated by: nweibley at gmail dot com
Reported By: nweibley at gmail dot com
Status: Open
Bug Type: HTTP related
Operating System: Linux (Gentoo)
PHP Version: 5.2.6
New Comment:
Since line 324 of ext/curl/streams.c reads:
if (SUCCESS == php_stream_context_get_option(context, "http", "header",
&ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_ARRAY) {
I have changed my code to reflect passing an array as the value of
'header' in the context options. The problem still persists, however.
Previous Comments:
------------------------------------------------------------------------
[2008-05-26 15:16:09] nweibley at gmail dot com
Description:
------------
Pretty simple; I'm trying to create a stream context which will send
custom headers along with a simple HTTP GET request. It wasn't working
so I created a second debug script to see what was up and found that PHP
simply isn't including any of my custom headers.
This *is not* a duplicate of bug #41051, I have tried that as well.
Reproduce code:
---------------
<?php
//send.php
$params = array('http' => array('method' =>
'GET','header' => "Custom:
woot"));
$ctx = stream_context_create($params);
$fp = fopen('http://localhost/recv.php', 'r', false,
$ctx);
print_r(stream_context_get_options($ctx));
print_r(stream_get_meta_data($fp));
echo stream_get_contents($fp);
?>
<?php
//recv.php
print_r(apache_request_headers());
?>
Expected result:
----------------
Array
(
[http] => Array
(
[method] => GET
[header] => Custom: woot
)
)
Array
(
[wrapper_data] => Array
(
[headers] => Array
(
)
[readbuf] => Resource id #4
)
[wrapper_type] => cURL
[stream_type] => cURL
[mode] => r
[unread_bytes] => 0
[seekable] =>
[uri] => http://localhost/404.php
[timed_out] =>
[blocked] => 1
[eof] =>
)
Array
(
[User-Agent] => PHP/5.2.6-pl1-gentoo
[Host] => localhost
[Accept] => */*
[Custom] => woot
)
Actual result:
--------------
Array
(
[http] => Array
(
[method] => GET
[header] => Custom: woot
)
)
Array
(
[wrapper_data] => Array
(
[headers] => Array
(
)
[readbuf] => Resource id #4
)
[wrapper_type] => cURL
[stream_type] => cURL
[mode] => r
[unread_bytes] => 0
[seekable] =>
[uri] => http://localhost/recv.php
[timed_out] =>
[blocked] => 1
[eof] =>
)
Array
(
[User-Agent] => PHP/5.2.6-pl1-gentoo
[Host] => localhost
[Accept] => */*
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45092&edit=1