From b958bd2da4b8ecef6382856f4deccb0fdb9979bd Mon Sep 17 00:00:00 2001 From: xenolf Date: Wed, 11 Nov 2015 13:51:03 +0100 Subject: [PATCH] Make the CA URL accept /directory. #23 --- acme/client.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/acme/client.go b/acme/client.go index fd1c9b92..40b245a3 100644 --- a/acme/client.go +++ b/acme/client.go @@ -75,10 +75,12 @@ func NewClient(caURL string, usr User, keyBits int, optPort string) (*Client, er solvers := make(map[string]solver) solvers["simpleHttp"] = &simpleHTTPChallenge{jws: jws, optPort: optPort} - dirURL := caURL + "/directory" - dirResp, err := http.Get(dirURL) + if !strings.HasSuffix(caURL, "/directory") { + caURL = caURL + "/directory" + } + dirResp, err := http.Get(caURL) if err != nil { - return nil, fmt.Errorf("get directory at '%s': %v", dirURL, err) + return nil, fmt.Errorf("get directory at '%s': %v", caURL, err) } defer dirResp.Body.Close()