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
BUT.. when I use Web Developer to access the same page, it tells me:d:\Desktop\Dreamhost>testcookies $VAR1 = { 'sh' => 'uPpLKaEsFiu0wKyBBTpfzTxRjsS9eJOOXl3AK-nUNm9viXXJ0rA +-ECZrwOwf };
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |