in reply to Bug in LWP? Missing cookie
The problem is solved and I still don't fully understand HTTP::Request::Common. I had written
$res = $ua->request(POST "https://panel.dreamhost.com/index.cgi", @fields);
and that was what I have been asking you folks about -- the fields were correct but it wouldn't log in. I looked more carefully at my request and theirs and mine had a content-length of zero and theirs a content-length of 76. Then I noticed that in addition to the form fields it had a "content" of all of the form fields pushed together and HTML encoded. Poring over H::R::C I noticed there is a subtle difference between passing the array of fields and passing a ref to the array of fields. So I made one, very nonintuitive to me!, change in the request:
$res = $ua->request(POST "https://panel.dreamhost.com/index.cgi", \@fields);
and it all magically works now! I had been exploring doing the direct POST construction because for other forms I needed to include a file-upload in the Contents. Now I guess I'll use it for everything in preference to $ua->post(). Whew! Thanks for all the patience and advice.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bug in LWP? Missing cookie
by bliako (Abbot) on Aug 05, 2018 at 12:23 UTC | |
by BernieC (Pilgrim) on Aug 05, 2018 at 15:58 UTC | |
by AnomalousMonk (Archbishop) on Aug 05, 2018 at 18:18 UTC | |
by bliako (Abbot) on Aug 05, 2018 at 22:32 UTC | |
by ikegami (Patriarch) on Aug 05, 2018 at 23:33 UTC |