Skip to content

Commit

Permalink
Merge pull request #816 from gws/configurable-curl-proxy-workaround
Browse files Browse the repository at this point in the history
Make cURL proxy header calculation bug workaround configurable
  • Loading branch information
bshaffer committed Feb 2, 2016
2 parents 358e41c + 553581e commit 400f250
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Google/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public function __construct($ini_file_location = null)
'Google_IO_Abstract' => array(
'request_timeout_seconds' => 100,
),
'Google_IO_Curl' => array(
'disable_proxy_workaround' => false,
'options' => null,
),
'Google_Logger_Abstract' => array(
'level' => 'debug',
'log_format' => "[%datetime%] %level%: %message% %context%\n",
Expand Down
12 changes: 12 additions & 0 deletions src/Google/IO/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class Google_IO_Curl extends Google_IO_Abstract

private $options = array();

/** @var bool $disableProxyWorkaround */
private $disableProxyWorkaround;

public function __construct(Google_Client $client)
{
if (!extension_loaded('curl')) {
Expand All @@ -41,6 +44,11 @@ public function __construct(Google_Client $client)
}

parent::__construct($client);

$this->disableProxyWorkaround = $this->client->getClassConfig(
'Google_IO_Curl',
'disable_proxy_workaround'
);
}

/**
Expand Down Expand Up @@ -175,6 +183,10 @@ public function getTimeout()
*/
protected function needsQuirk()
{
if ($this->disableProxyWorkaround) {
return false;
}

$ver = curl_version();
$versionNum = $ver['version_number'];
return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION;
Expand Down

0 comments on commit 400f250

Please sign in to comment.