]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/LRDD/lib/discovery.php
LRDD blacklisted URL test
[quix0rs-gnu-social.git] / plugins / LRDD / lib / discovery.php
index 9825ea3cb76b66947c62019a5bbbfd3ae8603d53..54e40fe80110980b9d049cbf58e786fc4e3fa789 100644 (file)
@@ -37,6 +37,7 @@ if (!defined('GNUSOCIAL')) { exit(1); }
 class Discovery
 {
     const LRDD_REL    = 'lrdd';
+    const UPDATESFROM = 'http://schemas.google.com/g/2010#updates-from';
     const HCARD       = 'http://microformats.org/profile/hcard';
     const MF2_HCARD   = 'http://microformats.org/profile/h-card';   // microformats2 h-card
 
@@ -92,6 +93,8 @@ class Discovery
         // Normalize the incoming $id to make sure we have a uri
         $uri = self::normalize($id);
 
+        common_debug(sprintf('Performing discovery for "%s" (normalized "%s")', $id, $uri));
+
         foreach ($this->methods as $class) {
             try {
                 $xrd = new XML_XRD();
@@ -123,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;
             }
         }