Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http Headers set within SoapClient are not interpreted #6263

Closed
tudor2004 opened this issue Sep 16, 2015 · 10 comments
Closed

Http Headers set within SoapClient are not interpreted #6263

tudor2004 opened this issue Sep 16, 2015 · 10 comments

Comments

@tudor2004
Copy link

It seems that http headers set into the stream_context value of the SoapClient $options are not interpreted and send to the remote server. Below are two examples that can be used as test:

<?php
/** Use this as client **/
$options = array(
    'location' => 'http://testing.dev/soap_server.php',
    'uri' => 'http://testing.dev'
);

$httpHeader = 'MY-HEADER: TEST';

$options['stream_context'] = stream_context_create(array('http' => array('header' => $httpHeader)));

$client = new SoapClient(NULL, $options);

try
{
    echo $client->__soapCall('hello', array());
}
catch(Exception $e)
{
    echo $e->getMessage();
}
<?php
/** Use this as server **/

class MyAPI
{
    function hello()
    {
        return var_export(getallheaders(), true);
    }
}

$options=array('uri'=>'http://testing.dev');

$server = new SoapServer(NULL,$options);
$server->setClass('MyAPI');
$server->handle();

Using sudo tcpdump -A -n -s 2024 dst port 80 listen to all outgoing requests. Under PHP the headers all visible and sent, under hhvm the headers are not sent. Currently testing under HHVM 3.9.1

@plentytp
Copy link

I have the same issue, any solutions ?

Best Regards

@sergejM
Copy link

sergejM commented Sep 22, 2015

have the same problem, is this a bug oder setting issue?

HipHop VM 3.9.1 (rel)

Best Regards

@corientdev
Copy link
Contributor

Can anybody hint about how can we get it solved? which file to edit? i am intersted to contribute..

@SiebelsTim
Copy link
Contributor

You can find the SoapClient here (linked to ctor) which uses the context options down here in an HttpClient

@tudor2004
Copy link
Author

Any news on fixing this issue? I'm pretty sure this would help a lot of people.

@aszekely
Copy link

@SiebelsTim i would like to talk to you in private regarding your comment. How can i reach you ?

@SiebelsTim
Copy link
Contributor

IRC: #hhvm @freenode. My nick is Sbls

@SiebelsTim
Copy link
Contributor

I think this is an issue with the HttpClient. The HttpClient is used with context options only is soap (and UrlFile).
The only place the stream_context is used is here

if (m_stream_context_options[s_ssl].isArray()) {
with no regard to the headers field.
The stream_context array definitly is set properly, but I think the httpclient doesn't do much with it (except for ssl).

@SiebelsTim
Copy link
Contributor

Yep, it's that.
Here is WIP fix I will probably not continue. It needs a test, code cleanup (maybe something more sensible than just casting to array and fetching the headers field) and checks that it didn't break anything else (I think this will break something about the responseHeaders handling a few lines above).
https://gist.github.com/SiebelsTim/0094a2f179c2aaf105a0

@aszekely
Copy link

@SiebelsTim Hey Tim! great news and if i'm allowed to say: good job! Let's talk tomorrow. I will be on the channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants