+
+ // Default state of OpenSSL seems to have no trusted
+ // SSL certificate authorities, which breaks hostname
+ // verification and means we have a hard time communicating
+ // with other sites' HTTPS interfaces.
+ //
+ // Turn off verification unless we've configured a CA bundle.
+ if (common_config('http', 'ssl_cafile')) {
+ $this->config['ssl_cafile'] = common_config('http', 'ssl_cafile');
+ } else {
+ $this->config['ssl_verify_peer'] = false;
+ }
+
+ // This means "verify the cert hostname against what we connect to", it does not
+ // imply CA trust or anything like that. Just the hostname.
+ $this->config['ssl_verify_host'] = common_config('http', 'ssl_verify_host');
+
+ if (common_config('http', 'curl') && extension_loaded('curl')) {
+ $this->config['adapter'] = 'HTTP_Request2_Adapter_Curl';
+ }
+
+ foreach (array('host', 'port', 'user', 'password', 'auth_scheme') as $cf) {
+ $k = 'proxy_'.$cf;
+ $v = common_config('http', $k);
+ if (!empty($v)) {
+ $this->config[$k] = $v;
+ }
+ }
+