X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2FClient.php;h=b2f5175a2b55aca18fd491b7c3389aa7875941f1;hb=852f128c8214a8be95ea66d8e07be7221ed75da9;hp=6fc8950c981de24f62d21b93c4e66f9074262b4f;hpb=320bc7777a384926f194839611a1994afa8bf222;p=plcapi.git diff --git a/src/Client.php b/src/Client.php index 6fc8950..b2f5175 100644 --- a/src/Client.php +++ b/src/Client.php @@ -776,7 +776,10 @@ class Client $connectTimeout = $timeout; } - $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, + $this->errno = 0; + $this->errstr = ''; + + $fp = stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, STREAM_CLIENT_CONNECT, $context); if ($fp) { if ($timeout > 0) { @@ -795,10 +798,8 @@ class Client $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr); return $r; - } else { - // reset errno and errstr on successful socket connection - $this->errstr = ''; } + // G. Giunta 2005/10/24: close socket before parsing. // should yield slightly better execution times, and make easier recursive calls (e.g. to follow http redirects) $ipd = ''; @@ -808,6 +809,7 @@ class Client $ipd .= fread($fp, 32768); } while (!feof($fp)); fclose($fp); + $r = $req->parseResponse($ipd, false, $this->return_type); return $r;