(TK-179) Cleanup for PR feedback

* Remove comment about :sslengine as an option, because it no longer seems to
be supported.
* Remove duplicate `.setSslContext`
* Use -> macro to clean up client creation and coersion of options
* Remove outdated TODO on the `common/Client` schema
* Remove unused `SslOptions` schema
* Remove unused imports
This commit is contained in:
Ruth Linehan 2016-02-08 13:57:25 -05:00
parent 4176251521
commit a801ae5b02
3 changed files with 5 additions and 14 deletions

View file

@ -4,9 +4,7 @@
;; In the options to any request method, an existing SSLContext object can be
;; supplied under :ssl-context. If this is present it will be used. If it's
;; not, the wrapper will attempt to use a set of PEM files stored in
;; (:ssl-cert :ssl-key :ssl-ca-cert) to create the SSLContext. It is also
;; still possible to use an SSLEngine directly, and if this is present under
;; the key :sslengine it will be used before any other options are tried.
;; (:ssl-cert :ssl-key :ssl-ca-cert) to create the SSLContext.
;;
;; See the puppetlabs.http.sync namespace for synchronous versions of all
;; these methods.
@ -32,7 +30,6 @@
(some? ssl-cert) (.setSslCert ssl-cert)
(some? ssl-ca-cert) (.setSslCaCert ssl-ca-cert)
(some? ssl-key) (.setSslKey ssl-key)
(some? ssl-context) (.setSslContext ssl-context)
(some? ssl-protocols) (.setSslProtocols (into-array String ssl-protocols))
(some? cipher-suites) (.setSslCipherSuites (into-array String cipher-suites))
(some? force-redirects) (.setForceRedirects force-redirects)
@ -41,8 +38,10 @@
(.setConnectTimeoutMilliseconds connect-timeout-milliseconds)
(some? socket-timeout-milliseconds)
(.setSocketTimeoutMilliseconds socket-timeout-milliseconds))
(let [coerced-options (JavaClient/coerceClientOptions (SslUtils/configureSsl client-options))
client (JavaClient/createClient coerced-options)]
(let [client (-> client-options
SslUtils/configureSsl
JavaClient/coerceClientOptions
JavaClient/createClient)]
(.start client)
client)))

View file

@ -30,7 +30,6 @@
(def UrlOrString (schema/either schema/Str URL))
;; TODO: replace this with a protocol
(def Client CloseableHttpAsyncClient)
(def Headers
@ -100,9 +99,6 @@
:ssl-key UrlOrString
:ssl-ca-cert UrlOrString})
(def SslOptions
(schema/either {} SslContextOptions SslCertOptions SslCaCertOptions))
(def SslProtocolOptions
{(ok :ssl-protocols) [schema/Str]
(ok :cipher-suites) [schema/Str]})
@ -156,5 +152,3 @@
(def Response
(schema/either NormalResponse ErrorResponse))

View file

@ -2,8 +2,6 @@
;; defined in puppetlabs.http.client
(ns puppetlabs.http.client.sync
(:import (org.apache.http.impl.nio.client HttpAsyncClients)
(org.apache.http.impl.client LaxRedirectStrategy))
(:require [puppetlabs.http.client.async :as async]
[schema.core :as schema]
[puppetlabs.http.client.common :as common])