From 21de29e9022d4aa4965ae66bdf0cc9b49a5ae403 Mon Sep 17 00:00:00 2001 From: xenolf Date: Sun, 14 Feb 2016 16:57:06 +0100 Subject: [PATCH] Take the magic out of defaulting to the Server implementations of HTTP-01 and TLS-SNI-01 --- acme/client.go | 4 ++-- acme/http_challenge.go | 4 ---- acme/tls_sni_challenge.go | 4 ---- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/acme/client.go b/acme/client.go index 3851a69f..35dbcd64 100644 --- a/acme/client.go +++ b/acme/client.go @@ -95,8 +95,8 @@ func NewClient(caDirURL string, user User, keyBits int) (*Client, error) { // Add all available solvers with the right index as per ACME // spec to this map. Otherwise they won`t be found. solvers := make(map[Challenge]solver) - solvers[HTTP01] = &httpChallenge{jws: jws, validate: validate} - solvers[TLSSNI01] = &tlsSNIChallenge{jws: jws, validate: validate} + solvers[HTTP01] = &httpChallenge{jws: jws, validate: validate, provider: &HTTPProviderServer{}} + solvers[TLSSNI01] = &tlsSNIChallenge{jws: jws, validate: validate, provider: &TLSProviderServer{}} return &Client{directory: dir, user: user, jws: jws, keyBits: keyBits, solvers: solvers}, nil } diff --git a/acme/http_challenge.go b/acme/http_challenge.go index a9f8e5cf..1cc1f6e1 100644 --- a/acme/http_challenge.go +++ b/acme/http_challenge.go @@ -26,10 +26,6 @@ func (s *httpChallenge) Solve(chlng challenge, domain string) error { return err } - if s.provider == nil { - s.provider = &httpChallengeServer{} - } - err = s.provider.Present(domain, chlng.Token, keyAuth) if err != nil { return fmt.Errorf("[%s] error presenting token: %v", domain, err) diff --git a/acme/tls_sni_challenge.go b/acme/tls_sni_challenge.go index 2ab3abd0..dca886bd 100644 --- a/acme/tls_sni_challenge.go +++ b/acme/tls_sni_challenge.go @@ -27,10 +27,6 @@ func (t *tlsSNIChallenge) Solve(chlng challenge, domain string) error { return err } - if t.provider == nil { - t.provider = &tlsSNIChallengeServer{} - } - err = t.provider.Present(domain, chlng.Token, keyAuth) if err != nil { return fmt.Errorf("[%s] error presenting token: %v", domain, err)