'members' => true,
'peopletag' => true),
'http' => // HTTP client settings when contacting other sites
- array('ssl_cafile' => false // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt')
+ array('ssl_cafile' => false, // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt')
+ 'curl' => false, // Use CURL backend for HTTP fetches if available. (If not, PHP's socket streams will be used.)
),
);
$this->config['ssl_verify_peer'] = false;
}
+ if (common_config('http', 'curl') && extension_loaded('curl')) {
+ $this->config['adapter'] = 'HTTP_Request2_Adapter_Curl';
+ }
+
parent::__construct($url, $method, $config);
$this->setHeader('User-Agent', $this->userAgent());
}
protected function doRequest($url, $method, $headers)
{
$this->setUrl($url);
+
+ // Workaround for HTTP_Request2 not setting up SNI in socket contexts;
+ // This fixes cert validation for SSL virtual hosts using SNI.
+ // Requires PHP 5.3.2 or later and OpenSSL with SNI support.
+ if ($this->url->getScheme() == 'https' && defined('OPENSSL_TLSEXT_SERVER_NAME')) {
+ $this->config['ssl_SNI_enabled'] = true;
+ $this->config['ssl_SNI_server_name'] = $this->url->getHost();
+ }
+
$this->setMethod($method);
if ($headers) {
foreach ($headers as $header) {