Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: LWP Cookies in Perl 5.8

by dataDrone (Acolyte)
on Jun 27, 2003 at 01:52 UTC ( [id://269445]=note: print w/replies, xml ) Need Help??


in reply to LWP Cookies in Perl 5.8

Ok so.... FYI, I upgraded to ActiveState build 806 of perl 5.8.0 and still the same problem. I'm guessing that it's something in the actual cookie header that is thwarting HTTP::Cookies's attempts to process the cookie. I've successfully traversed the maze all the way to Wit's End. here is the test case code and the exact output ( first on Windows Perl 5.8.0 build 806, then on RedHat Linux Perl 5.6.1 then again on Windows perl 5.6.1 build 631.
#!/usr/bin/perl -w use strict; use LWP; use HTTP::Cookies; use Data::Dumper; my $oper = shift; my $user = 'user'; my $pword = 'pasword'; my $cj = HTTP::Cookies->new; my $ua = LWP::UserAgent->new; $ua->cookie_jar( $cj ); # A place to hold the cookies from ET +SS BO's $ua->agent("PerlWebBot/1.0 "); # Create a request my $req = HTTP::Request->new(POST => 'http://xmes.mydomain.com/pack/ +usermgr'); $req->content_type('application/x-www-form-urlencoded'); $req->content("operation=authenticateUser&userid=$user"."&password=$ +pword"); # Pass request to the user agent and get a response back my $res = $ua->request($req); # Check the outcome of the response if ($res->is_success) { print "Got something back...\n"; } else { print "Unable to contact server \n"; } print "LWP Version -> " , $LWP::VERSION , "\n"; print "Cookie Cutter -> " , $HTTP::Cookies::VERSION , "\n"; print $res->headers()->as_string() , "\n\n"; print Dumper($ua->cookie_jar() ) ; ----------------------------------------------------- results: D:\code>wipit.pl Got something back... LWP Version ->5.69 Cookie cutter -> 1.30 Connection: close Date: Fri, 27 Jun 2003 01:49:30 GMT Server: Apache/1.3.14 (Unix) tomcat/1.0 Content-Type: text/plain Client-Date: Fri, 27 Jun 2003 05:49:36 GMT Client-Peer: 9.61.8.22:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked Set-Cookie: member=QkFERVJEICB8KioqKioqKip8MTA1NjY3ODU3MXxXRVNUfDE0MzI +2fEVTVDVFRFR8VVN8ZW58OS42Ni4xNzQuMjAzfDc 0MTAzOHw=; expires=Fri, 27-Jun-2003 02:09:31 GMT; path=/; domain=btv.i +bm.com; $VAR1 = bless( { 'COOKIES' => { '.btv.ibm.com' => { '/' => {} } } }, 'HTTP::Cookies' ); Linux:----------- Got something back... LWP Version ->5.69 Cookie cutter -> 1.30 Connection: close Date: Fri, 27 Jun 2003 01:29:41 GMT Server: Apache/1.3.14 (Unix) tomcat/1.0 Content-Type: text/plain Client-Date: Fri, 27 Jun 2003 01:29:28 GMT Client-Peer: 9.61.8.22:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked Set-Cookie: member=QkFERVJEICB8KioqKioqKip8MTA1NjY3NzM4MnxXRVNUfDE0ODI +4fEVTVDVFRFR8VVN8ZW58OS42Ni4xNzUuMTk3fDc 0MTAzOHw=; expires=Fri, 27-Jun-2003 01:49:42 GMT; path=/; domain=btv.i +bm.com; $VAR1 = bless( { 'COOKIES' => { '.btv.ibm.com' => { '/' => { 'member' +=> [ + 0, + 'QkFERVJEICB8KioqKioqKip8MTA1NjY3Nz M4MnxXRVNUfDE0ODI4fEVTVDVFRFR8VVN8ZW58OS42Ni4xNzUuMTk3fDc0MTAzOHw=', + undef, + '1', + undef, + '1056678582' + ] } } } }, 'HTTP::Cookies' ); Window Perl 5.6.1 ---------------------- Got something back... LWP Version ->5.51 Cookie cutter -> 1.14 Connection: close Date: Fri, 27 Jun 2003 01:36:56 GMT Server: Apache/1.3.14 (Unix) tomcat/1.0 Content-Type: text/plain Client-Date: Fri, 27 Jun 2003 01:43:09 GMT Client-Peer: 9.61.8.22:80 Set-Cookie: member=QkFERVJEICB8KioqKioqKip8MTA1NjY3NzgxN3xXRVNUfDMyMjI +3fEVTVDVFRFR8VVN8ZW58OS42Ni4xNzUuMTR8NzQ xMDM4fA==; expires=Fri, 27-Jun-2003 01:56:57 GMT; path=/; domain=btv.ibm.com; $VAR1 = bless( { 'COOKIES' => { '.btv.ibm.com' => { '/' => { 'member' +=> [ + 0, + 'QkFERVJEICB8KioqKioqKip8MTA1NjY3NzgxN3xXRVNU fDMyMjI3fEVTVDVFRFR8VVN8ZW58OS42Ni4xNzUuMTR8NzQxMDM4fA==', + undef, + '1', + undef, + '1056679017' + ] } } } }, 'HTTP::Cookies' );

Replies are listed 'Best First'.
Re: Re: LWP Cookies in Perl 5.8
by dataDrone (Acolyte) on Jun 27, 2003 at 02:34 UTC
    Using use LWP::Debug qw(+); i get the following, but i'm still not seeing any smoking gun here.
    LWP::UserAgent::new: () LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking etss.btv.ibm.com for cookie +s HTTP::Cookies::add_cookie_header: Checking .btv.ibm.com for cookies HTTP::Cookies::add_cookie_header: Checking btv.ibm.com for cookies HTTP::Cookies::add_cookie_header: Checking .ibm.com for cookies HTTP::Cookies::add_cookie_header: Checking ibm.com for cookies HTTP::Cookies::add_cookie_header: Checking .com for cookies LWP::UserAgent::send_request: POST http://etss.btv.ibm.com/xmes/pack/u +sermgr LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 376 bytes HTTP::Cookies::extract_cookies: Set cookie member => QkFERVJEICB8KioqK +ioqKip8MTA1NjY4MDQxNnxXRVNUfDE2OTM3fEVTV DVFRFR8VVN8ZW58OS42Ni4xNzQuMjAzfDc0MTAzOHw= LWP::UserAgent::request: Simple response: OK Got something back... LWP Version ->5.69 Cookie cutter -> 1.30 Connection: close Date: Fri, 27 Jun 2003 02:20:16 GMT Server: Apache/1.3.14 (Unix) tomcat/1.0 Content-Type: text/plain Client-Date: Fri, 27 Jun 2003 06:20:22 GMT Client-Peer: 9.61.8.22:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked Set-Cookie: member=QkFERVJEICB8KioqKioqKip8MTA1NjY4MDQxNnxXRVNUfDE2OTM +3fEVTVDVFRFR8VVN8ZW58OS42Ni4xNzQuMjAzfDc 0MTAzOHw=; expires=Fri, 27-Jun-2003 02:40:16 GMT; path=/; domain=btv.i +bm.com;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://269445]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-25 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found