Curl-Impersonate

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        Default true.

    timeout => $seconds
        Whole-request timeout. There is no default: libcurl waits
        indefinitely, so a blackholed address or a server that accepts and
        never answers will hang the caller. Set one for anything talking to
        the open internet.

    verify => $bool
        TLS peer/host verification. Default true. Set false only for testing
        against self-signed endpoints.

    follow_redirects => $bool
        Follow "3xx" redirects. Default false. libcurl bounds the chain
        itself, so a redirect loop ends with "Number of redirects hit
        maximum amount" rather than spinning.

    decode => $bool
        Decompress the response body. libcurl decodes whatever it was built
        with -- here gzip, deflate, br and zstd -- and "$res->{body}" is the
        decoded bytes. Off by default, so the body arrives exactly as the

lib/Curl/Impersonate.pm  view on Meta::CPAN


=item timeout => $seconds

Whole-request timeout. There is no default: libcurl waits indefinitely, so a
blackholed address or a server that accepts and never answers will hang the
caller. Set one for anything talking to the open internet.

=item verify => $bool

TLS peer/host verification. Default true. Set false only for testing against
self-signed endpoints.

=item follow_redirects => $bool

Follow C<3xx> redirects. Default false. libcurl bounds the chain itself, so a
redirect loop ends with C<Number of redirects hit maximum amount> rather than
spinning.

=item decode => $bool

Decompress the response body. libcurl decodes whatever it was built with --

xt/20-fingerprint.t  view on Meta::CPAN

use v5.10; use strict; use warnings;
use Test::More;
use Curl::Impersonate;
plan skip_all => 'network fingerprint test; set CI_LIVE=1 to run' unless $ENV{CI_LIVE};

my $c = Curl::Impersonate->new(impersonate => 'chrome131', timeout => 20);
my $r = $c->get('https://tls.peet.ws/api/all');
is($r->{status}, 200, 'fingerprint endpoint reachable') or diag($r->{error} // '');
my ($ja4) = ($r->{body} // '') =~ /"ja4":\s*"([^"]+)"/;
ok($ja4, "got a ja4 ($ja4)");
like($ja4, qr/^t13d/, 'JA4 is a TLS 1.3 client (Chrome-shaped)');
like($r->{body}, qr/"akamai_fingerprint":\s*"[^"]/, 'HTTP/2 (Akamai) fingerprint present');
like($r->{body}, qr/"user_agent":\s*"[^"]*Chrome/, 'the Chrome default UA was applied');
# response plumbing
is($r->{headers}{'content-type'}, 'application/json', 'response headers parsed + lowercased');
ok(length($r->{body}) > 100, 'body captured');
done_testing;



( run in 2.527 seconds using v1.01-cache-2.11-cpan-a49fcb8fa48 )