| 1 | package Net::ACME::Certificate::Pending; | ||||||||||
| 2 | |||||||||||
| 3 | =encoding utf-8 | ||||||||||
| 4 | |||||||||||
| 5 | =head1 NAME | ||||||||||
| 6 | |||||||||||
| 7 | Net::ACME::Certificate::Pending - for when the cert isn’t ready yet | ||||||||||
| 8 | |||||||||||
| 9 | =head1 SYNOPSIS | ||||||||||
| 10 | |||||||||||
| 11 | my $need_retry = Net::ACME::Certificate::Pending->new( | ||||||||||
| 12 | uri => 'http://path/to/cert', | ||||||||||
| 13 | retry_after => 30, #i.e., retry after 30 seconds | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | my $cert; | ||||||||||
| 17 | |||||||||||
| 18 | while (!$cert) { | ||||||||||
| 19 | if ($need_retry->is_time_to_poll()) { | ||||||||||
| 20 | $cert = $need_retry->poll(); | ||||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | sleep 1; | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | =cut | ||||||||||
| 27 | |||||||||||
| 28 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | |||||||||||
| 31 | 4 | ▶ | use parent qw( Net::ACME::RetryAfter ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 32 | |||||||||||
| 33 | 4 | ▶ | use Net::ACME::Certificate (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 34 | |||||||||||
| 35 | sub _handle_non_202_poll { | ||||||||||
| 36 | 4 | ▶ | my ( $self, $resp ) = @_; | ||||||||
|
Subroutine
_handle_non_202_poll: called CC=2 SCAR=6.9
| |||||||||||
| 37 | |||||||||||
| 38 | 4 | ▶ | $resp->die_because_unexpected() if $resp->status() != 201; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | |||||||||||
| 40 | return Net::ACME::Certificate->new( | ||||||||||
| 41 | content => $resp->content(), | ||||||||||
| 42 | type => $resp->header('content-type'), | ||||||||||
| 43 | 2 | issuer_cert_uri => { $resp->links() }->{'up'}, | |||||||||
| 44 | ); | ||||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 4 | 1; | |||||||||