mirror of
https://github.com/anikeen-com/yaac.git
synced 2026-03-13 13:46:10 +00:00
set curl_interface based on source ip only
This commit is contained in:
@@ -368,14 +368,15 @@ class Client
|
|||||||
protected function getHttpClient()
|
protected function getHttpClient()
|
||||||
{
|
{
|
||||||
if ($this->httpClient === null) {
|
if ($this->httpClient === null) {
|
||||||
$this->httpClient = new HttpClient([
|
$config = [
|
||||||
'base_uri' => (
|
'base_uri' => (
|
||||||
($this->getOption('mode', self::MODE_LIVE) == self::MODE_LIVE) ?
|
($this->getOption('mode', self::MODE_LIVE) == self::MODE_LIVE) ?
|
||||||
self::DIRECTORY_LIVE : self::DIRECTORY_STAGING),
|
self::DIRECTORY_LIVE : self::DIRECTORY_STAGING),
|
||||||
'curl.options' => [
|
];
|
||||||
'CURLOPT_INTERFACE' => $this->getOption('source_ip', '0.0.0.0')
|
if ($this->getOption('source_ip', false) !== false) {
|
||||||
]
|
$config['curl.options']['CURLOPT_INTERFACE'] = $this->getOption('source_ip');
|
||||||
]);
|
}
|
||||||
|
$this->httpClient = new HttpClient($config);
|
||||||
}
|
}
|
||||||
return $this->httpClient;
|
return $this->httpClient;
|
||||||
}
|
}
|
||||||
@@ -536,9 +537,9 @@ class Client
|
|||||||
$userDirectory = preg_replace('/[^a-z0-9]+/', '-', strtolower($this->getOption('username')));
|
$userDirectory = preg_replace('/[^a-z0-9]+/', '-', strtolower($this->getOption('username')));
|
||||||
|
|
||||||
return $this->getOption(
|
return $this->getOption(
|
||||||
'basePath',
|
'basePath',
|
||||||
'le'
|
'le'
|
||||||
) . DIRECTORY_SEPARATOR . $userDirectory . ($path === null ? '' : DIRECTORY_SEPARATOR . $path);
|
) . DIRECTORY_SEPARATOR . $userDirectory . ($path === null ? '' : DIRECTORY_SEPARATOR . $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user