X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2FHelper%2FHttp.php;h=2faf58333f614c62b28f3425a193fdf09c9b0886;hb=cc67a43993662a5a3f92801b96b89ee6e3998532;hp=141cfe40a984f15b754b04d102f7935862e2ee3d;hpb=b081e4541f5728a5f18d15832f0b72e2e133aad2;p=plcapi.git diff --git a/src/Helper/Http.php b/src/Helper/Http.php index 141cfe4..2faf583 100644 --- a/src/Helper/Http.php +++ b/src/Helper/Http.php @@ -7,9 +7,8 @@ use PhpXmlRpc\PhpXmlRpc; class Http { /** - * Decode a string that is encoded w/ "chunked" transfer encoding - * as defined in rfc2068 par. 19.4.6 - * code shamelessly stolen from nusoap library by Dietrich Ayala. + * Decode a string that is encoded with "chunked" transfer encoding as defined in rfc2068 par. 19.4.6 + * Code shamelessly stolen from nusoap library by Dietrich Ayala. * * @param string $buffer the string to be decoded * @@ -198,7 +197,7 @@ class Http foreach ($httpResponse['cookies'] as $header => $value) { $msg .= "COOKIE: $header={$value['value']}\n"; } - $this->debugMessage($msg); + Logger::instance()->debugMessage($msg); } // if CURL was used for the call, http headers have been processed, @@ -222,12 +221,12 @@ class Http if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { $data = $degzdata; if ($debug) { - $this->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); + Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); } } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { $data = $degzdata; if ($debug) { - $this->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); + Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); } } else { error_log('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server'); @@ -243,19 +242,4 @@ class Http return $httpResponse; } - - /** - * Echoes a debug message, taking care of escaping it when not in console mode - * - * @param string $message - */ - protected function debugMessage($message) - { - if (PHP_SAPI != 'cli') { - print "
\n".htmlentities($message)."\n
"; - } - else { - print "\n$message\n"; - } - } }