Skip to content

Commit 45433df

Browse files
committed
Omit empty "orders" field in Account object
May help with non-compliant ACME servers. See https://caddy.community/t/failing-to-register-an-acme-account/27220/5
1 parent 02868f0 commit 45433df

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

acme/account.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,17 @@ type Account struct {
6464
// orders (required, string): A URL from which a list of orders
6565
// submitted by this account can be fetched via a POST-as-GET
6666
// request, as described in Section 7.1.2.1.
67-
Orders string `json:"orders"`
67+
//
68+
// When empty, this field is omitted from JSON encodings since it
69+
// is not in the subset of fields described by the spec for inclusion
70+
// when creating an account (§7.3), but the spec also says in that
71+
// same section: "The server MUST ignore any values provided in the
72+
// "orders" fields in account objects sent by the client." Yet, we
73+
// have reports of non-compliant ACME servers (see
74+
// https://caddy.community/t/failing-to-register-an-acme-account/27220/5)
75+
// so we tighten up our serialization a bit to omit empty Orders,
76+
// even though the spec also says this field is "required".
77+
Orders string `json:"orders,omitempty"`
6878

6979
// In response to new-account, "the server returns this account
7080
// object in a 201 (Created) response, with the account URL

0 commit comments

Comments
 (0)