Cookies-Roundtrip
view release on metacpan or search on metacpan
lib/Cookies/Roundtrip.pm view on Meta::CPAN
if( firefoxmarionettecookies2file($cookies, $filename, $skip_discard, $verbosity) ){ print STDERR "${whoami}, line ".__LINE__." (via $parent): error, call to ".'httpcookies2file()'." has failed.\n"; return 1 }
return 0 # success
}
# Convenience method to load any kind of cookies
# or a cookies file, into the LWP::UserAgent
# it returns the $ffmar's cookies on success or undef on failure
# NOTE: firefox marionette will not load cookies unless we visit the site
# of the cookie domain. However, some sites redirect you if you
# do not ask for a full-path endpoint URL (e.g. www.abc.com/a/b/c
# instead of cookie domain www.abc.com. If you visit www.abc.com
# it may take you to cy.abc.com)
# So, parameter $visit_cookie_domain_first controls this
# if it is undef, then no visit is made,
# if '' (empty string) then it goes to the domain https://www.abc.com above
# if non-empty string it visits that URL instead, this is the most safe.
sub firefoxmarionette_load_cookies {
my ($ffmar, $cookies_or_file_etc, $visit_cookie_domain_first, $skip_discard, $verbosity) = @_;
$verbosity //= 0;
$skip_discard //= 0;
lib/Cookies/Roundtrip.pm view on Meta::CPAN
# to have this header:
# #LWP-Cookies-ZZZ.ZZZ
# and then followed by 'Set-Cookie: blahblah' lines,
# into the specified LWP::UserAgent object, appending
# cookies to it if already some there.
# It takes in the $ffmar, $filename and, optionally $verbosity (integer),
# and returns back the $ffmar's cookie jar (as HTTP::CookieJar object)
# It returns undef on failure.
# NOTE: firefox marionette will not load cookies unless we visit the site
# of the cookie domain. However, some sites redirect you if you
# do not ask for a full-path endpoint URL (e.g. www.abc.com/a/b/c
# instead of cookie domain www.abc.com. If you visit www.abc.com
# it may take you to cy.abc.com)
# So, parameter $visit_cookie_domain_first controls this
# if it is undef, then no visit is made,
# if '' (empty string) then it goes to the domain https://www.abc.com above
# if non-empty string it visits that URL instead, this is the most safe.
sub firefoxmarionette_load_cookies_from_file {
my ($ffmar, $filename, $visit_cookie_domain_first, $skip_discard, $verbosity) = @_;
$skip_discard //= 0;
$verbosity //= 0;
lib/Cookies/Roundtrip.pm view on Meta::CPAN
}
# It loads the specified HTTP::Cookies object
# into the specified LWP::UserAgent object, appending
# cookies to it if already some there.
# It takes in the $ffmar, $httpcookies and, optionally $verbosity (integer),
# and returns back the $ffmar's cookie jar (as HTTP::CookieJar object)
# It returns undef on failure.
# NOTE: firefox marionette will not load cookies unless we visit the site
# of the cookie domain. However, some sites redirect you if you
# do not ask for a full-path endpoint URL (e.g. www.abc.com/a/b/c
# instead of cookie domain www.abc.com. If you visit www.abc.com
# it may take you to cy.abc.com)
# So, parameter $visit_cookie_domain_first controls this
# if it is undef, then no visit is made,
# if '' (empty string) then it goes to the domain https://www.abc.com above
# if non-empty string it visits that URL instead, this is the most safe.
sub firefoxmarionette_load_setcookies {
my ($ffmar, $setcookies, $visit_cookie_domain_first, $skip_discard, $verbosity) = @_;
$verbosity //= 0;
$skip_discard //= 0;
lib/Cookies/Roundtrip.pm view on Meta::CPAN
# if you have visited a url then you can add only cookies whose domain is the same as the
# current url!!! Otherwise you get error about cookie-averse document etc.
# see
# https://stackoverflow.com/questions/48352380/org-openqa-selenium-invalidcookiedomainexception-document-is-cookie-averse-usin
# So, we have an extra flag to visit the page of each cookie domain before loading it
# set $visit_cookie_domain_first to false in order not to visit (that means you are sure
# you are there already, otherwise this call will fail).
# Default is to visit first.
# NOTE: firefox marionette will not load cookies unless we visit the site
# of the cookie domain. However, some sites redirect you if you
# do not ask for a full-path endpoint URL (e.g. www.abc.com/a/b/c
# instead of cookie domain www.abc.com. If you visit www.abc.com
# it may take you to cy.abc.com)
# So, parameter $visit_cookie_domain_first controls this
# if it is undef, then no visit is made,
# if '' (empty string) then it goes to the domain https://www.abc.com above
# if non-empty string (and starts with https?://) it visits that URL instead, this is the most safe.
# BUT if you have a lot of cookies you need to load each with its own calculated url
# This is so stupid and will probably fail.
# Perhaps we can skip cookies which are failing to load and not dump core...
sub firefoxmarionette_load_firefoxmarionettecookies {
lib/Cookies/Roundtrip.pm view on Meta::CPAN
}
# It loads the specified HTTP::Cookies object
# into the specified LWP::UserAgent object, appending
# cookies to it if already some there.
# It takes in the $ffmar, $httpcookies and, optionally $verbosity (integer),
# and returns back the $ffmar's cookie jar (as array of Firefox::Marionette::Cookie object)
# It returns undef on failure.
# NOTE: firefox marionette will not load cookies unless we visit the site
# of the cookie domain. However, some sites redirect you if you
# do not ask for a full-path endpoint URL (e.g. www.abc.com/a/b/c
# instead of cookie domain www.abc.com. If you visit www.abc.com
# it may take you to cy.abc.com)
# So, parameter $visit_cookie_domain_first controls this
# if it is undef, then no visit is made,
# if '' (empty string) then it goes to the domain https://www.abc.com above
# if non-empty string it visits that URL instead, this is the most safe.
sub firefoxmarionette_load_httpcookies {
my ($ffmar, $httpcookies, $visit_cookie_domain_first, $skip_discard, $verbosity) = @_;
$skip_discard //= 0;
$verbosity //= 0;
lib/Cookies/Roundtrip.pm view on Meta::CPAN
# into the specified LWP::UserAgent object, appending
# cookies to it if already some there.
# It takes in the $ffmar, $httpcookiejar and, optionally $verbosity (integer),
# and returns back the $ffmar's cookie jar (as HTTP::CookieJar object)
# If the $ffmar has no cookie jar then the supplied cookie jar will be
# first cloned and then into $ffmar.
# So the input $httpcookiejar will be independent of the one in $ffmar.
# It returns undef on failure.
# NOTE: firefox marionette will not load cookies unless we visit the site
# of the cookie domain. However, some sites redirect you if you
# do not ask for a full-path endpoint URL (e.g. www.abc.com/a/b/c
# instead of cookie domain www.abc.com. If you visit www.abc.com
# it may take you to cy.abc.com)
# So, parameter $visit_cookie_domain_first controls this
# if it is undef, then no visit is made,
# if '' (empty string) then it goes to the domain https://www.abc.com above
# if non-empty string it visits that URL instead, this is the most safe.
sub firefoxmarionette_load_httpcookiejar {
my ($ffmar, $httpcookiejar, $visit_cookie_domain_first, $skip_discard, $verbosity) = @_;
$skip_discard //= 0;
$verbosity //= 0;
( run in 0.529 second using v1.01-cache-2.11-cpan-c966e8aa7e8 )