aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlaf Conradi <olaf@conradi.org>2012-12-26 16:08:21 +0100
committerOlaf Conradi <olaf@conradi.org>2012-12-26 16:08:21 +0100
commitcb46f7b2279223cadda1b9b1530e3a104f3592f1 (patch)
tree678c2f05e1ae49cb186473c5ce0ef5618434696d
parent414f7ccc0085a5bec40323847b6a8819fc6eefca (diff)
downloadvolse-hubzilla-cb46f7b2279223cadda1b9b1530e3a104f3592f1.tar.gz
volse-hubzilla-cb46f7b2279223cadda1b9b1530e3a104f3592f1.tar.bz2
volse-hubzilla-cb46f7b2279223cadda1b9b1530e3a104f3592f1.zip
POST redirects to POST on 308 only
POST redirects to POST on 308 only, 301-307 to GET. Side-effect is that POST params get dropped for GET.
-rw-r--r--include/network.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/network.php b/include/network.php
index 5571285b4..2180e44aa 100644
--- a/include/network.php
+++ b/include/network.php
@@ -172,7 +172,11 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
if (isset($url_parsed)) {
$redirects++;
@curl_close($ch);
- return post_url($newurl,false,$redirects,$timeout);
+ if($http_code == 308) {
+ return post_url($newurl,$params,$redirects,$timeout);
+ } else {
+ return fetch_url($newurl,false,$redirects,$timeout);
+ }
}
}
$a->set_curl_code($http_code);
@@ -351,7 +355,11 @@ function z_post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0
if (isset($url_parsed)) {
$redirects++;
curl_close($ch);
- return z_post_url($newurl,$params,$headers,$redirects,$timeout);
+ if($http_code == 308) {
+ return z_post_url($newurl,$params,$headers,$redirects,$timeout);
+ } else {
+ return z_fetch_url($newurl,false,$headers,$redirects,$timeout);
+ }
}
}
$rc = intval($http_code);