summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorfox <[email protected]>2018-02-11 08:57:12 +0000
committerGogs <[email protected]>2018-02-11 08:57:12 +0000
commit1aeb282be135f1f81a8ac7d55a6b0bc538166da5 (patch)
treed0e9165c4d71ee6e49824f727aa806c2d4d19178 /include
parent2eaf2a1f3647b2593513db1dc823ad26ee4082d0 (diff)
parent7ae05ed790026d34d8958c786aafcdbceefd7f08 (diff)
Merge branch 'save-effective-url' of JustAMacUser/tt-rss into master
Diffstat (limited to 'include')
-rwxr-xr-xinclude/functions.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/functions.php b/include/functions.php
index ebf4021ae..183552437 100755
--- a/include/functions.php
+++ b/include/functions.php
@@ -11,6 +11,7 @@
$fetch_last_error_code = false;
$fetch_last_content_type = false;
$fetch_last_error_content = false; // curl only for the time being
+ $fetch_effective_url = false;
$fetch_curl_used = false;
$suppress_debugging = false;
@@ -325,6 +326,7 @@
global $fetch_last_error_content;
global $fetch_last_content_type;
global $fetch_last_modified;
+ global $fetch_effective_url;
global $fetch_curl_used;
$fetch_last_error = false;
@@ -333,6 +335,7 @@
$fetch_last_content_type = "";
$fetch_curl_used = false;
$fetch_last_modified = "";
+ $fetch_effective_url = "";
if (!is_array($options)) {
@@ -443,6 +446,8 @@
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$fetch_last_content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
+ $fetch_effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
+
$fetch_last_error_code = $http_code;
if ($http_code != 200 || $type && strpos($fetch_last_content_type, "$type") === false) {
@@ -504,6 +509,8 @@
$old_error = error_get_last();
+ $fetch_effective_url = $url;
+
$data = @file_get_contents($url, false, $context);
if (isset($http_response_header) && is_array($http_response_header)) {
@@ -519,6 +526,8 @@
// e.g. if we were being redirected -- last one is the right one
} else if ($key == 'last-modified') {
$fetch_last_modified = $value;
+ } else if ($key == 'location') {
+ $fetch_effective_url = $value;
}
}