From a521dfce2584b08efb1ec3eab94c05254dcf8f09 Mon Sep 17 00:00:00 2001 From: Alex Vaghin Date: Sat, 21 Jul 2018 22:26:40 +0200 Subject: [PATCH] acme: expect 202 Accepted from Let's Encrypt ACME draft specifies the CA servers should respond with 201 Created status code but Let's Encrypt responds with 202 Accepted when creating a new account. This change adds 202 Accepted as a valid response. Otherwise, the Client hangs while doing retries, discarding 202 responses as invalid. Tests are not updated intentionally due to this being non-conformant with the spec. Fixes golang/go#26251 Change-Id: I2918fce3873592c02e96f4118c4d1ecb42da3c4f Reviewed-on: https://go-review.googlesource.com/125415 Reviewed-by: Brad Fitzpatrick --- acme/acme.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/acme/acme.go b/acme/acme.go index 8257ffb..e6d5202 100644 --- a/acme/acme.go +++ b/acme/acme.go @@ -645,8 +645,9 @@ func (c *Client) doReg(ctx context.Context, url string, typ string, acct *Accoun req.Agreement = acct.AgreedTerms } res, err := c.post(ctx, c.Key, url, req, wantStatus( - http.StatusOK, // updates and deletes - http.StatusCreated, // new account creation + http.StatusOK, // updates and deletes + http.StatusCreated, // new account creation + http.StatusAccepted, // Let's Encrypt divergent implementation )) if err != nil { return nil, err