Net-ACME2

 view release on metacpan or  search on metacpan

lib/Net/ACME2/Challenge/http_01/Handler.pm  view on Meta::CPAN


sub new {
    my ( $class, %opts ) = @_;

    #sanity
    my @missing = grep { !defined $opts{$_} } @required;
    die "Missing: [@missing]" if @missing;

    -d $opts{'document_root'} or die "Document root “$opts{'document_root'}” doesn’t exist!";

    my @relpath = split m</>, $opts{'challenge'}->path();

    my $file_path = File::Spec->catdir(
        $opts{'document_root'},
        @relpath,
    );

    my $dir = File::Spec->catdir(
        $opts{'document_root'},
        @relpath[ 0 .. ($#relpath - 1) ],
    );

lib/Net/ACME2/Curl.pm  view on Meta::CPAN


# curl response -> HTTP::Tiny response
sub _imitate_http_tiny {
    my ($easy, $head, $body) = @_;

    my $status_code = $easy->getinfo( Net::Curl::Easy::CURLINFO_RESPONSE_CODE() );

    my $reason;

    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>;

            if (exists $headers{$name}) {
                if (ref $headers{$name}) {
                    push @{$headers{$name}}, $value;
                }
                else {
                    $headers{$name} = [ $headers{$name}, $value ];
                }
            }



( run in 1.139 second using v1.01-cache-2.11-cpan-71847e10f99 )