I'm trying to access the home page at dreamhost.com and after a bunch of trying to figure out why I can't submit its form I've discovered why: Dreamhost sends me two cookies, but LWP only "jars" one of them. My access the page codes looks like

#!/usr/bin/perl use strict; use warnings ; use LWP::UserAgent () ; use HTTP::Cookies ; use Data::Dumper ; my $ua = LWP::UserAgent->new ; $ua->agent("Mozilla/5.0") ; my $cookies = HTTP::Cookies->new(file => "$ENV{APPDATA}/cookies.txt", autosave => 1, ignore_discard => 1) ; $ua->cookie_jar($cookies) ; my $res = $ua->get("https://panel.dreamhost.com/") ; print Dumper($cookies->get_cookies("https://panel.dreamhost.com/")); exit ;

and when I run it I get

d:\Desktop\Dreamhost>testcookies $VAR1 = { 'sh' => 'uPpLKaEsFiu0wKyBBTpfzTxRjsS9eJOOXl3AK-nUNm9viXXJ0rA +-ECZrwOwf };
BUT.. when I use Web Developer to access the same page, it tells me:

Request cookies: csrf wHvDOzh6BPebWCZiSvaTTZXVa-s1avJR sh i5OG_QmjNcIDJjd8y3vFzRCiQTT4HQvvPKkFre7lbFN5ntZbu3huRUiG-841

and sure enough, when I try to submit the login form with my browser I find

POST /index.cgi HTTP/1.1 Host: panel.dreamhost.com User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:61.0) Gecko/20 +100101 Firefox/61.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0. +8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate, br Referer: https://panel.dreamhost.com/ Content-Type: application/x-www-form-urlencoded Content-Length: 80 Cookie: sh=i5OG_QmjNcIDJjd8y3vFzRCiQTT4HQvvPKkFre7lbFN5ntZbu3huRUiG-84 +1; csrf=6tX7UCZ-XZ1KL8Z1Q9mPmp9dBIeXXdoO DNT: 1 Connection: keep-alive Upgrade-Insecure-Requests: 1

Any insights into why UserAgent isn't grabbing the csrf cookie {and what I might do to make it happen}?

Thanks! /bernie\


In reply to Bug in LWP? Missing cookie by BernieC

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.