diff options
author | Dimitri Sokolyuk <demon@dim13.org> | 2016-01-29 18:48:43 +0100 |
---|---|---|
committer | Dimitri Sokolyuk <demon@dim13.org> | 2016-01-29 18:48:43 +0100 |
commit | 2468f553155bb495266ed29b8e2da0d03d755f51 (patch) | |
tree | 6c54ab2e4a242cdbc0485377cf6ea0dacaea15eb | |
parent | 5fcb9e0df2eb72063396616b33d44b1711b44764 (diff) |
Test problems
-rw-r--r-- | cmd/acme/dim13.toml | 12 | ||||
-rw-r--r-- | cmd/acme/main.go | 5 | ||||
-rw-r--r-- | provider.go | 18 |
3 files changed, 24 insertions, 11 deletions
diff --git a/cmd/acme/dim13.toml b/cmd/acme/dim13.toml index 687ae5d..f0711d6 100644 --- a/cmd/acme/dim13.toml +++ b/cmd/acme/dim13.toml @@ -11,12 +11,12 @@ directory = "https://acme-v01.api.letsencrypt.org/directory" mail = "webmaster@dim13.org" key = "private/webmaster.key" -[desire.web] -provider = "letsencrypt" -account = "webmaster" -altnames = [ "www.dim13.org", "mail.dim13.org", "git.dim13.org", "cvs.dim13.org", "dim13.org" ] -key = "private/www_dim13_org.key" -cert = "certs/www_dim13_org.pem" +#[desire.web] +#provider = "letsencrypt" +#account = "webmaster" +#altnames = [ "www.dim13.org", "mail.dim13.org", "git.dim13.org", "cvs.dim13.org", "dim13.org" ] +#key = "private/www_dim13_org.key" +#cert = "certs/www_dim13_org.pem" [account.postmaster] mail = "postmaster@dim13.org" diff --git a/cmd/acme/main.go b/cmd/acme/main.go index ea4151f..882a8b6 100644 --- a/cmd/acme/main.go +++ b/cmd/acme/main.go @@ -53,12 +53,11 @@ func prepare(conf *Config) error { } func satisfice(des *desire) error { - if des.account.pending { - log.Println("register pending account") + log.Println("register acc") if err := des.provider.Register(des.account, des.account.Contacts); err != nil { return err } - } + log.Println("register ok") if err := des.provider.Authorize(des.account, des.Desire); err != nil { return err diff --git a/provider.go b/provider.go index 8cdf8d6..f2ab923 100644 --- a/provider.go +++ b/provider.go @@ -6,6 +6,7 @@ import ( "errors" "log" "net/http" + "net/url" "regexp" "time" ) @@ -46,10 +47,12 @@ func (p Provider) RoundTrip(req *http.Request) (*http.Response, error) { p.nonces <- nonce } // not sure if it belongs here + /* if resp.Header.Get("Content-Type") == mimeProblem { defer resp.Body.Close() return nil, problem(resp.Body) } + */ return resp, nil } @@ -137,8 +140,19 @@ func (p *Provider) Register(s Signer, c Contacts) error { Contact: c, } resp, err := p.post(p.NewReg, s, req) - if err != nil && err.(Problem).Err != ErrMalformed { - return err + if err != nil { + switch e := err.(type) { + case Problem: + log.Println("problem") + if e.Err != ErrMalformed { + return err + } + case *url.Error: + log.Println("url error") + default: + log.Println("other problem") + return err + } } ns := parseHeader(resp) |