From c2b52cebab8068923da3b56beac011dd0d6fee97 Mon Sep 17 00:00:00 2001 From: Banana Date: Fri, 17 Feb 2012 16:41:53 +0100 Subject: [PATCH] linkchecker... --- lib/Insipid/Main.pm | 2 +- lib/Insipid/Stats.pm | 2 +- tools/linkcheck.pl | 21 +++++++++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/Insipid/Main.pm b/lib/Insipid/Main.pm index e966dae..12e7663 100755 --- a/lib/Insipid/Main.pm +++ b/lib/Insipid/Main.pm @@ -1231,7 +1231,7 @@ sub update_bookmark { set url = ?, md5 = ?, title = ?, description = ?, access_level = ?, linkcheck_status = 1, - linkcheck_status = '', + linkcheck_status = '' where (id = ?)"; my $sth = $dbh->prepare($sql); $sth->execute($url, md5_hex("$url"), $title, $description, $access_level, diff --git a/lib/Insipid/Stats.pm b/lib/Insipid/Stats.pm index d151bf0..2656f1b 100644 --- a/lib/Insipid/Stats.pm +++ b/lib/Insipid/Stats.pm @@ -73,7 +73,7 @@ sub groupByDomain { my $uri = URI->new($row[1]); if($row[2] eq 0) { - print "
  • ".$row[1]."
  • "; + print "
  • ".$row[1]." (delete)
  • "; } if($domainGroup{$uri->host}) { diff --git a/tools/linkcheck.pl b/tools/linkcheck.pl index 8cb9614..c6c224c 100755 --- a/tools/linkcheck.pl +++ b/tools/linkcheck.pl @@ -18,10 +18,19 @@ # USA # + +# +# check exiting bookmark entries if they are available +# ssl entries will not be checked... +# if they return a non 200 HTTP Status code they will be marked and visible +# in the stats overview +# + use warnings; use strict; use Getopt::Long; use DBI; +use Crypt::SSLeay; use LWP::UserAgent; BEGIN { @@ -67,7 +76,11 @@ if($sth->rows ne 0) { $ua->timeout(5); $ua->show_progress(1); $ua->agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11"); - $ua->proxy(['http'], $opt_proxy) if $opt_proxy; + + $ua->proxy([ 'http', 'https' ], $opt_proxy) if $opt_proxy; + + $ua->ssl_opts('verify_hostname' => 0); + $ua->protocols_allowed(undef); # all are allowed $query = "UPDATE `$tbl_bookmarks` SET `linkcheck_status` = ?, @@ -78,7 +91,11 @@ if($sth->rows ne 0) { while (my $hr = $sth->fetchrow_hashref) { print $hr->{url}." "; - my $response = $ua->head($hr->{url}); + # ssl not working correctly so avoid those bookmarks + next if $hr->{url} =~ m/https:/g; + + #my $response = $ua->head($hr->{url}); + my $response = $ua->get($hr->{url}); my $status = 0; if ($response->is_success) { -- 2.39.5