Add http\Client::setDebug(callable $debug) and constants
authorMichael Wallner <mike@php.net>
Tue, 21 Jun 2016 06:50:14 +0000 (08:50 +0200)
committerMichael Wallner <mike@php.net>
Tue, 21 Jun 2016 06:50:14 +0000 (08:50 +0200)
commit1ac722a1169ffe0f804f8d30a79c2f270d0d7999
tree20f753435ea7be54152283cedc4d9cc4fbc41a8d
parent88362013f6230e939a14658d9123dc984f5807c6
Add http\Client::setDebug(callable $debug) and constants

Returns:
 * http\Client, self

Params:
 * callable $debug as
   function(http\Client $c, http\Client\Request $r, int $type, string $data)

Added constants (used for the $type bitmask parameter of the callback):
 * http\Client::DEBUG_INFO (informational text)
 * http\Client::DEBUG_IN (received data)
 * http\Client::DEBUG_OUT (sent data)
 * http\Client::DEBUG_HEADER (headers)
 * http\Client::DEBUG_BODY (body)
 * http\Client::DEBUG_SSL (SSL data)

E.g. incoming headers would have the bitmask
(http\Client::DEBUG_IN|http\Client::DEBUG_HEADER) set in the $type
parameter.

Messages of type http\Client::DEBUG_INFO contain human readable text
like "Proxy CONNECT connection closed\n".
src/php_http_client.c
src/php_http_client.h
src/php_http_client_curl.c