in reply to WWW::Mechanize Cookie debugging

I think that the problem is with LWP. I kept having problems with "add_cookie_header" every time I tried to get, so I added a couple of handlers. Here's what I did.
#!/usr/bin/perl use strict; use warnings; use LWP; use WWW::Scripter; use HTTP::Cookies; my $cookie_file = '/root/Desktop/cookie_jar.dat'; my $cookie_jar = HTTP::Cookies->new( file => $cookie_file, autosave => 1 ); my $ua = LWP::UserAgent->new; $ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodable()); $ua->add_handler("request_send", sub { shift->dump; return }); $ua->add_handler("response_done", sub { shift->dump; return }); $ua->cookie_jar($cookie_jar); $ua->get('http://www.kcra.com');
Don't forget to delete the cookie_jar.dat. The cookie expires in 10 years:).

Replies are listed 'Best First'.
Re^2: WWW::Mechanize Cookie debugging
by GaijinPunch (Pilgrim) on Jul 01, 2011 at 11:51 UTC
    Thanks, but I've still got the same error. I ran Wireshark and am seeing 'roughly' the same stuff being sent. Specifically, the cookies are sent which is curious. However, there's one that looks different:

    When I load the page in Firefox or Chrome, It shows I'm sending 'Connection: keep-alive'. In my script, I'm sending 'TE: deflate,gzip;q=0.3' which I'm not sending at all in a browser, along with 'Connection: keep-alive, TE, close'. That is the only difference I can find now. :(