Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 1872
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: afsmith [...] hotjobs.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: WWW-Mechanize and redirects http/https
Hello, This is pretty minor and a fairly uniqe situation but strange to me anyhow. It works fine with other sites but, I have a redirection situation that I have to check from http to https. Below are two sample scripts. The first using WWW::Mechanize returns status 500, The second useing LWP::UserAgent Works fine. Cheers Andrew Smith Show quoted text
_________________________________________________________________________ #!/usr/bin/perl -w use strict; use WWW::Mechanize; my $url = 'http:/web08.hj.scd.yahoo.com' ; my $agent = WWW::Mechanize->new( agent => "Mozilla/*." ); &geturl; &printStuff; sub geturl { $agent->get($url) or die "could not open $url"; print "we made it here $url \n" ; } sub printStuff { print "content $agent->{content}\n\n"; print "$agent->{status}\n\n"; }
__________________________________________________________________________ #!/usr/bin/perl -w use strict; use LWP::UserAgent; my $link = 'https://web08.hj.scd.yahoo.com'; &getPage; sub getPage { my $ua = LWP::UserAgent->new; # $ua->agent("$0/0.1 " . $ua->agent); $ua->agent("Mozilla/8.0"); # pretend we are very capable browser my $req = HTTP::Request->new(GET => "$link"); $req->header('Accept' => 'text/html'); # send request my $res = $ua->request($req); # check the outcome if ($res->is_success) { print $res->code ; # print $res->content; } else { print "Error: " . $res->status_line . "\n"; } }
__________________________________________________________________________
I'm guessing that the problem between these two is: Show quoted text
> my $url = 'http:/web08.hj.scd.yahoo.com' ; > my $link = 'https://web08.hj.scd.yahoo.com';
The first one only has a single slash after http: I tried the first script with the single slash, and got the error you did, too. Added the second slash, and it ran fine. If this isn't the case, I'll reopen the ticket.