aboutsummaryrefslogtreecommitdiff
path: root/challange_http.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-01-08 10:22:05 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-01-08 10:22:05 +0100
commitaf05fe47b225a9aaf922f965bf0e25672fdd907d (patch)
tree484acbf883d27783ebbaf35b33d6213366237d1e /challange_http.go
parenta893ae16a82829628953911a2cff954df835618b (diff)
Add webroot solver
Diffstat (limited to 'challange_http.go')
-rw-r--r--challange_http.go8
1 files changed, 3 insertions, 5 deletions
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)
}