From 13381c346af5f3e86d9fdf6c04b1cb9ca4b54a56 Mon Sep 17 00:00:00 2001 From: gggeek Date: Fri, 10 Jan 2014 17:58:07 +0100 Subject: [PATCH] - when using curl and keepalive, reset curl handle if we did not get back an http 200 response (eg a 302) --- ChangeLog | 4 ++++ lib/xmlrpc.inc | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 336265c..b0e65e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-01-10 - G. Giunta (giunta.gaetano@gmail.com) + + * xmlrpc.inc: when using curl and keepalive, reset curl handle if we did not get back an http 200 response (eg a 302) + 2010-05-23 - G. Giunta (giunta.gaetano@gmail.com) * xmlrpc.inc: omit port on http 'Host' header if it is 80; diff --git a/lib/xmlrpc.inc b/lib/xmlrpc.inc index 5b39a26..c3c8995 100644 --- a/lib/xmlrpc.inc +++ b/lib/xmlrpc.inc @@ -850,7 +850,7 @@ * http://curl.haxx.se/docs/faq.html#7.3) */ var $xmlrpc_curl_handle = null; - /// Wheter to use persistent connections for http 1.1 and https + /// Whether to use persistent connections for http 1.1 and https var $keepalive = false; /// Charset encodings that can be decoded without problems by the client var $accepted_charset_encodings = array(); @@ -1701,6 +1701,12 @@ curl_close($curl); } $resp =& $msg->parseResponse($result, true, $this->return_type); + // if we got back a 302, we can not reuse the curl handle for later calls + if($resp->faultCode() == $GLOBALS['xmlrpcerr']['http_error'] && $keepalive) + { + curl_close($curl); + $this->xmlrpc_curl_handle = null; + } } return $resp; } -- 2.43.0