in reply to Re: LWP and Site Logins
in thread LWP and Site Logins
First, when I capture the actual web traffic, it's the same (almost) for both my browser, and for LWP, except that the packets captured by Ethereal when using the browser suddenly stop in the middle of the transmission. With LWP, you see the entire first web page; with the browser (Firefox 2), it ends like this:
Consistently, it cuts off receiving after "redire" in Firefox, although it receives the entire TCP stream when using Internet Explorer. This is not a cache issue; I cleared the cache before trying with both browsers.function yadda(... // check for redirection return redirectCheck(pluginFound, redire
Second, LWP handles the redirect automatically - as evidenced by the fact that, although the headers that Ethereal sees say
LWP's $response->status_line returns only "200 OK". However, that "200 OK" response is not captured by Ethereal. My program receives it, but Ethereal claims it's never been received over port 80. AND, LWP does not receive the redirected page in the response. Neither does the response contain the original page. The response that LWP saves is some third page, neither the original, nor the page redirected to.HTTP/1.1 302 Object Temporarily Moved Connection: close Date: Sun, 01 Jul 2007 03:53:25 GMT Server: Microsoft-IIS/6.0 location: https://<...etc>
Third, the web browser continues on to display the next webpage, even though no more traffic was captured by Ethereal.
The code looks like this:
Am I supposed to use LWP::Redirect? I find there is a module of that name, but no documentation mentions it.my $ua = LWP::UserAgent->new( requests_redirectable => [ 'GET', 'HEAD', 'POST' ] ); ... $response = $ua->get($uri, @headers); # Handle redirects # This code never actually executes - LWP does it automati +cally # That's why you never see the redirect message while ($response->is_redirect) { my $location = $response->header("location"); print " "x$level . "Redirected to $location\n"; $response = $ua->get($location); } $page = $response->content; $success = $response->is_success; if (!$success) { print "LWP ERR: " . $response->status_line . "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: LWP and Site Logins
by LTjake (Prior) on Jul 01, 2007 at 14:18 UTC |