File tree 3 files changed +9
-8
lines changed
3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
1
(ns clj-http.lite.client
2
2
" Batteries-included HTTP client."
3
- (:use [slingshot.slingshot :only [throw+]])
4
3
(:require [clojure.string :as str]
5
4
[clojure.java.io :as io]
6
5
[clj-http.lite.core :as core]
7
6
[clj-http.lite.links :refer [wrap-links]]
8
- [clj-http.lite.util :as util])
7
+ [clj-http.lite.util :as util]
8
+ [slingshot.slingshot :refer [throw+]])
9
9
(:import (java.io InputStream File)
10
10
(java.net URL UnknownHostException))
11
11
(:refer-clojure :exclude (get update)))
Original file line number Diff line number Diff line change 47
47
(proxy [HostnameVerifier] []
48
48
(verify [^String hostname ^SSLSession session] true )))
49
49
50
- (defn trust-invalid-manager []
50
+ (defn trust-invalid-manager
51
51
" This allows the ssl socket to connect with invalid/self-signed SSL certs."
52
+ []
52
53
(reify X509TrustManager
53
54
(getAcceptedIssuers [this] nil )
54
55
(checkClientTrusted [this certs authType])
69
70
uri
70
71
(when query-string (str " ?" query-string)))
71
72
_ (when insecure?
72
- (do ( HttpsURLConnection/setDefaultSSLSocketFactory
73
+ (HttpsURLConnection/setDefaultSSLSocketFactory
73
74
(.getSocketFactory
74
75
(doto (SSLContext/getInstance " SSL" )
75
76
(.init nil (into-array TrustManager [(trust-invalid-manager )])
76
77
(new SecureRandom)))))
77
- (HttpsURLConnection/setDefaultHostnameVerifier (my-host-verifier ) )))
78
- ^HttpURLConnection conn (.openConnection ^URL (URL. http-url))]
78
+ (HttpsURLConnection/setDefaultHostnameVerifier (my-host-verifier )))
79
+ ^HttpURLConnection conn (.openConnection (URL. http-url))]
79
80
(when (and content-type character-encoding)
80
81
(.setRequestProperty conn " Content-Type" (str content-type
81
82
" ; charset="
Original file line number Diff line number Diff line change 1
1
(ns clj-http.test.links-test
2
2
" Imported from https://github.com/dakrone/clj-http/blob/217393258e7863514debece4eb7b23a7a3fa8bd9/test/clj_http/test/links_test.clj"
3
- (:require [clj-http.lite.links :refer :all ]
4
- [clojure.test :refer :all ]))
3
+ (:require [clj-http.lite.links :refer [wrap-links] ]
4
+ [clojure.test :refer [ deftest is testing] ]))
5
5
6
6
(defn- link-handler [link-header]
7
7
(wrap-links (constantly {:headers {" link" link-header}})))
You can’t perform that action at this time.
0 commit comments