From af05fe47b225a9aaf922f965bf0e25672fdd907d Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 8 Jan 2016 10:22:05 +0100 Subject: Add webroot solver --- challange_http.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'challange_http.go') diff --git a/challange_http.go b/challange_http.go index b1fe9c0..4bdcff1 100644 --- a/challange_http.go +++ b/challange_http.go @@ -9,8 +9,6 @@ import ( "path" ) -const wellKnown = `/.well-known/acme-challenge/` - func init() { registerSolver(ChallengeHTTP) } @@ -22,7 +20,7 @@ type httpChallenge struct { } func (c *httpChallenge) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == path.Join(wellKnown, c.Token) { + if r.URL.Path == path.Join(WellKnown, c.Token) { io.WriteString(w, c.KeyAuthorization) c.l.Close() } @@ -50,7 +48,7 @@ type webRoot struct { } func (c *webRoot) Solve() error { - file := path.Join(c.Webroot, wellKnown, c.Token) + file := path.Join(c.Webroot, WellKnown, c.Token) if err := os.MkdirAll(path.Dir(file), 0755); err != nil { return err } @@ -58,6 +56,6 @@ func (c *webRoot) Solve() error { } func (c *webRoot) Abort() error { - file := path.Join(c.Webroot, wellKnown, c.Token) + file := path.Join(c.Webroot, WellKnown, c.Token) return os.Remove(file) } -- cgit v1.2.3