- when using curl and keepalive, reset curl handle if we did not get back an http...
[plcapi.git] / lib / xmlrpc.inc
index 4b5341d..c3c8995 100644 (file)
@@ -1,7 +1,6 @@
 <?php\r
 // by Edd Dumbill (C) 1999-2002\r
 // <edd@usefulinc.com>\r
-// $Id: xmlrpc.inc,v 1.174 2009/03/16 19:36:38 ggiunta Exp $\r
 \r
 // Copyright (c) 1999,2000,2002 Edd Dumbill.\r
 // All rights reserved.\r
                * http://curl.haxx.se/docs/faq.html#7.3)\r
                */\r
                var $xmlrpc_curl_handle = null;\r
-               /// Wheter to use persistent connections for http 1.1 and https\r
+               /// Whether to use persistent connections for http 1.1 and https\r
                var $keepalive = false;\r
                /// Charset encodings that can be decoded without problems by the client\r
                var $accepted_charset_encodings = array();\r
                                        curl_close($curl);\r
                                }\r
                                $resp =& $msg->parseResponse($result, true, $this->return_type);\r
+                // if we got back a 302, we can not reuse the curl handle for later calls\r
+                if($resp->faultCode() == $GLOBALS['xmlrpcerr']['http_error'] && $keepalive)\r
+                {\r
+                    curl_close($curl);\r
+                    $this->xmlrpc_curl_handle = null;\r
+                }\r
                        }\r
                        return $resp;\r
                }\r