diff options
Diffstat (limited to 'provider.go')
-rw-r--r-- | provider.go | 18 |
1 files changed, 16 insertions, 2 deletions
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) |