CodeDredd/laravel-soap

Proxy settings do not reach Guzzle

molbal opened this issue · 2 comments

Reproduction

Setting the proxy settings using

$soap = Soap::baseWsdl($wsdl)->withOptions([
                    'proxy_host' =>'...',
                    'proxy_port' => '..',
                    'proxy_login' => "",
                    'proxy_password' => "",
                ]);

and then making a call with

$soap->Call('Ping', []);

does not use the proxy.

If I manually edit the GuzzleHttp\Handler\CurlHandler class to burn in the proxy, then the proxy server is used. (Obv., this workaround is not suitable outside dev env)

    public function __invoke(RequestInterface $request, array $options): PromiseInterface
    {
        if (isset($options['delay'])) {
            \usleep($options['delay'] * 1000);
        }

        // Dirty dirty hack!!!!
        $options['proxy'] = config('soap.proxy');

        $easy = $this->factory->create($request, $options);
        \curl_exec($easy->handle);
        $easy->errno = \curl_errno($easy->handle);

        return CurlFactory::finish($this, $easy, $this->factory);
    }

Expected behavior

The library directly tries to call the SOAP host, though the proxy server.

Actual behavior

The library directly tries to call the SOAP host, without using the proxy server.

Additional information

image

Thank you for your assistance

Which version are you using? If your using the new one you need to use withGuzzleClientOptions to pass options to guzzle

I missed that, it works that way. Thanks