Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions lib/Net/ACME2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ sub _key_thumbprint {
sub _get_directory {
my ($self) = @_;

return $self->{'_directory_promise'} ||= do {
return $self->{'_directory_cache'} ||= do {
my $dir_path = $self->DIRECTORY_PATH();

my $http = $self->{'_http'};
Expand Down Expand Up @@ -1190,10 +1190,6 @@ sub _die_generic {
*create_new_account = *create_account;
*create_new_order = *create_order;

# sub DESTROY {
# print "ACME2 destroyed at ${^GLOBAL_PHASE}\n";
# }

1;

=head1 TODO
Expand Down
2 changes: 2 additions & 0 deletions lib/Net/ACME2/Curl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ sub _imitate_http_tiny {

my %headers;
for my $line ( split m<\x0d?\x0a>, $head ) {
next if !length $line;

if (defined $reason) {
my ($name, $value) = split m<\s*:\s*>, $line, 2;
$name =~ tr<A-Z><a-z>;
Expand Down
11 changes: 4 additions & 7 deletions lib/Net/ACME2/HTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ our $verify_SSL = 1;
sub new {
my ( $class, %opts ) = @_;

my $is_sync;

$opts{'ua'} ||= do {
$is_sync = 1;

require Net::ACME2::HTTP_Tiny;
Net::ACME2::HTTP_Tiny->new( verify_SSL => $verify_SSL );
};
Expand All @@ -53,7 +49,6 @@ sub new {
_acme_key => $opts{'key'},
_key_id => $opts{'key_id'},
_retries_left => $_MAX_RETRIES,
_sync_io => $is_sync,
}, $class;

return bless $self, $class;
Expand Down Expand Up @@ -144,8 +139,6 @@ sub _post {
sub {
my $jws = shift;

# local $opts_hr->{'headers'}{'Content-Type'} = 'application/jose+json';

return Net::ACME2::PromiseUtil::do_then_catch(
sub {
return $self->_request_and_set_last_nonce(
Expand All @@ -170,6 +163,10 @@ sub _post {

my $resp;

# NB: We mutate $self->{'_retries_left'} rather than
# using local() because this code may run inside a
# promise chain where local's dynamic scope doesn't
# extend across async callbacks.
if ( eval { $err->get('acme')->type() =~ m<:badNonce\z> } ) {
if (!$self->{'_retries_left'}) {
warn( "$url: Received “badNonce” error, and no retries left!\n" );
Expand Down
Loading