From 985f3b44b7378d95a5294b85beac6c8506810a48 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 26 Apr 2017 23:21:13 +0200 Subject: [PATCH] LRDD blacklisted URL test --- plugins/LRDD/lib/discovery.php | 7 +++++++ plugins/LRDD/lib/lrddmethod.php | 3 +++ 2 files changed, 10 insertions(+) diff --git a/plugins/LRDD/lib/discovery.php b/plugins/LRDD/lib/discovery.php index c8cf3277e2..54e40fe801 100644 --- a/plugins/LRDD/lib/discovery.php +++ b/plugins/LRDD/lib/discovery.php @@ -126,7 +126,14 @@ class Discovery $xrd->loadString($response->getBody()); return $xrd; + + } catch (ClientException $e) { + if ($e->getCode() === 403) { + common_log(LOG_INFO, sprintf('%s: Aborting discovery on URL %s: %s', _ve($class), _ve($uri), _ve($e->getMessage()))); + break; + } } catch (Exception $e) { + common_log(LOG_INFO, sprintf('%s: Failed for %s: %s', _ve($class), _ve($uri), _ve($e->getMessage()))); continue; } } diff --git a/plugins/LRDD/lib/lrddmethod.php b/plugins/LRDD/lib/lrddmethod.php index ee9a24a5da..160c0d73a2 100644 --- a/plugins/LRDD/lib/lrddmethod.php +++ b/plugins/LRDD/lib/lrddmethod.php @@ -32,6 +32,9 @@ abstract class LRDDMethod protected function fetchUrl($url, $method=HTTPClient::METHOD_GET) { + // If we have a blacklist enabled, let's check against it + Event::handle('UrlBlacklistTest', array($url)); + $client = new HTTPClient(); // GAAHHH, this method sucks! How about we make a better HTTPClient interface? -- 2.39.5