develooper Front page | perl.libwww | Postings from April 2001

Patch for two WWW::RobotRules bugs

Thread Next
From:
Liam Quinn
Date:
April 20, 2001 10:18
Subject:
Patch for two WWW::RobotRules bugs
Message ID:
Pine.LNX.4.30.0104201305400.961-200000@localhost.localdomain
--- RobotRules.pm.orig	Sat Apr 22 22:43:38 2000
+++ RobotRules.pm	Fri Apr 20 12:28:29 2001
@@ -83,7 +83,7 @@
 sub parse {
     my($self, $robot_txt_uri, $txt, $fresh_until) = @_;
     $robot_txt_uri = URI->new("$robot_txt_uri");
-    my $netloc = $robot_txt_uri->authority;
+    my $netloc = $robot_txt_uri->host . ":" . $robot_txt_uri->port;
 
     $self->clear_rules($netloc);
     $self->fresh_until($netloc, $fresh_until || (time + 365*24*3600));
@@ -173,7 +173,7 @@
 sub is_me {
     my($self, $ua) = @_;
     my $me = $self->agent;
-    return index(lc($ua), lc($me)) >= 0;
+    return index(lc($me), lc($ua)) >= 0;
 }
 
 =item $rules->allowed($uri)
@@ -185,7 +185,7 @@
 sub allowed {
     my($self, $uri) = @_;
     $uri = URI->new("$uri");
-    my $netloc = $uri->authority;
+    my $netloc = $uri->host . ":" . $uri->port;
 
     my $fresh_until = $self->fresh_until($netloc);
     return -1 if !defined($fresh_until) || $fresh_until < time;

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About