aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challange_http.go4
-rw-r--r--client.go4
2 files changed, 6 insertions, 2 deletions
diff --git a/challange_http.go b/challange_http.go
index 30233bb..ee1708a 100644
--- a/challange_http.go
+++ b/challange_http.go
@@ -17,11 +17,11 @@ type httpChallenge struct {
Addr string
}
-func (c *httpChallenge) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+func (c httpChallenge) ServeHTTP(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, c.KeyAuthorization)
}
-func (c *httpChallenge) Solve() error {
+func (c httpChallenge) Solve() error {
done := make(chan bool)
l, err := net.Listen("tcp", c.Addr)
if err != nil {
diff --git a/client.go b/client.go
index 143b79e..38d9811 100644
--- a/client.go
+++ b/client.go
@@ -225,6 +225,10 @@ func (c *Client) Authorize(a *Account, domain []string) error {
KeyAuthorization: ka,
}
_, err = c.post(ch.URI, a, ans)
+ switch ch.Type {
+ case ChallengeHTTP:
+ httpChallenge{Addr: ":80", Challenge: *ans}.Solve()
+ }
}
}
}