]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/lib/feeddiscovery.php
Debugging log fix.
[quix0rs-gnu-social.git] / plugins / OStatus / lib / feeddiscovery.php
index 8a166a0be56f339d0aeb54cfb08629aef15ae83c..02c3ce02122940ebe91a7e2847f287f4962438bf 100644 (file)
@@ -22,7 +22,9 @@
  * @maintainer Brion Vibber <brion@status.net>
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET')) {
+    exit(1);
+}
 
 class FeedSubBadURLException extends FeedSubException
 {
@@ -48,6 +50,10 @@ class FeedSubNoFeedException extends FeedSubException
 {
 }
 
+class FeedSubNoSalmonException extends FeedSubException
+{
+}
+
 class FeedSubBadXmlException extends FeedSubException
 {
 }
@@ -112,7 +118,7 @@ class FeedDiscovery
         try {
             $client = new HTTPClient();
             $response = $client->get($url);
-        } catch (HTTP_Request2_Exception $e) {
+        } catch (Exception $e) {
             common_log(LOG_ERR, __METHOD__ . " Failure for $url - " . $e->getMessage());
             throw new FeedSubBadURLException($e->getMessage());
         }
@@ -121,7 +127,7 @@ class FeedDiscovery
             $type = $response->getHeader('Content-Type');
             $isHtml = preg_match('!^(text/html|application/xhtml\+xml)!i', $type);
             if ($isHtml) {
-                $target = $this->discoverFromHTML($response->getUrl(), $response->getBody());
+                $target = $this->discoverFromHTML($response->getEffectiveUrl(), $response->getBody());
                 if (!$target) {
                     throw new FeedSubNoFeedException($url);
                 }
@@ -143,7 +149,7 @@ class FeedDiscovery
             throw new FeedSubBadResponseException($response->getStatus());
         }
 
-        $sourceurl = $response->getUrl();
+        $sourceurl = $response->getEffectiveUrl();
         $body = $response->getBody();
         if (!$body) {
             throw new FeedSubEmptyException($sourceurl);