- From: Ville Skytta <ville@dev.w3.org>
- Date: Sun, 07 Nov 2004 09:47:45 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/perl/modules/W3C/LinkChecker/bin In directory hutz:/tmp/cvs-serv16001 Modified Files: checklink Log Message: Use the same W3C::UserAgent instance for all retrievals. Fixes http://www.w3.org/Bugs/Public/show_bug.cgi?id=893 Index: checklink =================================================================== RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v retrieving revision 4.9 retrieving revision 4.10 diff -u -d -r4.9 -r4.10 --- checklink 6 Nov 2004 11:39:28 -0000 4.9 +++ checklink 7 Nov 2004 09:47:43 -0000 4.10 @@ -253,6 +253,13 @@ &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}) { require Text::Wrap; @@ -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 Sunday, 7 November 2004 09:47:46 UTC