From: gggeek Date: Fri, 10 Jan 2014 16:58:07 +0000 (+0100) Subject: - when using curl and keepalive, reset curl handle if we did not get back an http... X-Git-Tag: 3.0.0~14 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=13381c346af5f3e86d9fdf6c04b1cb9ca4b54a56;hp=69540b3e399387c69628c88c1f4e63fd1b2138e8;p=plcapi.git - when using curl and keepalive, reset curl handle if we did not get back an http 200 response (eg a 302) --- 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; }