W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2010

perl/modules/W3C/LinkChecker/bin checklink,4.192,4.193

From: Ville Skytta via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 11 Mar 2010 17:54:35 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Npmah-0005dZ-1A@lionel-hutz.w3.org>
Update of /sources/public/perl/modules/W3C/LinkChecker/bin
In directory hutz:/tmp/cvs-serv21618/bin

Modified Files:
	checklink 
Log Message:
Make forbidden protocols configurable (#29).

Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 4.192
retrieving revision 4.193
diff -u -d -r4.192 -r4.193
--- checklink	11 Mar 2010 17:13:42 -0000	4.192
+++ checklink	11 Mar 2010 17:54:32 -0000	4.193
@@ -91,7 +91,6 @@
 
     $self->allow_private_ips(1);
 
-    # TODO: bug 29
     $self->protocols_forbidden([qw(mailto javascript)]);
 
     return $self;
@@ -502,6 +501,13 @@
 EOF
 }
 
+# Add configured forbidden protocols
+if ($Cfg{Forbidden_Protocols}) {
+    my $forbidden = $ua->protocols_forbidden();
+    push(@$forbidden, split(/[,\s]+/, lc($Cfg{Forbidden_Protocols})));
+    $ua->protocols_forbidden($forbidden);
+}
+
 if ($Opts{Command_Line}) {
 
     require Text::Wrap;
@@ -568,7 +574,7 @@
     require CGI::Cookie;
 
     # file: URIs are not allowed in CGI mode
-    my $forbidden = $ua->protocols_forbidden() || [];
+    my $forbidden = $ua->protocols_forbidden();
     push(@$forbidden, 'file');
     $ua->protocols_forbidden($forbidden);
 
Received on Thursday, 11 March 2010 17:54:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:19 GMT