mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
Added support for cURL proxy configuration to PHP client
This commit is contained in:
parent
4a1ef9dec9
commit
e82f3c53b4
@ -166,6 +166,22 @@ class ApiClient
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
|
||||
if ($this->config->getCurlProxyHost()) {
|
||||
curl_setopt($curl, CURLOPT_PROXY, $this->config->getCurlProxyHost());
|
||||
}
|
||||
|
||||
if ($this->config->getCurlProxyPort()) {
|
||||
curl_setopt($curl, CURLOPT_PROXYPORT, $this->config->getCurlProxyPort());
|
||||
}
|
||||
|
||||
if ($this->config->getCurlProxyType()) {
|
||||
curl_setopt($curl, CURLOPT_PROXYTYPE, $this->config->getCurlProxyType());
|
||||
}
|
||||
|
||||
if ($this->config->getCurlProxyUser()) {
|
||||
curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->config->getCurlProxyUser() . ':' .$this->config->getCurlProxyPassword());
|
||||
}
|
||||
|
||||
if (!empty($queryParams)) {
|
||||
$url = ($url . '?' . http_build_query($queryParams));
|
||||
}
|
||||
|
@ -126,6 +126,42 @@ class Configuration
|
||||
*/
|
||||
protected $sslVerification = true;
|
||||
|
||||
/**
|
||||
* Curl proxy host
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $proxyHost;
|
||||
|
||||
/**
|
||||
* Curl proxy port
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $proxyPort;
|
||||
|
||||
/**
|
||||
* Curl proxy type, e.g. CURLPROXY_HTTP or CURLPROXY_SOCKS5
|
||||
*
|
||||
* @see https://secure.php.net/manual/en/function.curl-setopt.php
|
||||
* @var integer
|
||||
*/
|
||||
protected $proxyType;
|
||||
|
||||
/**
|
||||
* Curl proxy username
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $proxyUser;
|
||||
|
||||
/**
|
||||
* Curl proxy password
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $proxyPassword;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -372,6 +408,121 @@ class Configuration
|
||||
return $this->curlTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy Host
|
||||
*
|
||||
* @param string $proxyHost HTTP Proxy URL
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyHost($proxyHost)
|
||||
{
|
||||
$this->proxyHost = $proxyHost;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy Host
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurlProxyHost()
|
||||
{
|
||||
return $this->proxyHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy Port
|
||||
*
|
||||
* @param integer $proxyPort HTTP Proxy Port
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyPort($proxyPort)
|
||||
{
|
||||
$this->proxyPort = $proxyPort;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy Port
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCurlProxyPort()
|
||||
{
|
||||
return $this->proxyPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy Type
|
||||
*
|
||||
* @param integer $proxyType HTTP Proxy Type
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyType($proxyType)
|
||||
{
|
||||
$this->proxyType = $proxyType;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy Type
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCurlProxyType()
|
||||
{
|
||||
return $this->proxyType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy User
|
||||
*
|
||||
* @param string $proxyUser HTTP Proxy User
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyUser($proxyUser)
|
||||
{
|
||||
$this->proxyUser = $proxyUser;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy User
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurlProxyUser()
|
||||
{
|
||||
return $this->proxyUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy Password
|
||||
*
|
||||
* @param string $proxyPassword HTTP Proxy Password
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyPassword($proxyPassword)
|
||||
{
|
||||
$this->proxyPassword = $proxyPassword;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy Password
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurlProxyPassword()
|
||||
{
|
||||
return $this->proxyPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets debug flag
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user