Skip to content

Instantly share code, notes, and snippets.

@t-ob
Created September 27, 2012 10:57
Show Gist options
  • Select an option

  • Save t-ob/3793454 to your computer and use it in GitHub Desktop.

Select an option

Save t-ob/3793454 to your computer and use it in GitHub Desktop.
Ignore wonky SSL certs
;; Before:
;; (http/get "https://tv.eurosport.com/")
;; Error: AbstractVerifier.java:228 org.apache.http.conn.ssl.AbstractVerifier.verify
;;
;; Instead:
;; (with-connection-pool {:insecure? true} (http/get "https://tv.eurosport.com/"))
;; ignores bad certificate
(defn request*
"HTTP request with a constrained time and body size."
[options]
(http/with-connection-pool {:insecure? true}
(let [options (merge options {:conn-timeout 1000 :socket-timeout 5000 :as :stream})
response (http/request options)]
(if (text-response? response)
(-> response
(update-in [:body] read-stream {:timeout 5000 :max-bytes 100000})
(assoc :url (last (:trace-redirects response))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment