Skip to content

Commit 553581e

Browse files
committed
Make cURL proxy header calculation bug workaround configurable
1 parent 5fe588d commit 553581e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/Google/Config.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public function __construct($ini_file_location = null)
5858
'Google_IO_Abstract' => array(
5959
'request_timeout_seconds' => 100,
6060
),
61+
'Google_IO_Curl' => array(
62+
'disable_proxy_workaround' => false,
63+
'options' => null,
64+
),
6165
'Google_Logger_Abstract' => array(
6266
'level' => 'debug',
6367
'log_format' => "[%datetime%] %level%: %message% %context%\n",

src/Google/IO/Curl.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class Google_IO_Curl extends Google_IO_Abstract
3232

3333
private $options = array();
3434

35+
/** @var bool $disableProxyWorkaround */
36+
private $disableProxyWorkaround;
37+
3538
public function __construct(Google_Client $client)
3639
{
3740
if (!extension_loaded('curl')) {
@@ -41,6 +44,11 @@ public function __construct(Google_Client $client)
4144
}
4245

4346
parent::__construct($client);
47+
48+
$this->disableProxyWorkaround = $this->client->getClassConfig(
49+
'Google_IO_Curl',
50+
'disable_proxy_workaround'
51+
);
4452
}
4553

4654
/**
@@ -175,6 +183,10 @@ public function getTimeout()
175183
*/
176184
protected function needsQuirk()
177185
{
186+
if ($this->disableProxyWorkaround) {
187+
return false;
188+
}
189+
178190
$ver = curl_version();
179191
$versionNum = $ver['version_number'];
180192
return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION;

0 commit comments

Comments
 (0)