view release on metacpan or search on metacpan
"Data::Compare" : "0",
"Data::Roundtrip" : "0.30",
"DateTime" : "0",
"Devel::StackTrace" : "0",
"Exporter" : "0",
"Firefox::Marionette::Cookie" : "0",
"HTTP::CookieJar" : "0",
"HTTP::Cookies" : "0",
"HTTP::Date" : "0",
"HTTP::Headers::Util" : "0",
"HTTP::Request" : "0",
"HTTP::Response" : "0",
"autovivification" : "0",
"perl" : "5.006"
}
},
"test" : {
"requires" : {
"Data::Roundtrip" : "0.30",
"DateTime" : "0",
"FindBin" : "0",
"Firefox::Marionette" : "0",
"Firefox::Marionette::Cookie" : "0",
"HTTP::CookieJar" : "0",
"HTTP::CookieJar::LWP" : "0",
"HTTP::Cookies" : "0",
"HTTP::Date" : "0",
"HTTP::Request" : "0",
"HTTP::Response" : "0",
"LWP::UserAgent" : "0",
"Test::Deep" : "0",
"Test::More" : "0",
"Test::More::UTF8" : "0",
"Test::TempDir::Tiny" : "0",
"URI" : "0",
"WWW::Mechanize" : "0"
}
}
Data::Roundtrip: '0.30'
DateTime: '0'
ExtUtils::MakeMaker: '0'
FindBin: '0'
Firefox::Marionette: '0'
Firefox::Marionette::Cookie: '0'
HTTP::CookieJar: '0'
HTTP::CookieJar::LWP: '0'
HTTP::Cookies: '0'
HTTP::Date: '0'
HTTP::Request: '0'
HTTP::Response: '0'
LWP::UserAgent: '0'
Test::Deep: '0'
Test::More: '0'
Test::More::UTF8: '0'
Test::TempDir::Tiny: '0'
URI: '0'
WWW::Mechanize: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
Data::Compare: '0'
Data::Roundtrip: '0.30'
DateTime: '0'
Devel::StackTrace: '0'
Exporter: '0'
Firefox::Marionette::Cookie: '0'
HTTP::CookieJar: '0'
HTTP::Cookies: '0'
HTTP::Date: '0'
HTTP::Headers::Util: '0'
HTTP::Request: '0'
HTTP::Response: '0'
autovivification: '0'
perl: '5.006'
version: '0.01'
x_serialization_backend: 'CPAN::Meta::YAML version 0.020'
Makefile.PL view on Meta::CPAN
'ExtUtils::MakeMaker' => '0',
},
TEST_REQUIRES => {
'Test::More' => '0',
'Data::Roundtrip' => '0.30',
'FindBin' => '0',
'HTTP::CookieJar' => '0',
'HTTP::CookieJar::LWP' => '0',
'HTTP::Cookies' => '0',
'HTTP::Cookies' => '0',
'HTTP::Request' => '0',
'HTTP::Response' => '0',
'Test::Deep' => '0',
'Test::More::UTF8' => '0',
'Test::TempDir::Tiny' => '0',
'URI' => '0',
'DateTime' => '0',
'Firefox::Marionette' => '0',
'Firefox::Marionette::Cookie' => '0',
'HTTP::Date' => '0',
'LWP::UserAgent' => '0',
'WWW::Mechanize' => '0',
},
PREREQ_PM => {
'DateTime' => '0',
'HTTP::Date' => '0',
'HTTP::Request' => '0',
'autovivification' => '0',
'Data::Roundtrip' => '0.30',
'Exporter' => '0',
'HTTP::CookieJar' => '0',
'HTTP::Cookies' => '0',
'Data::Compare' => '0',
'HTTP::Headers::Util' => '0',
'HTTP::Response' => '0',
'Devel::StackTrace' => '0',
'Firefox::Marionette::Cookie' => '0',
lib/Cookies/Roundtrip.pm view on Meta::CPAN
use strict;
use warnings;
our $VERSION = '0.01';
use HTTP::Cookies;
use HTTP::CookieJar;
use Firefox::Marionette::Cookie;
use HTTP::Date qw(str2time parse_date time2str);
use HTTP::Response;
use HTTP::Request;
use DateTime;
use HTTP::Headers::Util qw/join_header_words/;
use Data::Compare;
use Devel::StackTrace; # until the module is stable
use Data::Roundtrip qw/perl2dump no-unicode-escape-permanently/;
use Exporter; # you need to import 'import' if you don't define it further down
# the EXPORT_OK and EXPORT_TAGS is code by [kcott] @ Perlmongs.org, thanks!
# see https://perlmonks.org/?node_id=11115288
lib/Cookies/Roundtrip.pm view on Meta::CPAN
# from HTTP/Cookies.pm, set_cookie signature:
# my($version,
# $key, $val, $path, $domain, $port,
# $path_spec, $secure, $maxage, $discard, $rest) = @_;
$httpcookies->set_cookie(@$parsed_setcookie_array);
if( $verbosity > 0 ){ print STDOUT "${whoami}, line ".__LINE__." (via $parent): inserting 1 Set-Cookies into HTTP::Cookies which now has ".count_httpcookies($httpcookies, undef, $verbosity)." cookies.\n" }
# this way is bogus, what with response and request and url and all
# my $response = HTTP::Response->new(200);
# my $request = HTTP::Request->new(GET => $url);
# $response->request($request);
# $response->header('Set-Cookie2', $newasc); # TODO: does it push multiple Cookie headers or overrides?
# if( ! defined $httpcookies->extract_cookies($response) ){ print STDERR "--begin cookies:\n".as_string_setcookies($setcookies)."\n--end cookies.\n\n"."${whoami}, line ".__LINE__." (via $parent): error, call to ".'httpcookies->extract_cookies()'." h...
# if( $verbosity > 0 ){ print STDOUT "${whoami}, line ".__LINE__." (via $parent): inserting 1 Set-Cookies into HTTP::Cookies which now has ".count_httpcookies($httpcookies, undef, $verbosity)." cookies.\n" }
}
if( $verbosity > 0 ){ print STDOUT "${whoami}, line ".__LINE__." (via $parent): done all, inserted ".count_setcookies($setcookies)." Set-Cookies into HTTP::Cookies which now has ".count_httpcookies($httpcookies, undef, $verbosity)." cookies.\n" }
return $httpcookies;
}
# Array of Firefox::Marionette::Cookie to array of cookies.
t/150-count-start-from-httpcookies.t view on Meta::CPAN
our $VERSION = '0.01';
use Test::More;
use Test::More::UTF8;
use Test::Deep '!blessed';
use FindBin;
use Test::TempDir::Tiny;
use HTTP::CookieJar;
use HTTP::Cookies;
use HTTP::Cookies ();
use HTTP::Request ();
use HTTP::Response ();
use URI ();
use Data::Roundtrip qw/perl2dump no-unicode-escape-permanently/;
use lib ($FindBin::Bin, 'blib/lib');
use Cookies::Roundtrip qw/:count :as_string :equal
httpcookiejar2httpcookies httpcookies2httpcookiejar
/;
t/250-roundtrip-httpcookiejar-httpcookies.t view on Meta::CPAN
our $VERSION = '0.01';
use Test::More;
use Test::More::UTF8;
use Test::Deep '!blessed';
use FindBin;
use Test::TempDir::Tiny;
use HTTP::CookieJar;
use HTTP::Cookies;
use HTTP::Cookies ();
use HTTP::Request ();
use HTTP::Response ();
use URI ();
use Data::Roundtrip qw/perl2dump no-unicode-escape-permanently/;
use lib ($FindBin::Bin, 'blib/lib');
use Cookies::Roundtrip qw/:count :as_string :equal
httpcookiejar2httpcookies httpcookies2httpcookiejar
/;
t/550-lwpuseragent-start-from-httpcookies.t view on Meta::CPAN
our $VERSION = '0.01';
use Test::More;
use Test::More::UTF8;
use Test::Deep '!blessed';
use FindBin;
use Test::TempDir::Tiny;
use HTTP::CookieJar;
use HTTP::Cookies;
use HTTP::Cookies ();
use HTTP::Request ();
use HTTP::Response ();
use URI ();
use LWP::UserAgent;
use Data::Roundtrip qw/perl2dump no-unicode-escape-permanently/;
use lib ($FindBin::Bin, 'blib/lib');
use Cookies::Roundtrip qw/:count :as_string :equal
httpcookiejar2httpcookies httpcookies2httpcookiejar
t/550-lwpuseragent-start-from-httpcookies.t view on Meta::CPAN
diag "temp dir: $tmpdir ..." if exists($ENV{'PERL_TEST_TEMPDIR_TINY_NOCLEANUP'}) && $ENV{'PERL_TEST_TEMPDIR_TINY_NOCLEANUP'}>0;
# END
done_testing();
sub interact
{
my $c = shift;
my $url = shift;
my $req = HTTP::Request->new(POST => $url);
$c->add_cookie_header($req);
my $cookie = $req->header("Cookie");
my $res = HTTP::Response->new(200, "OK");
$res->request($req);
for (@_) { $res->push_header("Set-Cookie2" => $_) }
$c->extract_cookies($res);
return $cookie;
}
t/650-wwwmechanize-start-from-httpcookies.t view on Meta::CPAN
our $VERSION = '0.01';
use Test::More;
use Test::More::UTF8;
use Test::Deep '!blessed';
use FindBin;
use Test::TempDir::Tiny;
use HTTP::CookieJar;
use HTTP::Cookies;
use HTTP::Cookies ();
use HTTP::Request ();
use HTTP::Response ();
use URI ();
use WWW::Mechanize;
use Data::Roundtrip qw/perl2dump no-unicode-escape-permanently/;
use lib ($FindBin::Bin, 'blib/lib');
use Cookies::Roundtrip qw/:count :as_string :equal
httpcookiejar2httpcookies httpcookies2httpcookiejar
t/650-wwwmechanize-start-from-httpcookies.t view on Meta::CPAN
diag "temp dir: $tmpdir ..." if exists($ENV{'PERL_TEST_TEMPDIR_TINY_NOCLEANUP'}) && $ENV{'PERL_TEST_TEMPDIR_TINY_NOCLEANUP'}>0;
# END
done_testing();
sub interact
{
my $c = shift;
my $url = shift;
my $req = HTTP::Request->new(POST => $url);
$c->add_cookie_header($req);
my $cookie = $req->header("Cookie");
my $res = HTTP::Response->new(200, "OK");
$res->request($req);
for (@_) { $res->push_header("Set-Cookie2" => $_) }
$c->extract_cookies($res);
return $cookie;
}
t/MY/CookieMaker.pm view on Meta::CPAN
use strict;
use warnings;
our $VERSION = '0.01';
#use FindBin;
#use lib ($FindBin::Bin.'/../blib/lib');
use Test::Deep '!blessed';
use HTTP::Request;
use HTTP::Response;
use HTTP::Cookies;
use HTTP::CookieJar;
use HTTP::Date qw/time2isoz/;
use Firefox::Marionette::Cookie;
use DateTime;
use Cookies::Roundtrip qw/:new/;
my $VERBOSITY = 2;
t/MY/CookieMaker.pm view on Meta::CPAN
}
return $c;
}
sub HTTPCookies_make_random {
my $N = $_[0] // (1+int(rand(3+1)));
my $c = HTTP::Cookies->new;
my @cookies;
for(1..$N){
my $req = HTTP::Request->new(GET => random_host());
$req->header("Host", random_hostname());
my $res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => random_key()
.'='
.random_value()
.'; path='.random_path()
.'; expires='.random_expiry_date()
);
$c->extract_cookies($res);
t/MY/CookieMaker.pm view on Meta::CPAN
},
); # end our @HTTPCookieJar_cases
$li = 1;
our @HTTPCookies_cases = (
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new(GET => "http://1.1.1.1/");
$req->header("Host", "www.example.com:80");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => "CUSTOMER=WILE_E_COYOTE; path=/ ; expires=Wednesday, 09-Nov-$year_plus_one 23:12:40 GMT");
print $res->as_string;
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d testing value with quotes', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new(GET => "http://1.1.1.1/");
$req->header("Host", "www.example.com:80");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => "CUSTOMER=quoted=\"WILE\", non-quoted=_E_COYOTE; path=/ ; expires=Wednesday, 09-Nov-$year_plus_one 23:12:40 GMT");
print $res->as_string;
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new(GET => "http://www.example.com/");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie", "PART_NUMBER=ROCKET_LAUNCHER_0001; path=/");
$c->extract_cookies($res);
return $c
},
},
{
# this is an empty cookie!
'label' => sprintf('test-%02d', $li++),
t/MY/CookieMaker.pm view on Meta::CPAN
'Part_Number="Riding_Rocket_0023"; Version="1"; Path="/acme/ammo"');
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new('GET', 'http://www.example.com');
# this is slow and it changes the site to uk.trip.com thus not accepting cookie
#$req = HTTP::Request->new('GET', 'http://www.trip.com/trs/trip/flighttracker/flight_tracker_home.xsl');
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->push_header("Set-Cookie" => qq(trip.appServer=1111-0000-x-024;Domain=.example.com;Path=/));
$res->push_header("Set-Cookie" => qq(JSESSIONID=fkumjm7nt1.JS24;Path=/trs));
$res->push_header("Set-Cookie2" => qq(JSESSIONID=fkumjm7nt1.JS24;Version=1;Discard;Path="/trs"));
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
#$req = HTTP::Request->new('GET', 'http://www.trip.com/trs/trip/flighttracker/flight_tracker_home.xsl');
$req = HTTP::Request->new('GET', 'http://www.example.com');
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->push_header("Set-Cookie" => qq(trip.appServer=1111-0000-x-024;Domain=.example.com;Path=/));
$res->push_header("Set-Cookie" => qq(JSESSIONID=fkumjm7nt1.JS24;Path=/trs));
$res->push_header("Set-Cookie2" => qq(JSESSIONID=fkumjm7nt1.JS24;Version=1;Discard;Path="/trs"));
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new('GET', 'http://www.perlmeister.com/scripts');
$res = HTTP::Response->new(200, "OK");
$res->request($req);
# Set session/perm cookies and mark their values as "session" vs. "perm"
# to recognize them later
$res->push_header("Set-Cookie" => qq(s1=session;Path=/scripts));
$res->push_header("Set-Cookie" => qq(p1=perm; Domain=.perlmeister.com;Path=/;expires=Fri, 02-Feb-$year_plus_one 23:24:20 GMT));
$res->push_header("Set-Cookie" => qq(p2=perm;Path=/;expires=Fri, 02-Feb-$year_plus_one 23:24:20 GMT));
$res->push_header("Set-Cookie" => qq(s2=session;Path=/scripts;Domain=.perlmeister.com));
$res->push_header("Set-Cookie2" => qq(s3=session;Version=1;Discard;Path="/"));
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new(GET => "https://1.1.1.1/");
$req->header("Host", "www.example.com:80");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => "CUSTOMER=WILE_E_COYOTE ; secure ; path=/");
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new("GET" => "http://example.com");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => "Expires=10101");
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new("GET" => "http://example.com");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => "Expires=10101");
$res->header("Set-Cookie" => ["CUSTOMER=WILE_E_COYOTE; path=/;", ""]);
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new("GET" => "http://example.com");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => "Expires=10101");
$res->header("Set-Cookie" => ["CUSTOMER=WILE_E_COYOTE; path=/;", ""]);
$res->header("Set-Cookie" => "CUSTOMER=WILE_E_COYOTE;;path=/;");
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new("GET" => "http://example.com");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => "Expires=10101");
$res->header("Set-Cookie" => ["CUSTOMER=WILE_E_COYOTE; path=/;", ""]);
$res->header("Set-Cookie" => "CUSTOMER=WILE_E_COYOTE;;path=/;");
$res->header("Set-Cookie" => "foo=\"bar\";version=1");
$c->extract_cookies($res);
$req = HTTP::Request->new(GET => "http://www.example.com/foo");
$c->add_cookie_header($req);
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new("GET" => "http://example.com");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => "Expires=10101");
$res->header("Set-Cookie" => ["CUSTOMER=WILE_E_COYOTE; path=/;", ""]);
$res->header("Set-Cookie" => "CUSTOMER=WILE_E_COYOTE;;path=/;");
$res->header("Set-Cookie" => "foo=\"bar\";version=1");
$c->extract_cookies($res);
$req = HTTP::Request->new(GET => "http://www.example.com/foo");
$c->add_cookie_header($req);
$res->header("Set-Cookie", "PREF=ID=cee18f7c4e977184:TM=1254583090:LM=1254583090:S=Pdb0-hy9PxrNj4LL; expires=Mon, 03-Oct-2211 15:18:10 GMT; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired1=1; expires=Mon, 03-Oct-2001 15:18:10 GMT; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired2=1; expires=Fri Jan 1 00:00:00 GMT 1970; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired3=1; expires=Fri Jan 1 00:00:01 GMT 1970; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired4=1; expires=Thu Dec 31 23:59:59 GMT 1969; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired5=1; expires=Fri Feb 2 00:00:00 GMT 1950; path=/; domain=.example.com");
$c->extract_cookies($res);
return $c
},
},
{
'label' => sprintf('test-%02d', $li++),
'getcookie' => sub {
my ($rec, $req, $res, $c);
$c = HTTP::Cookies->new;
$req = HTTP::Request->new("GET" => "http://example.com");
$res = HTTP::Response->new(200, "OK");
$res->request($req);
$res->header("Set-Cookie" => "Expires=10101");
$res->header("Set-Cookie" => ["CUSTOMER=WILE_E_COYOTE; path=/;", ""]);
$res->header("Set-Cookie" => "CUSTOMER=WILE_E_COYOTE;;path=/;");
$res->header("Set-Cookie" => "foo=\"bar\";version=1");
$c->extract_cookies($res);
$req = HTTP::Request->new(GET => "http://www.example.com/foo");
$c->add_cookie_header($req);
$res->header("Set-Cookie", "PREF=ID=cee18f7c4e977184:TM=1254583090:LM=1254583090:S=Pdb0-hy9PxrNj4LL; expires=Mon, 03-Oct-2211 15:18:10 GMT; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired1=1; expires=Mon, 03-Oct-2001 15:18:10 GMT; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired2=1; expires=Fri Jan 1 00:00:00 GMT 1970; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired3=1; expires=Fri Jan 1 00:00:01 GMT 1970; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired4=1; expires=Thu Dec 31 23:59:59 GMT 1969; path=/; domain=.example.com");
$res->push_header("Set-Cookie", "expired5=1; expires=Fri Feb 2 00:00:00 GMT 1950; path=/; domain=.example.com");
$c->extract_cookies($res);
$res->header("Set-Cookie", "foo=1; path=/");
$c->extract_cookies($res);
$req = HTTP::Request->new(GET => "http://www.example.com/foo");
$req->header("Cookie", "x=bcd");
$c->add_cookie_header($req);
return $c
},
},
); # end our @HTTPCookies_cases
$li = 1;
our @FirefoxMarionetteCookies_cases = (
{
t/MY/CookieMaker.pm view on Meta::CPAN
# return an array of cookies
return $ret;
},
},
); # end our @FirefoxMarionetteCookies_cases
sub interact
{
my $c = shift;
my $url = shift;
my $req = HTTP::Request->new(POST => $url);
$c->add_cookie_header($req);
my $cookie = $req->header("Cookie");
my $res = HTTP::Response->new(200, "OK");
$res->request($req);
for (@_) { $res->push_header("Set-Cookie2" => $_) }
$c->extract_cookies($res);
return $cookie;
}
1;