aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-06-30 19:11:47 +0200
committerGuilhem Moulin <guilhem@fripost.org>2016-06-30 19:21:34 +0200
commit968c5f4bb6f6d923b306498dee2c21c418326513 (patch)
tree6bb5efd055aab8a534af835a65e9afd49d16475c /client
parentc0fcf9b9bf0a5162cf75f2c5e588a70004321c8d (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-xclient11
1 files changed, 9 insertions, 2 deletions
diff --git a/client b/client
index 2566c9b..46f388f 100755
--- a/client
+++ b/client
@@ -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);