Created
September 27, 2012 10:57
-
-
Save t-ob/3793454 to your computer and use it in GitHub Desktop.
Ignore wonky SSL certs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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