I have the following issue with HTTP::Cookies::Netscape when using a cookie jar generated with Linux curl: Cookies in the curl cookie jar file with the HttpOnly attribute set are written as "#HttpOnly_{Hostname}" in the file and interpreted as comments by HTTP::Cookies::Netscape, so they get ignored.
$ 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[...]
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:
#!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;
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.

In reply to curl-generated HttpOnly cookies and HTTP::Cookies::Netscape by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.