mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Don't set proxy for Guzzle if proxy config doesn't comtain valid host and port
This commit is contained in:
parent
0c815fc27b
commit
c098b4d055
1 changed files with 4 additions and 1 deletions
|
|
@ -215,7 +215,10 @@ class HTTP
|
|||
$proxy = parse_url($proxy);
|
||||
$proxy_scheme = preg_match('/^(https|socks)/', $proxy['scheme'] ?? '') ? ($proxy['scheme'] . '://') : 'http://';
|
||||
$proxy_auth = (!empty($proxy['user']) && !empty($proxy['pass'])) ? ($proxy['user'] . ':' . $proxy['pass'] . '@') : '';
|
||||
$settings['proxy'] = sprintf('%s%s%s:%s', $proxy_scheme, $proxy_auth, $proxy['host'], $proxy['port']);
|
||||
if (!empty($proxy['host']) && !empty($proxy['port']))
|
||||
{
|
||||
$settings['proxy'] = sprintf('%s%s%s:%s', $proxy_scheme, $proxy_auth, $proxy['host'], $proxy['port']);
|
||||
}
|
||||
}
|
||||
|
||||
self::$_client = new \GuzzleHttp\Client($settings);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue