You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2019/04/05 21:25:07 UTC

[couchdb-ibrowse] 01/20: sock options ignored on ssl

This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch handle-dead-ibrowse_lb-pids
in repository https://gitbox.apache.org/repos/asf/couchdb-ibrowse.git

commit 216f84cf92caebdaa3efc6dfaa8c65766f66e8db
Author: shakugan <kt...@gmail.com>
AuthorDate: Thu May 5 04:03:33 2016 +0000

    sock options ignored on ssl
---
 src/ibrowse_http_client.erl | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/ibrowse_http_client.erl b/src/ibrowse_http_client.erl
index 92ac431..c98be2a 100644
--- a/src/ibrowse_http_client.erl
+++ b/src/ibrowse_http_client.erl
@@ -565,7 +565,21 @@ do_connect(Host, Port, Options, #state{is_ssl      = true,
                                        use_proxy   = false,
                                        ssl_options = SSLOptions},
            Timeout) ->
-    ssl:connect(Host, Port, get_sock_options(Host, Options, SSLOptions), Timeout);
+    Socks5Host = get_value(socks5_host, Options, undefined),
+    Sock_options = get_sock_options(Host, Options, []),
+    Conn = case Socks5Host of
+      undefined ->
+        gen_tcp:connect(Host, Port, Sock_options, Timeout);
+      _ ->
+        catch ibrowse_socks5:connect(Host, Port, Options, Sock_options, Timeout)
+    end,
+    case Conn of
+      {ok, Sock} ->
+        ssl:connect(Sock, SSLOptions);
+      _ ->
+        error
+    end;
+    
 do_connect(Host, Port, Options, _State, Timeout) ->
     Socks5Host = get_value(socks5_host, Options, undefined),
     Sock_options = get_sock_options(Host, Options, []),