From 394059ca59749b98eabb36affafcec1720c9c7ad Mon Sep 17 00:00:00 2001 From: heddn Date: Wed, 10 Sep 2014 11:36:35 -0600 Subject: [PATCH] Issue #1879970 by cableman0408, David_Rothstein: Fixed drupal_http_request fails when remote server is using openssl v1.0.0 (allow calling code to specify sslv2 sslv3 tls). --- includes/common.inc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/common.inc b/includes/common.inc index 63b691e..db86a12 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -875,6 +875,14 @@ function drupal_http_request($url, array $options = array()) { $port = isset($uri['port']) ? $uri['port'] : 443; $socket = 'ssl://' . $uri['host'] . ':' . $port; $options['headers']['Host'] = $uri['host'] . ($port != 443 ? ':' . $port : ''); + + // Disable SNI support as this causes issues with old versions of OpenSSL. + if (empty($options['context'])) { + $options['context'] = stream_context_create(array('ssl' => array('SNI_enabled' => FALSE))); + } + else { + stream_context_set_option($options['context'], 'ssl', 'SNI_enabled', FALSE); + } break; default: -- 2.1.0