#45092 [NEW]: header HTTP context option not being used
| From: | nweibley at gmail dot com | Date: | Mon, 26 May 2008 15:16:09 +0000 |
| Subject: | #45092 [NEW]: header HTTP context option not being used | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-125259@lists.php.net to get a copy of this message | ||
From: nweibley at gmail dot com
Operating system: Linux (Gentoo)
PHP version: 5.2.6
PHP Bug Type: HTTP related
Bug description: header HTTP context option not being used
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 bug report at http://bugs.php.net/?id=45092&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45092&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45092&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45092&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45092&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45092&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45092&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45092&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45092&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45092&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45092&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45092&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45092&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45092&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45092&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45092&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45092&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45092&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45092&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45092&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45092&r=mysqlcfg