Skip to content

Commit

Permalink
Updated SSLGenericSocketFactory to accept an empty context
Browse files Browse the repository at this point in the history
  • Loading branch information
Paula Gearon committed Jan 31, 2018
1 parent 3109f94 commit 8b45606
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/clj_http/conn_mgr.clj
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@
"Given a function that returns a new socket, create an
SSLConnectionSocketFactory that will use that socket."
([socket-factory]
(SSLGenericSocketFactory socket-factory (SSLContexts/createDefault)))
(SSLGenericSocketFactory socket-factory nil))
([socket-factory ^SSLContext ssl-context]
(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))))))
(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)))))))

(defn ^PlainConnectionSocketFactory PlainGenericSocketFactory
"Given a Function that returns a new socket, create a
Expand Down

0 comments on commit 8b45606

Please sign in to comment.