From cb46f7b2279223cadda1b9b1530e3a104f3592f1 Mon Sep 17 00:00:00 2001 From: Olaf Conradi Date: Wed, 26 Dec 2012 16:08:21 +0100 Subject: 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. --- include/network.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include') 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); -- cgit v1.2.3