diff --git a/sites/all/modules/contrib/httprl/httprl.module b/sites/all/modules/contrib/httprl/httprl.module
index d6483ba..583ebd9 100755
--- a/sites/all/modules/contrib/httprl/httprl.module
+++ b/sites/all/modules/contrib/httprl/httprl.module
@@ -186,12 +186,22 @@ function httprl_request($url, array $options = array()) {
       return $result;
   }
 
+  $flags = STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT;
+
+  // Workaround for PHP bug with STREAM_CLIENT_ASYNC_CONNECT and SSL
+  // https://bugs.php.net/bug.php?id=48182 - Fixed in PHP 5.2.11 and 5.3.1
+  if ($uri['scheme'] == 'https') {
+    if (version_compare(PHP_VERSION, '5.2.11' '<') || version_compare(PHP_VERSION, '5.3.0' '=')) {
+        $flags = 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.
