Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
As you can see the cookie is stored with a "#HttpOnly_" prefix in the cookie file above by curl. Feeding that file to HTTP::Cookies::Netscape for example like this will not produce any output as the line is treated as a comment:$ curl -I https://auth.example.com --cookie-jar ./cookie.txt --basic - +-user somedude 200 OK [...] Set-Cookie: session=mdkfUHAUnjdfj[...] path=/; expires=Sat, 15 Apr 201 +7 04:08:35 -0000; secure; HttpOnly [...] $ cat ./cookie.txt # Netscape HTTP Cookie File # https://curl.haxx.se/docs/http-cookies.html # This file was generated by libcurl! Edit at your own risk. #HttpOnly_auth.example.com FALSE / TRUE 1492227302 sess +ion mdkfUHAUnjdfj[...]
Removing the "#HttpOnly_" prefix in the cookie file will however work fine. Is there a way to make HTTP::Cookies::Netscape work with these curl-generated HttpOnly cookies without modifying the original cookie file? Thanks in advance.#!env perl use HTTP::Cookies::Netscape; my $cookies_file = defined($ARGV[0]) ? $ARGV[0] : exit ; my $Netscape_cookie_jar = HTTP::Cookies::Netscape->new( file => $cooki +es_file ); print $Netscape_cookie_jar->as_string;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: curl-generated HttpOnly cookies and HTTP::Cookies::Netscape
by robby_dobby (Hermit) on Apr 14, 2017 at 08:34 UTC | |
|
Re: curl-generated HttpOnly cookies and HTTP::Cookies::Netscape
by RonW (Parson) on Apr 19, 2017 at 00:35 UTC |