Skip to content

Adjust socket or connection parameters

Petr Gladkikh edited this page Apr 25, 2017 · 1 revision
(require '[clj-http.client :as client]
         '[clj-http.conn-mgr :as conn-mgr])
(import org.apache.http.config.SocketConfig)
(import org.apache.http.config.ConnectionConfig)

(let [cm (conn-mgr/make-regular-conn-manager {})]
  (.setSocketConfig cm
    (-> (SocketConfig/copy (.getSocketConfig cm))
      (.setRcvBufSize 400)
      (.build)))
  (.setConnectionConfig cm
    (-> (ConnectionConfig/copy (.getConnectionConfig cm))
      (.setBufferSize 300)
      (.build)))
  (client/get "https://github.com/"
                 {:connection-manager cm}))
Clone this wiki locally