W3C home > Mailing lists > Public > www-validator-cvs@w3.org > November 2011

link-checker commit: Replace some regexp uses with index().

From: Mercurial notifier <nobody@w3.org>
Date: Tue, 22 Nov 2011 22:01:54 +0000
Message-Id: <E1RSyPa-0005tI-In@mcbain.w3.org>
To: link-checker updates <www-validator-cvs@w3.org>
changeset:   412:d78f0dc4e6fb
tag:         tip
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Wed Nov 23 00:01:40 2011 +0200
files:       bin/checklink
description:
Replace some regexp uses with index().


diff -r 7dce3627a4c7 -r d78f0dc4e6fb bin/checklink
--- a/bin/checklink	Tue Nov 22 23:59:16 2011 +0200
+++ b/bin/checklink	Wed Nov 23 00:01:40 2011 +0200
@@ -649,7 +649,7 @@
     } if (MP2() && !$ENV{HTTP_AUTHORIZATION});
 
     $uri =~ s/^\s+//g;
-    if ($uri =~ /:/) {
+    if (index($uri, ":") != -1) {
         $uri = URI->new($uri);
     }
     else {
@@ -1747,10 +1747,10 @@
     $results{$uri}{location}{code} = $response->code();
     $results{$uri}{location}{code} = RC_ROBOTS_TXT()
         if ($results{$uri}{location}{code} == 403 &&
-        $response->message() =~ /Forbidden by robots\.txt/);
+        index($response->message(), "Forbidden by robots.txt") != -1);
     $results{$uri}{location}{code} = RC_IP_DISALLOWED()
         if ($results{$uri}{location}{code} == 403 &&
-        $response->message() =~ /non-public IP/);
+        index($response->message(), "non-public IP") != -1);
     $results{$uri}{location}{code} = RC_DNS_ERROR()
         if ($results{$uri}{location}{code} == 500 &&
         $response->message() =~ /Bad hostname '[^\']*'/);
Received on Tuesday, 22 November 2011 22:01:57 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:47 UTC