diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2016-06-30 19:11:47 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2016-06-30 19:21:34 +0200 |
commit | 968c5f4bb6f6d923b306498dee2c21c418326513 (patch) | |
tree | 6bb5efd055aab8a534af835a65e9afd49d16475c /client | |
parent | c0fcf9b9bf0a5162cf75f2c5e588a70004321c8d (diff) |
More useful message upon Validation Challenge failure.
Format the problem document if the JSON has an “error” key. Cf. section
7 “Identifier Validation Challenges”.
Diffstat (limited to 'client')
-rwxr-xr-x | client | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -284,10 +284,17 @@ elsif ($COMMAND eq 'new-cert') { keyAuthorization => $keyAuthorization }); # wait until the status become 'valid' - for ( my $i = 0, my $status; - $status = request_json_decode($r)->{status} // 'pending', + for ( my $i = 0, my $content, my $status; + $content = request_json_decode($r), + $status = $content->{status} // 'pending', $status ne 'valid'; $r = request('GET' => $challenge->{uri}), $i++ ) { + if (defined (my $problem = $content->{error})) { # problem document (RFC 7807) + my $msg = $problem->{status}; + $msg .= " " .$problem->{title} if defined $problem->{title}; + $msg .= " (".$problem->{detail}.")" if defined $problem->{detail}; + die $msg, "\n"; + } die "Error: Invalid challenge for $domain (status: ".$status.")\n" if $status ne 'pending'; die "Timeout exceeded while waiting for challenge to pass ($domain)\n" if $i >= ($CONFIG->{timeout} // 10); |