From 82584ae71e11e53d3c75d8cb6dfe5c9f974ca1af Mon Sep 17 00:00:00 2001 From: Ray Cheung Date: Tue, 30 Apr 2024 13:56:12 +0800 Subject: [PATCH] Fix incorrect socket state when using SOCKS proxy The socket gets into an incorrect state across threads when the connection-manager is shared. New sockets should be created, same as plain HTTP. --- src/clj_http/conn_mgr.clj | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/clj_http/conn_mgr.clj b/src/clj_http/conn_mgr.clj index 111c64ff..7cb75e25 100644 --- a/src/clj_http/conn_mgr.clj +++ b/src/clj_http/conn_mgr.clj @@ -41,10 +41,8 @@ ([socket-factory ^SSLContext ssl-context] (let [^SSLContext ssl-context' (or ssl-context (SSLContexts/createDefault))] (proxy [SSLConnectionSocketFactory] [ssl-context'] - (connectSocket [timeout socket host remoteAddress localAddress context] - (let [^SSLConnectionSocketFactory this this] ;; avoid reflection - (proxy-super connectSocket timeout (socket-factory) host remoteAddress - localAddress context))))))) + (createSocket [context] + (socket-factory)))))) (defn ^PlainConnectionSocketFactory PlainGenericSocketFactory "Given a Function that returns a new socket, create a