]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Use the upstream function to get effectiveUrl
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 13 Jan 2016 13:00:05 +0000 (14:00 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 13 Jan 2016 13:00:05 +0000 (14:00 +0100)
classes/File_redirection.php
lib/httpclient.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/OStatus/lib/discoveryhints.php
plugins/OStatus/lib/feeddiscovery.php
plugins/OStatus/scripts/update_ostatus_profiles.php

index 03df3de1b1153e8e8a496b07eaeb8e1c08f0134b..93cc640d34180f9ee12e2d44df4f7c58b2503a14 100644 (file)
@@ -127,14 +127,14 @@ class File_redirection extends Managed_DataObject
             return $short_url;
         }
 
-        if ($response->getRedirectCount() && File::isProtected($response->getUrl())) {
+        if ($response->getRedirectCount() && File::isProtected($response->getEffectiveUrl())) {
             // Bump back up the redirect chain until we find a non-protected URL
             return self::lookupWhere($short_url, $response->getRedirectCount() - 1, true);
         }
 
         $ret = array('code' => $response->getStatus()
                 , 'redirects' => $response->getRedirectCount()
-                , 'url' => $response->getUrl());
+                , 'url' => $response->getEffectiveUrl());
 
         $type = $response->getHeader('Content-Type');
         if ($type) $ret['type'] = $type;
@@ -397,4 +397,4 @@ class File_redirection extends Managed_DataObject
 
         return $this->file;
     }
-}
\ No newline at end of file
+}
index dce8e821ff4714660c52d16265b8d9178ac90c7b..98e5d0426b74627f9d15502a6e2cb0d700fd9eb5 100644 (file)
@@ -75,12 +75,12 @@ class GNUsocial_HTTPResponse extends HTTP_Request2_Response
     }
 
     /**
-     * Gets the final target URL, after any redirects have been followed.
+     * Gets the target URL, before any redirects. Use getEffectiveUrl() for final target.
      * @return string URL
      */
     function getUrl()
     {
-        return $this->effectiveUrl;
+        return $this->url;
     }
 
     /**
index d36cbe21d66c902579e680224cfa2d0a967da3d5..e3802ea94c677be39ca93793794bf472b53707a5 100644 (file)
@@ -632,7 +632,7 @@ class Ostatus_profile extends Managed_DataObject
 
         // Check if we have a non-canonical URL
 
-        $finalUrl = $response->getUrl();
+        $finalUrl = $response->getEffectiveUrl();
 
         if ($finalUrl != $profile_url) {
 
@@ -649,7 +649,7 @@ class Ostatus_profile extends Managed_DataObject
             preg_replace('/\s*;.*$/', '', $response->getHeader('Content-Type')),
             array('application/rss+xml', 'application/atom+xml', 'application/xml', 'text/xml'))
         ) {
-            $hints['feedurl'] = $response->getUrl();
+            $hints['feedurl'] = $response->getEffectiveUrl();
         } else {
             // Try to get some hCard data
 
index 2a1309d33f41e95649615feea0ab0fc50cfee738..d95bd8e78fca88035afeb9094bee76411f6985c4 100644 (file)
@@ -70,7 +70,7 @@ class DiscoveryHints {
         }
 
         return self::hcardHints($response->getBody(),
-                                $response->getUrl());
+                                $response->getEffectiveUrl());
     }
 
     static function hcardHints($body, $url)
index e9c710bebdbbfa5010c4582cec6ff7a66c5b585e..84933e196b45cce578bf800732b46d05da9d5807 100644 (file)
@@ -127,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);
                 }
@@ -149,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);
index 3f54c83cda1ec3da4f121509d043d814f0e2cf5f..45ee856264b44938d88f40647b75e615fe790a70 100755 (executable)
@@ -74,7 +74,7 @@ class LooseOstatusProfile extends Ostatus_profile
 
         // Check if we have a non-canonical URL
 
-        $finalUrl = $response->getUrl();
+        $finalUrl = $response->getEffectiveUrl();
 
         if ($finalUrl != $profile_url) {
             $hints['profileurl'] = $finalUrl;