diff --git a/sites/all/modules/contrib/httprl/httprl.module b/sites/all/modules/contrib/httprl/httprl.module index d6483ba..9b5cd68 100755 --- a/sites/all/modules/contrib/httprl/httprl.module +++ b/sites/all/modules/contrib/httprl/httprl.module @@ -186,12 +186,21 @@ function httprl_request($url, array $options = array()) { return $result; } + // Workaround for PHP bug with STREAM_CLIENT_ASYNC_CONNECT and SSL + // https://bugs.php.net/bug.php?id=48182 + if ($uri['scheme'] == 'https') { + $flags = STREAM_CLIENT_CONNECT; + } + else { + $flags = STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT; + } + if (empty($options['context'])) { - $fp = @stream_socket_client($socket, $errno, $errstr, $options['timeout'], STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT); + $fp = @stream_socket_client($socket, $errno, $errstr, $options['timeout'], $flags); } else { // Create a stream with context. Allows verification of a SSL certificate. - $fp = @stream_socket_client($socket, $errno, $errstr, $options['timeout'], STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT, $options['context']); + $fp = @stream_socket_client($socket, $errno, $errstr, $options['timeout'], $flags, $options['context']); } // Make sure the socket opened properly.