]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
LRDD blacklisted URL test
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 26 Apr 2017 21:21:13 +0000 (23:21 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 26 Apr 2017 21:21:13 +0000 (23:21 +0200)
plugins/LRDD/lib/discovery.php
plugins/LRDD/lib/lrddmethod.php

index 77271e06f697545ea1d64e58db8486f6ad114b24..a69d5b8ce214b433403e6793d4e85d2e35051f1c 100644 (file)
@@ -140,6 +140,11 @@ class Discovery
                 $xrd->loadString($response->getBody(), $type);
                 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;
index ee9a24a5da4cd364e9e340523fe9b2c701f66d17..160c0d73a21d88a2665ee6e75c2fd26d3049881a 100644 (file)
@@ -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?