Closed OK93-01-18 closed 3 years ago
Hello! I use your Guzzle-Swoole lib in my local project and found issue when try used proxy. Proxy not working. For fix, I updated code in Yurun\Util\Swoole\Guzzle\SwooleHandler 93:
$yurunRequest = $yurunRequest->withAttribute(Attributes::USE_PROXY, true) ->withAttribute(Attributes::PROXY_TYPE, $scheme) ->withAttribute(Attributes::PROXY_SERVER, $proxyUri->getHost()) ->withAttribute(Attributes::PROXY_PORT, $proxyUri->getPort()) ->withAttribute(Attributes::PROXY_USERNAME, $username) ->withAttribute(Attributes::PROXY_PASSWORD, $password);
in Yurun\Util\YurunHttp\Handler\Swoole 525 replace switch block:
$userName = $request->getAttribute(Attributes::PROXY_USERNAME, null); $password = $request->getAttribute(Attributes::PROXY_PASSWORD, null); switch($type) { case 'http': $settings['http_proxy_host'] = $request->getAttribute(Attributes::PROXY_SERVER); $settings['http_proxy_port'] = $request->getAttribute(Attributes::PROXY_PORT); $userName = $request->getAttribute(Attributes::PROXY_USERNAME, null); $password = $request->getAttribute(Attributes::PROXY_PASSWORD, null); if (!is_null($userName)) { $settings['http_proxy_user'] = $userName; } if (!is_null($password)) { $settings['http_proxy_password'] = $password; } break; case 'socks5': $settings['socks5_host'] = $request->getAttribute(Attributes::PROXY_SERVER); $settings['socks5_port'] = $request->getAttribute(Attributes::PROXY_PORT); if (!is_null($userName)) { $settings['socks5_username'] = $userName; } if (!is_null($password)) { $settings['socks5_password'] = $password; } break; }
Best Regards, Alex
Thank you very much for your feedback. This bug has been fixed in the master branch, you can test it to see if it meets the expectation.
Hello! I use your Guzzle-Swoole lib in my local project and found issue when try used proxy. Proxy not working. For fix, I updated code in Yurun\Util\Swoole\Guzzle\SwooleHandler 93:
in Yurun\Util\YurunHttp\Handler\Swoole 525 replace switch block:
Best Regards, Alex