link-checker commit: Use GET more eagerly to avoid some throwaway HEAD results when recursing.

changeset:   391:e0644feb2f38
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Tue Mar 22 21:27:00 2011 +0200
files:       bin/checklink
description:
Use GET more eagerly to avoid some throwaway HEAD results when recursing.


diff -r 20e62a9e944f -r e0644feb2f38 bin/checklink
--- a/bin/checklink	Tue Mar 22 21:01:43 2011 +0200
+++ b/bin/checklink	Tue Mar 22 21:27:00 2011 +0200
@@ -2165,11 +2165,10 @@
     # $links is a hash of the links in the documents checked
     # $redirects is a map of the redirects encountered
 
-    # Get the document with the appropriate method
-    # Only use GET if there are fragments. HEAD is enough if it's not the
-    # case.
+    # Get the document with the appropriate method: GET if there are
+    # fragments to check or links are wanted, HEAD is enough otherwise.
     my $fragments = $links->{$uri}{fragments} || {};
-    my $method = scalar(%$fragments) ? 'GET' : 'HEAD';
+    my $method = ($want_links || %$fragments) ? 'GET' : 'HEAD';
 
     my $response;
     my $being_processed = 0;

Received on Tuesday, 22 March 2011 20:34:02 UTC