Re: Bug in HTTP stream context causes problems in SoapClient/get_sdl()
| From: | Giovanni Giacobbi | Date: | Mon, 26 Jan 2009 01:12:28 +0000 |
| Subject: | Re: Bug in HTTP stream context causes problems in SoapClient/get_sdl() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-42839@lists.php.net to get a copy of this message | ||
On Sun, Jan 25, 2009 at 11:06:51PM +0100, Hannes Magnusson wrote:
>
> > <?php
> > $opts = array('http' => array('method' => "GET",
> > 'header' => "Accept-language: en\r\nConnection: close\r\n"));
> > $context = stream_context_create($opts);
> > stream_context_set_option($context, "http", "protocol_version", 1.1);
> >
> > fpassthru(fopen('http://localhost/ws/catalog?wsdl',
> > 'r', false, $context));
> > ?>
>
> Changing the protocol version is "at your own risk".
> If you want a full real HTTP support, you have to use the pecl/http extension.
>
Please note that the code above is only as proof of concept, because it reproduces what is
*currently doing* php_sdl.c:3193, get_sdl() function.
Actually, after further investigation I found that this bug was introduced with 1.114 by dmitry,
fixing bug #43069.
So, if I understood correctly the situation is the following:
1) HTTP stream context does NOT support chunked encoding, so you don't consider it a bug
2) SoapClient currently uses HTTP stream context forcing HTTP/1.1 thus enabling possible chunked
encoding result
3) #43069 should then be reopened waiting for a different solution.
3bis) The workaround proposed in the last comment of the bug report works, but as SoapClient is
using an unsupported feature, it should be the other way around: by default 1.0 (as it is in PHP
5.2) and then it can be forced to 1.1 php side.
IMHO the only clean solution I can see is by implementing the chunked encoding to HTTP context.
@William: I'm not sure I understand your reply: Apache#1 (the one running my test code) has
nothing to do in all of this, because PHP is opening a raw socket and communicating on its own with
Apache#2 (the one outputting the wsdl with chunked encoding). Thus PHP has to deal with this by
itself, you cannot consider it a misconfiguration of Apache#2, because it is legitimately using the
HTTP protocol.
--
Giovanni Giacobbi