![]() |
|
1
8th October 16:32
External User
Posts: 1
|
ID: 41051
Updated by: tony2001@php.net Reported By: chris dot vigelius at gmx dot net -Status: Open +Status: Feedback Bug Type: Streams related Operating System: Linux (Ubuntu Edgy) PHP Version: 5.2.1 New Comment: Please disable --curl-wrappers and try again. Previous Comments: ------------------------------------------------------------------------ [2007-04-11 12:36:07] chris dot vigelius at gmx dot net Note: my php was compiled with '--with-curl' '--with-curlwrappers', if that matters. ------------------------------------------------------------------------ [2007-04-11 12:28:14] chris dot vigelius at gmx dot net Description: ------------ the http wrapper ignores 'header' option in stream_create_context( ) if the value is not given as a simple array; neither a string nor a map (e.g. array('X-My-Header' => 'test')) will cause the additional headers to be sent. Reproduce code: --------------- // given as string, the header will not be sent $url = 'http://protectedstuff.com'; $auth = base64_encode('user assword');$header = "Authorization: Basic $auth"; $opts = array( 'http' => array ('method'=>'GET', 'header'=>$header)); $ctx = stream_context_create($opts); file_get_contents($url,false,$ctx); // only if $header is an array, it will be sent $url = 'http://protectedstuff.com'; $auth = base64_encode('user assword');$header = array("Authorization: Basic $auth"); $opts = array( 'http' => array ('method'=>'GET', 'header'=>$header)); $ctx = stream_context_create($opts); file_get_contents($url,false,$ctx); Expected result: ---------------- // In BOTH cases, one would expect the following headers to be sent // with the request GET / HTTP/1.1 User-Agent: PHP/5.2.1 Host: protectedstuff.com Pragma: no-cache Accept: */* Authorization: Basic dXNlcjpwYXNzd29yZA= Actual result: -------------- // The first request is sent with the following headers instead GET / HTTP/1.1 User-Agent: PHP/5.2.1 Host: protectedstuff.com Pragma: no-cache Accept: */* (note that there is no 'Authorization:' header) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41051&edit=1 |
|
|
SPONSORED LINKS BY GOOGLE |
|
|