Make the CA URL accept /directory. #23

This commit is contained in:
xenolf 2015-11-11 13:51:03 +01:00
parent 959cf005c7
commit b958bd2da4

View file

@ -75,10 +75,12 @@ func NewClient(caURL string, usr User, keyBits int, optPort string) (*Client, er
solvers := make(map[string]solver) solvers := make(map[string]solver)
solvers["simpleHttp"] = &simpleHTTPChallenge{jws: jws, optPort: optPort} solvers["simpleHttp"] = &simpleHTTPChallenge{jws: jws, optPort: optPort}
dirURL := caURL + "/directory" if !strings.HasSuffix(caURL, "/directory") {
dirResp, err := http.Get(dirURL) caURL = caURL + "/directory"
}
dirResp, err := http.Get(caURL)
if err != nil { 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() defer dirResp.Body.Close()