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

link-checker commit: Use the same W3C::UserAgent instance for all retrievals.

From: Mercurial notifier <nobody@w3.org>
Date: Thu, 05 Aug 2010 14:47:01 +0000
To: link-checker updates <www-validator-cvs@w3.org>
Message-Id: <E1Oh1in-0005hK-Qv@blinky.w3.org>
changeset:   106:44f0a26e31bc
user:        ville
date:        Sun Nov 07 09:47:43 2004 +0000
files:       bin/checklink
description:
Use the same W3C::UserAgent instance for all retrievals.
Fixes http://www.w3.org/Bugs/Public/show_bug.cgi?id=893


diff -r af56785d43b6 -r 44f0a26e31bc bin/checklink
--- a/bin/checklink	Sat Nov 06 11:39:28 2004 +0000
+++ b/bin/checklink	Sun Nov 07 09:47:43 2004 +0000
@@ -5,7 +5,7 @@
 # (c) 1999-2004 World Wide Web Consortium
 # based on Renaud Bruyeron's checklink.pl
 #
-# $Id: checklink,v 4.9 2004-11-06 11:39:28 ville Exp $
+# $Id: checklink,v 4.10 2004-11-07 09:47:43 ville Exp $
 #
 # This program is licensed under the W3C(r) Software License:
 #       http://www.w3.org/Consortium/Legal/copyright-software
@@ -109,7 +109,7 @@
   $PACKAGE       = 'W3C Link Checker';
   $PROGRAM       = 'W3C-checklink';
   $VERSION       = '4.0';
-  my ($cvsver)   = q$Revision: 4.9 $ =~ /(\d+[\d\.]*\.\d+)/;
+  my ($cvsver)   = q$Revision: 4.10 $ =~ /(\d+[\d\.]*\.\d+)/;
   $REVISION      = sprintf('version %s [%s] (c) 1999-2004 W3C',
                            $VERSION, $cvsver);
   $AGENT         = sprintf('%s/%s [%s] %s',
@@ -252,6 +252,13 @@
   eval { $Opts{Trusted} = qr/$Opts{Trusted}/io; };
   &usage(1, "Error in trusted domains regexp: $@") if $@;
 }
+
+my $ua = W3C::UserAgent->new($AGENT); # @@@ TODO: admin address
+# @@@ make number of keep-alive connections customizable
+$ua->conn_cache({ total_capacity => 1}); # 1 keep-alive connection
+$ua->delay($Opts{Sleep_Time}/60);
+$ua->timeout($Opts{Timeout});
+$ua->proxy('http', 'http://' . $Opts{HTTP_Proxy}) if $Opts{HTTP_Proxy};
 
 if ($Opts{Command_Line}) {
 
@@ -985,12 +992,6 @@
   $start = &get_timestamp() unless defined($start);
 
   # Prepare the query
-  my $ua = W3C::UserAgent->new($AGENT); # @@@ TODO: admin address
-  # @@@ make number of keep-alive connections customizable
-  $ua->conn_cache({ total_capacity => 1}); # 1 keep-alive connection
-  $ua->delay($Opts{Sleep_Time}/60);
-  $ua->timeout($Opts{Timeout});
-  $ua->proxy('http', 'http://' . $Opts{HTTP_Proxy}) if $Opts{HTTP_Proxy};
 
   # Do we want printouts of progress?
   my $verbose_progress =
@@ -1024,8 +1025,7 @@
   # Get the results
   # Record the very first response
   if (! defined($code)) {
-    $code = $ua->{FirstResponse};
-    $message = $ua->{FirstMessage};
+    ($code, $message) = delete(@$ua{qw(FirstResponse FirstMessage)});
   }
   # Authentication requested?
   if ($response->code() == 401 &&
Received on Thursday, 5 August 2010 14:47:12 UTC

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