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;
return $this->file;
}
-}
\ No newline at end of file
+}
}
/**
- * 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;
}
/**
// Check if we have a non-canonical URL
- $finalUrl = $response->getUrl();
+ $finalUrl = $response->getEffectiveUrl();
if ($finalUrl != $profile_url) {
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
}
return self::hcardHints($response->getBody(),
- $response->getUrl());
+ $response->getEffectiveUrl());
}
static function hcardHints($body, $url)
$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);
}
throw new FeedSubBadResponseException($response->getStatus());
}
- $sourceurl = $response->getUrl();
+ $sourceurl = $response->getEffectiveUrl();
$body = $response->getBody();
if (!$body) {
throw new FeedSubEmptyException($sourceurl);
// Check if we have a non-canonical URL
- $finalUrl = $response->getUrl();
+ $finalUrl = $response->getEffectiveUrl();
if ($finalUrl != $profile_url) {
$hints['profileurl'] = $finalUrl;