From: Michael Wallner Date: Wed, 13 Mar 2019 13:49:45 +0000 (+0100) Subject: typo, parameter and type fixes X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=9620c25e36f35fce0b77dedeedd97b6125b257ed;p=mdref%2Fmdref-http typo, parameter and type fixes --- diff --git a/http.md b/http.md index 63095d5..6cfa0b1 100644 --- a/http.md +++ b/http.md @@ -40,6 +40,12 @@ The following system libraries are optional and provide additional features: Minimum version: 7.18.2 Install on Debian: `apt-get install libcurl4-openssl-dev` +=libbrotli= + Provides brotli encoding. + Configure: `--with-http-libbrotli-dir` + Minimum version: 1.0 + Install on Debian: `apt-get install libbrotli-dev` + =libevent= Internal event loop support for the HTTP client. Configure: `--with-http-libevent-dir` @@ -151,3 +157,5 @@ The http extension registers the ```http.*``` namespace for its stream filters. * Added idnkit-2 IDNA2008 support. * Added ICU IDNA2008 support. * Added explicit configuration options for each IDNA library. +0. v3.2.0 + * Added brotli encoding support. diff --git a/http.stub.php b/http.stub.php index 508af58..cf692d0 100644 --- a/http.stub.php +++ b/http.stub.php @@ -92,7 +92,7 @@ class Client implements \SplSubject, \Countable { * See http\Client::setSslOptions(), http\Client::setOptions() and http\Client\Curl\$ssl options. * * @param array $ssl_options Add this SSL options. - * @throws \http\Exceptionc\InvalidArgumentException + * @throws \http\Exception\InvalidArgumentException * @return \http\Client self. */ function addSslOptions(array $ssl_options = NULL) {} @@ -181,7 +181,7 @@ class Client implements \SplSubject, \Countable { * * > ***Note:*** * > The http\Client\Response object resulting from the request is always stored - * > internally to be retreived at a later time, __even__ when $cb is used. + * > internally to be retrieved at a later time, __even__ when $cb is used. * > * > If you are about to send a lot of requests and do __not__ need the response * > after executing the callback, you can use http\Client::getResponse() within @@ -190,7 +190,8 @@ class Client implements \SplSubject, \Countable { * See http\Client::dequeue() and http\Client::send(). * * @param \http\Client\Request $request The request to enqueue. - * @param callable $cb A callback to automatically call when the request has finished. + * @param callable $cb as function(\http\Response $response) : ?bool + * A callback to automatically call when the request has finished. * @throws \http\Exception\InvalidArgumentException * @throws \http\Exception\BadMethodCallException * @throws \http\Exception\RuntimeException @@ -203,7 +204,7 @@ class Client implements \SplSubject, \Countable { * See f.e. the [configuration options for the Curl driver](http/Client/Curl#Configuration:). * * @throws \http\Exception\InvalidArgumentException - * @return array list of key/value pairs of available configuarion options and their default values. + * @return array list of key/value pairs of available configuration options and their default values. */ function getAvailableConfiguration() {} /** @@ -264,7 +265,7 @@ class Client implements \SplSubject, \Countable { */ function getProgressInfo(\http\Client\Request $request) {} /** - * Retrieve the corresponding reponse of an already finished request, or the last received response if $request is not set. + * Retrieve the corresponding response of an already finished request, or the last received response if $request is not set. * * > ***NOTE:*** * > If $request is NULL, then the response is removed from the internal storage (stack-like operation). @@ -284,7 +285,7 @@ class Client implements \SplSubject, \Countable { */ function getSslOptions() {} /** - * Get transfer related informatioin for a running or finished request. + * Get transfer related information for a running or finished request. * * @param \http\Client\Request $request The request to probe for transfer info. * @throws \http\Exception\InvalidArgumentException @@ -315,11 +316,13 @@ class Client implements \SplSubject, \Countable { * The difference simply is, that this method, in contrast to http\Client::enqueue(), does not throw an http\Exception when the request to queue is already enqueued and dequeues it automatically prior enqueueing it again. * * @param \http\Client\Request $request The request to queue. + * @param callable $cb as function(\http\Response $response) : ?bool + * A callback to automatically call when the request has finished. * @throws \http\Exception\InvalidArgumentException * @throws \http\Exception\RuntimeException * @return \http\Client self. */ - function requeue(\http\Client\Request $request) {} + function requeue(\http\Client\Request $request, callable $cb = NULL) {} /** * Reset the client to the initial state. * @@ -642,21 +645,23 @@ namespace http; */ class Env { /** - * Retreive the current HTTP request's body. + * Retrieve the current HTTP request's body. * + * @param string $body_class_name A user class extending http\Message\Body. * @throws \http\Exception\InvalidArgumentException * @throws \http\Exception\UnexpectedValueException * @return \http\Message\Body instance representing the request body */ - function getRequestBody() {} + function getRequestBody(string $body_class_name = NULL) {} /** * Retrieve one or all headers of the current HTTP request. * + * @param string $header_name The key of a header to retrieve. * @return NULL|string|array NULL if $header_name was not found * or string the compound header when $header_name was found * or array of all headers if $header_name was not specified */ - function getRequestHeader() {} + function getRequestHeader(string $header_name = NULL) {} /** * Get the HTTP response code to send. * @@ -666,11 +671,12 @@ class Env { /** * Get one or all HTTP response headers to be sent. * + * @param string $header_name The name of the response header to retrieve. * @return string|NULL|array string the compound value of the response header to send * or NULL if the header was not found * or array of all response headers, if $header_name was not specified */ - function getResponseHeader() {} + function getResponseHeader(string $header_name = NULL) {} /** * Retrieve a list of all known HTTP response status. * @@ -684,67 +690,72 @@ class Env { /** * Retrieve the string representation of specified HTTP response code. * - * @return string|\empty string the HTTP response status message - * or \empty string, if no message for this code was found + * @param int $code The HTTP response code to get the string representation for. + * @return string the HTTP response status message (may be empty, if no message for this code was found) */ - function getResponseStatusForCode() {} + function getResponseStatusForCode(int $code) {} /** * Generic negotiator. For specific client negotiation see http\Env::negotiateContentType() and related methods. * * > ***NOTE:*** - * > The first elemement of $supported serves as a default if no operand matches. + * > The first element of $supported serves as a default if no operand matches. * * @param string $params HTTP header parameter's value to negotiate. * @param array $supported List of supported negotiation operands. * @param string $prim_typ_sep A "primary type separator", i.e. that would be a hyphen for content language negotiation (en-US, de-DE, etc.). + * @param array $result Out parameter recording negotiation results. * @return NULL|string NULL if negotiation fails. * or string the closest match negotiated, or the default (first entry of $supported). */ - function negotiate(string $params, array $supported, string $prim_typ_sep = NULL) {} + function negotiate(string $params, array $supported, string $prim_typ_sep = NULL, array &$result = NULL) {} /** * Negotiate the client's preferred character set. * * > ***NOTE:*** - * > The first elemement of $supported character sets serves as a default if no character set matches. + * > The first element of $supported character sets serves as a default if no character set matches. * * @param array $supported List of supported content character sets. + * @param array $result Out parameter recording negotiation results. * @return NULL|string NULL if negotiation fails. * or string the negotiated character set. */ - function negotiateCharset(array $supported) {} + function negotiateCharset(array $supported, array &$result = NULL) {} /** * Negotiate the client's preferred MIME content type. * * > ***NOTE:*** - * > The first elemement of $supported content types serves as a default if no content-type matches. + * > The first element of $supported content types serves as a default if no content-type matches. * * @param array $supported List of supported MIME content types. + * @param array $result Out parameter recording negotiation results. * @return NULL|string NULL if negotiation fails. * or string the negotiated content type. */ - function negotiateContentType(array $supported) {} + function negotiateContentType(array $supported, array &$result = NULL) {} /** * Negotiate the client's preferred encoding. * * > ***NOTE:*** - * > The first elemement of $supported encodings serves as a default if no encoding matches. + * > The first element of $supported encodings serves as a default if no encoding matches. * * @param array $supported List of supported content encodings. + * @param array $result Out parameter recording negotiation results. * @return NULL|string NULL if negotiation fails. * or string the negotiated encoding. */ - function negotiateEncoding(array $supported) {} + function negotiateEncoding(array $supported, array &$result = NULL) {} /** * Negotiate the client's preferred language. * * > ***NOTE:*** - * > The first elemement of $supported languages serves as a default if no language matches. + * > The first element of $supported languages serves as a default if no language matches. * * @param array $supported List of supported content languages. + * @param array $result Out parameter recording negotiation results. * @return NULL|string NULL if negotiation fails. * or string the negotiated language. */ - function negotiateLanguage(array $supported) {} + function negotiateLanguage(array $supported, array &$result = NULL) {} /** * Set the HTTP response code to send. * @@ -759,9 +770,13 @@ class Env { * * If $response_code is not 0, the response status code is updated accordingly. * + * @param string $header_name + * @param mixed $header_value + * @param int $response_code + * @param bool $replace * @return bool Success. */ - function setResponseHeader() {} + function setResponseHeader(string $header_name, $header_value = NULL, int $response_code = NULL, bool $replace = NULL) {} } /** * The http extension's Exception interface. @@ -851,13 +866,14 @@ class Header implements \Serializable { * used instead. * * > ***NOTE:*** - * > The first elemement of $supported serves as a default if no operand matches. + * > The first element of $supported serves as a default if no operand matches. * * @param array $supported The list of supported values to negotiate. + * @param array $result Out parameter recording the negotiation results. * @return NULL|string NULL if negotiation fails. * or string the closest match negotiated, or the default (first entry of $supported). */ - function negotiate(array $supported) {} + function negotiate(array $supported, array &$result = NULL) {} /** * Parse HTTP headers. * See also http\Header\Parser. @@ -911,7 +927,7 @@ class Message implements \Countable, \Serializable, \Iterator { * @protected * @var int */ - protected $type = http\Message::TYPE_NONE; + protected $type = \http\Message::TYPE_NONE; /** * The message's body. * @@ -934,7 +950,7 @@ class Message implements \Countable, \Serializable, \Iterator { */ protected $requestUrl = ""; /** - * The respose status phrase if the message is of type response. + * The response status phrase if the message is of type response. * * @protected * @var string @@ -1035,7 +1051,7 @@ class Message implements \Countable, \Serializable, \Iterator { * See http\Message::setBody(). * * @throws \http\Exception\InvalidArgumentException - * @throws \http\Exception\UnexpectedValueEcxeption + * @throws \http\Exception\UnexpectedValueException * @return \http\Message\Body the message body. */ function getBody() {} @@ -1056,7 +1072,7 @@ class Message implements \Countable, \Serializable, \Iterator { */ function getHeaders() {} /** - * Retreive the HTTP protocol version of the message. + * Retrieve the HTTP protocol version of the message. * See http\Message::setHttpVersion(). * * @return string the HTTP protocol version, e.g. "1.0"; defaults to "1.1". @@ -1072,6 +1088,9 @@ class Message implements \Countable, \Serializable, \Iterator { * * http\Message::getResponseStatus() * * http\Message::getRequestMethod() * * http\Message::getRequestUrl() + * + * @return string|NULL string the HTTP message information. + * or NULL if the message is neither of type request nor response. */ function getInfo() {} /** @@ -1128,9 +1147,10 @@ class Message implements \Countable, \Serializable, \Iterator { * * See http\Message::splitMultipartBody(). * + * @param string $boundary A reference where the boundary string will be stored. * @return bool whether this is a message with a multipart "Content-Type". */ - function isMultipart() {} + function isMultipart(string &$boundary = NULL) {} /** * Implements Iterator. * See http\Message::current() and http\Message::rewind(). @@ -1299,20 +1319,16 @@ class Message implements \Countable, \Serializable, \Iterator { * Stream the message through a callback. * * @param callable $callback The callback of the form function(http\Message $from, string $data). - * @param int $offset Start to stream from this offset. - * @param int $maxlen Stream at most $maxlen bytes, or all if $maxlen is less than 1. * @return \http\Message self. */ - function toCallback(callable $callback, int $offset = 0, int $maxlen = 0) {} + function toCallback(callable $callback) {} /** * Stream the message into stream $stream, starting from $offset, streaming $maxlen at most. * * @param resource $stream The resource to write to. - * @param int $offset The starting offset. - * @param int $maxlen The maximum amount of data to stream. All content if less than 1. * @return \http\Message self. */ - function toStream($stream, int $offset = 0, int $maxlen = 0) {} + function toStream($stream) {} /** * Retrieve the message serialized to a string. * @@ -1362,6 +1378,10 @@ class Params implements \ArrayAccess { * Interpret input as default formatted parameters. */ const PARSE_DEFAULT = 17; + /** + * Parse backslash escaped (quoted) strings. + */ + const PARSE_ESCAPED = 1; /** * Urldecode single units of parameters, arguments and values. */ @@ -1395,28 +1415,28 @@ class Params implements \ArrayAccess { * @public * @var array */ - public $param_sep = http\Params::DEF_PARAM_SEP; + public $param_sep = \http\Params::DEF_PARAM_SEP; /** * The argument separator(s). * * @public * @var array */ - public $arg_sep = http\Params::DEF_ARG_SEP; + public $arg_sep = \http\Params::DEF_ARG_SEP; /** * The value separator(s). * * @public * @var array */ - public $val_sep = http\Params::DEF_VAL_SEP; + public $val_sep = \http\Params::DEF_VAL_SEP; /** * The modus operandi of the parser. See http\Params::PARSE_* constants. * * @public * @var int */ - public $flags = http\Params::PARSE_DEFAULT; + public $flags = \http\Params::PARSE_DEFAULT; /** * Instantiate a new HTTP (header) parameter set. * @@ -1466,7 +1486,7 @@ class Params implements \ArrayAccess { /** * Convenience method that simply returns http\Params::$params. * - * @return array of paramters. + * @return array of parameters. */ function toArray() {} /** @@ -1525,6 +1545,12 @@ class QueryString implements \Serializable, \ArrayAccess, \IteratorAggregate { * @throws \http\Exception\BadQueryStringException */ function __construct($params = NULL) {} + /** + * Get the string representation of the querystring (x-www-form-urlencoded). + * + * @return string the x-www-form-urlencoded querystring. + */ + function __toString() {} /** * Retrieve an querystring value. * @@ -1676,7 +1702,7 @@ class QueryString implements \Serializable, \ArrayAccess, \IteratorAggregate { */ function toArray() {} /** - * Get the string represenation of the querystring (x-www-form-urlencoded). + * Get the string representation of the querystring (x-www-form-urlencoded). * * @return string the x-www-form-urlencoded querystring. */ @@ -1759,7 +1785,7 @@ class Url { */ const SANITIZE_PATH = 8192; /** - * Parse UTF-8 encododed multibyte sequences. + * Parse UTF-8 encoded multibyte sequences. */ const PARSE_MBUTF8 = 131072; /** @@ -1884,7 +1910,7 @@ class Url { * @throws \http\Exception\BadUrlException * @return \http\Url clone. */ - function mod($parts, int $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY|http\Url::SANITIZE_PATH) {} + function mod($parts, int $flags = \http\Url::JOIN_PATH|http\Url::JOIN_QUERY|http\Url::SANITIZE_PATH) {} /** * Retrieve the URL parts as array. * @@ -1912,7 +1938,7 @@ const FEATURES = 4179869; * e.g. "libcurl/7.50.0 OpenSSL/1.0.2h zlib/1.2.8 libidn/1.32 nghttp2/1.12.0". * See http\Client\Curl\Versions namespace. */ -const VERSIONS = 'libcurl/7.64.0 OpenSSL/1.1.1b zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3'; +const VERSIONS = 'libcurl/7.64.0 OpenSSL/1.1.1a zlib/1.2.11 libidn2/2.1.1 libpsl/0.20.2 (+libidn2/2.1.1) libssh2/1.8.0 nghttp2/1.36.0'; /** * Use HTTP/1.0 protocol version. */ @@ -1922,9 +1948,13 @@ const HTTP_VERSION_1_0 = 1; */ const HTTP_VERSION_1_1 = 2; /** - * Use HTTP/2 protocol version. Available if libcurl is v7.33.0 or more recent and was built with nghttp2 support. + * Attempt to use HTTP/2 protocol version. Available if libcurl is v7.33.0 or more recent and was built with nghttp2 support. */ const HTTP_VERSION_2_0 = 3; +/** + * Attempt to use version 2 for HTTPS, version 1.1 for HTTP. Available if libcurl is v7.47.0 or more recent and was built with nghttp2 support. + */ +const HTTP_VERSION_2TLS = 4; /** * Use any HTTP protocol version. */ @@ -1960,7 +1990,7 @@ const SSL_VERSION_ANY = 0; /** * Use TLS SRP authentication. Available if libcurl is v7.21.4 or more recent and was built with gnutls or openssl with TLS-SRP support. */ -const TLS_AUTH_SRP = NULL; +const TLSAUTH_SRP = 1; /** * Use IPv4 resolver. */ @@ -2081,7 +2111,7 @@ class Request extends \http\Message { * See http\Client\Request::setSslOptions(), http\Client\Request::setOptions() and http\Client\Curl\$ssl options. * * @param array $ssl_options Add this SSL options. - * @throws \http\Client\InvalidArgumentException + * @throws \http\Exception\InvalidArgumentException * @return \http\Client\Request self. */ function addSslOptions(array $ssl_options = NULL) {} @@ -2133,7 +2163,7 @@ class Request extends \http\Message { * > Only options specified prior enqueueing a request are applied to the request. * * @param array $options The options to set. - * @throws \http\Client\InvalidArgumentException + * @throws \http\Exception\InvalidArgumentException * @return \http\Client\Request self. */ function setOptions(array $options = NULL) {} @@ -2152,7 +2182,7 @@ class Request extends \http\Message { * See http\Client\Request::setOptions() and http\Client\Curl\$ssl options. * * @param array $ssl_options Set SSL options to this array. - * @throws \http\Client\InvalidArgumentException + * @throws \http\Exception\InvalidArgumentException * @return \http\Client\Request self. */ function setSslOptions(array $ssl_options = NULL) {} @@ -2352,7 +2382,7 @@ const CURL = '7.64.0'; /** * Version string of the SSL/TLS library, e.g. "OpenSSL/1.0.2h". */ -const SSL = 'OpenSSL/1.1.1b'; +const SSL = 'OpenSSL/1.1.1a'; /** * Version string of the zlib compression library, e.g. "1.2.8". */ @@ -2371,7 +2401,7 @@ namespace http\Encoding; */ abstract class Stream { /** - * Do no intermittend flushes. + * Do no intermittent flushes. */ const FLUSH_NONE = 0; /** @@ -2419,6 +2449,21 @@ abstract class Stream { function update(string $data) {} } namespace http\Encoding\Stream; +/** + * A [brotli](https://brotli.org) decoding stream. + * + * > ***NOTE:*** + * > This class has been added in v3.2.0. + */ +class Debrotli extends \http\Encoding\Stream { + /** + * Decode brotli encoded data. + * + * @param string $data The data to uncompress. + * @return string the uncompressed data. + */ + function decode(string $data) {} +} /** * A stream decoding data encoded with chunked transfer encoding. */ @@ -2434,7 +2479,7 @@ class Dechunk extends \http\Encoding\Stream { * or string the truncated decoded data. * or false if $data cannot be decoded. */ - function decode(string $data, int $decoded_len = 0) {} + function decode(string $data, int &$decoded_len = 0) {} } /** * A deflate stream supporting deflate, zlib and gzip encodings. @@ -2509,6 +2554,58 @@ class Deflate extends \http\Encoding\Stream { */ function encode(string $data, int $flags = 0) {} } +/** + * A [brotli](https://brotli.org) encoding stream. + * + * > ***NOTE:*** + * > This class has been added in v3.2.0. + */ +class Enbrotli extends \http\Encoding\Stream { + /** + * Default compression level. + */ + const LEVEL_DEF = 4; + /** + * Least compression level. + */ + const LEVEL_MIN = 1; + /** + * Greatest compression level. + */ + const LEVEL_MAX = 11; + /** + * Default window bits. + */ + const WBITS_DEF = 352; + /** + * Minimum window bits. + */ + const WBITS_MIN = 160; + /** + * Maximum window bits. + */ + const WBITS_MAX = 384; + /** + * Default compression mode. + */ + const MODE_GENERIC = 0; + /** + * Compression mode for UTF-8 formatted text. + */ + const MODE_TEXT = 4096; + /** + * Compression mode used in WOFF 2.0. + */ + const MODE_FONT = 8192; + /** + * Encode data with brotli encoding. + * + * @param string $data The data to compress. + * @param int $flags Any compression tuning flags. See http\Encoding\Stream\Enbrotli and http\Encoding\Stream constants. + * @return string the compressed data. + */ + function encode(string $data, int $flags = 0) {} +} /** * A inflate stream supporting deflate, zlib and gzip encodings. */ @@ -2559,7 +2656,7 @@ class Request extends \http\Message { /** * Create an instance of the server's current HTTP request. * - * Upon construction, the http\Env\Request acquires http\QueryString instances of query paramters ($\_GET) and form parameters ($\_POST). + * Upon construction, the http\Env\Request acquires http\QueryString instances of query parameters ($\_GET) and form parameters ($\_POST). * * It also compiles an array of uploaded files ($\_FILES) more comprehensive than the original $\_FILES array, see http\Env\Request::getFiles() for that matter. * @@ -2786,11 +2883,11 @@ class Response extends \http\Message { /** * Set the MIME content type of the response. * - * @param string $conten_type The response's content type. - * @throws \http\Env\InvalidArgumentException + * @param string $content_type The response's content type. + * @throws \http\Exception\InvalidArgumentException * @return \http\Env\Response self. */ - function setContentType(string $conten_type) {} + function setContentType(string $content_type) {} /** * Add cookies to the response to send. * @@ -2955,20 +3052,22 @@ class Parser { * * @param string $data The (part of the) header to parse. * @param int $flags Any combination of [parser flags](http/Header/Parser#Parser.flags:). + * @param array $header Successfully parsed headers. * @throws \http\Exception\InvalidArgumentException * @return int http\Header\Parser::STATE_* constant. */ - function parse(string $data, int $flags) {} + function parse(string $data, int $flags, array &$header = NULL) {} /** * Parse a stream. * - * @param stream $resource The header stream to parse from. + * @param resource $stream The header stream to parse from. * @param int $flags Any combination of [parser flags](http/Header/Parser#Parser.flags:). + * @param array $headers The headers parsed. * @throws \http\Exception\InvalidArgumentException * @throws \http\Exception\UnexpectedValueException * @return int http\Header\Parser::STATE_* constant. */ - function stream($resource, int $flags) {} + function stream($stream, int $flags, array &$headers) {} } namespace http\Message; /** @@ -3101,7 +3200,7 @@ class Body implements \Serializable { */ function toCallback(callable $callback, int $offset = 0, int $maxlen = 0) {} /** - * Stream the message body into antother stream $stream, starting from $offset, streaming $maxlen at most. + * Stream the message body into another stream $stream, starting from $offset, streaming $maxlen at most. * * @param resource $stream The resource to write to. * @param int $offset The starting offset. @@ -3171,7 +3270,7 @@ class Parser { */ const STATE_BODY_DUMB = 4; /** - * Reading body as indicated by `Content-Lenght` or `Content-Range`. + * Reading body as indicated by `Content-Length` or `Content-Range`. */ const STATE_BODY_LENGTH = 5; /** @@ -3182,6 +3281,10 @@ class Parser { * Finished parsing the body. */ const STATE_BODY_DONE = 7; + /** + * Updating Content-Length based on body size. + */ + const STATE_UPDATE_CL = 8; /** * Finished parsing the message. * @@ -3202,18 +3305,20 @@ class Parser { * * @param string $data The (part of the) message to parse. * @param int $flags Any combination of [parser flags](http/Message/Parser#Parser.flags:). + * @param \http\Message $message The current state of the message parsed. * @throws \http\Exception\InvalidArgumentException * @return int http\Message\Parser::STATE_* constant. */ - function parse(string $data, int $flags) {} + function parse(string $data, int $flags, \http\Message &$message) {} /** * Parse a stream. * - * @param stream $resource The message stream to parse from. + * @param resource $stream The message stream to parse from. * @param int $flags Any combination of [parser flags](http/Message/Parser#Parser.flags:). + * @param \http\Message $message The current state of the message parsed. * @throws \http\Exception\InvalidArgumentException * @throws \http\Exception\UnexpectedValueException * @return int http\Message\Parser::STATE_* constant. */ - function stream($resource, int $flags) {} + function stream($stream, int $flags, \http\Message &$message) {} } diff --git a/http/Client/Curl.md b/http/Client/Curl.md index eefb02d..3e4f3d7 100644 --- a/http/Client/Curl.md +++ b/http/Client/Curl.md @@ -21,7 +21,9 @@ The http\Client\Curl namespace holds option value constants specific to the curl * HTTP_VERSION_1_1 Use HTTP/1.1 protocol version. * HTTP_VERSION_2_0 - Use HTTP/2 protocol version. Available if libcurl is v7.33.0 or more recent and was built with nghttp2 support. + Attempt to use HTTP/2 protocol version. Available if libcurl is v7.33.0 or more recent and was built with nghttp2 support. +* HTTP_VERSION_2TLS + Attempt to use version 2 for HTTPS, version 1.1 for HTTP. Available if libcurl is v7.47.0 or more recent and was built with nghttp2 support. * HTTP_VERSION_ANY Use any HTTP protocol version. @@ -44,7 +46,7 @@ The http\Client\Curl namespace holds option value constants specific to the curl ### TLS Auth Types -* TLS_AUTH_SRP +* TLSAUTH_SRP Use TLS SRP authentication. Available if libcurl is v7.21.4 or more recent and was built with gnutls or openssl with TLS-SRP support. ### DNS IP Version diff --git a/http/Client/Request/addSslOptions.md b/http/Client/Request/addSslOptions.md index bb2eb6e..e57b916 100644 --- a/http/Client/Request/addSslOptions.md +++ b/http/Client/Request/addSslOptions.md @@ -14,4 +14,4 @@ See http\Client\Request::setSslOptions(), http\Client\Request::setOptions() and ## Throws: -* http\Client\InvalidArgumentException +* http\Exception\InvalidArgumentException diff --git a/http/Client/Request/setOptions.md b/http/Client/Request/setOptions.md index 5ff0333..a94b56d 100644 --- a/http/Client/Request/setOptions.md +++ b/http/Client/Request/setOptions.md @@ -19,4 +19,4 @@ Request specific options override general options which were set in the client. ## Throws: -* http\Client\InvalidArgumentException +* http\Exception\InvalidArgumentException diff --git a/http/Client/Request/setSslOptions.md b/http/Client/Request/setSslOptions.md index c2d67e2..189a1b7 100644 --- a/http/Client/Request/setSslOptions.md +++ b/http/Client/Request/setSslOptions.md @@ -14,4 +14,4 @@ See http\Client\Request::setOptions() and http\Client\Curl\$ssl options. ## Throws: -* http\Client\InvalidArgumentException +* http\Exception\InvalidArgumentException diff --git a/http/Client/addSslOptions.md b/http/Client/addSslOptions.md index af3851c..da0cfdb 100644 --- a/http/Client/addSslOptions.md +++ b/http/Client/addSslOptions.md @@ -14,4 +14,4 @@ See http\Client::setSslOptions(), http\Client::setOptions() and http\Client\Curl ## Throws: -* http\Exceptionc\InvalidArgumentException +* http\Exception\InvalidArgumentException diff --git a/http/Client/enqueue.md b/http/Client/enqueue.md index a863710..25889a7 100644 --- a/http/Client/enqueue.md +++ b/http/Client/enqueue.md @@ -5,7 +5,7 @@ If the optional callback $cb returns true, the request will be automatically deq > ***Note:*** > The http\Client\Response object resulting from the request is always stored -> internally to be retreived at a later time, __even__ when $cb is used. +> internally to be retrieved at a later time, __even__ when $cb is used. > > If you are about to send a lot of requests and do __not__ need the response > after executing the callback, you can use http\Client::getResponse() within @@ -18,7 +18,7 @@ See http\Client::dequeue() and http\Client::send(). * http\Client\Request $request The request to enqueue. -* Optional callable $cb +* Optional callable $cb as function(\http\Response $response) : ?bool A callback to automatically call when the request has finished. ## Returns: diff --git a/http/Client/getAvailableConfiguration.md b/http/Client/getAvailableConfiguration.md index d9d7c76..20e7f9a 100644 --- a/http/Client/getAvailableConfiguration.md +++ b/http/Client/getAvailableConfiguration.md @@ -10,7 +10,7 @@ None. ## Returns: -* array, list of key/value pairs of available configuarion options and their default values. +* array, list of key/value pairs of available configuration options and their default values. ## Throws: diff --git a/http/Client/getResponse.md b/http/Client/getResponse.md index f006b3d..d47fa5a 100644 --- a/http/Client/getResponse.md +++ b/http/Client/getResponse.md @@ -1,6 +1,6 @@ # http\Client\Response http\Client::getResponse([http\Client\Request $request = NULL]) -Retrieve the corresponding reponse of an already finished request, or the last received response if $request is not set. +Retrieve the corresponding response of an already finished request, or the last received response if $request is not set. > ***NOTE:*** > If $request is NULL, then the response is removed from the internal storage (stack-like operation). diff --git a/http/Client/getTransferInfo.md b/http/Client/getTransferInfo.md index d8ad5d5..84059da 100644 --- a/http/Client/getTransferInfo.md +++ b/http/Client/getTransferInfo.md @@ -1,6 +1,6 @@ # object http\Client::getTransferInfo(http\Client\Request $request) -Get transfer related informatioin for a running or finished request. +Get transfer related information for a running or finished request. ## Params: diff --git a/http/Client/requeue.md b/http/Client/requeue.md index 08f77a2..d3abe83 100644 --- a/http/Client/requeue.md +++ b/http/Client/requeue.md @@ -1,4 +1,4 @@ -# http\Client http\Client::requeue(http\Client\Request $request) +# http\Client http\Client::requeue(http\Client\Request $request[, callable $cb]) Requeue an http\Client\Request. @@ -9,7 +9,9 @@ The difference simply is, that this method, in contrast to http\Client::enqueue( * http\Client\Request $request The request to queue. - +* Optional callable $cb as function(\http\Response $response) : ?bool + A callback to automatically call when the request has finished. + ## Returns: * http\Client, self. diff --git a/http/Encoding/Stream.md b/http/Encoding/Stream.md index b63848f..797213a 100644 --- a/http/Encoding/Stream.md +++ b/http/Encoding/Stream.md @@ -5,7 +5,7 @@ Base class for encoding stream implementations. ## Constants: * FLUSH_NONE - Do no intermittend flushes. + Do no intermittent flushes. * FLUSH_SYNC Flush at appropriate transfer points. * FLUSH_FULL diff --git a/http/Encoding/Stream/Dechunk/decode.md b/http/Encoding/Stream/Dechunk/decode.md index 674510e..bfca9ca 100644 --- a/http/Encoding/Stream/Dechunk/decode.md +++ b/http/Encoding/Stream/Dechunk/decode.md @@ -6,7 +6,7 @@ Decode chunked encoded data. * string $data The data to decode. -* Optional reference int $decoded_len = 0 +* Optional int &$decoded_len = 0 Out parameter with the length of $data that's been decoded. Should be ```strlen($data)``` if not truncated. diff --git a/http/Env/Request/__construct.md b/http/Env/Request/__construct.md index 19ab5a1..310e7bb 100644 --- a/http/Env/Request/__construct.md +++ b/http/Env/Request/__construct.md @@ -2,7 +2,7 @@ Create an instance of the server's current HTTP request. -Upon construction, the http\Env\Request acquires http\QueryString instances of query paramters ($\_GET) and form parameters ($\_POST). +Upon construction, the http\Env\Request acquires http\QueryString instances of query parameters ($\_GET) and form parameters ($\_POST). It also compiles an array of uploaded files ($\_FILES) more comprehensive than the original $\_FILES array, see http\Env\Request::getFiles() for that matter. diff --git a/http/Env/Response/setContentType.md b/http/Env/Response/setContentType.md index 79ca97e..03bdc77 100644 --- a/http/Env/Response/setContentType.md +++ b/http/Env/Response/setContentType.md @@ -4,7 +4,7 @@ Set the MIME content type of the response. ## Params: -* string $conten_type +* string $content_type The response's content type. ## Returns: @@ -13,4 +13,4 @@ Set the MIME content type of the response. ## Throws: -* http\Env\InvalidArgumentException +* http\Exception\InvalidArgumentException diff --git a/http/Env/getRequestBody.md b/http/Env/getRequestBody.md index 52e5594..fff0340 100644 --- a/http/Env/getRequestBody.md +++ b/http/Env/getRequestBody.md @@ -1,8 +1,8 @@ # static http\Message\Body http\Env::getRequestBody([string $body_class_name]) -Retreive the current HTTP request's body. +Retrieve the current HTTP request's body. -## Parameters: +## Params: * Optional string $body_class_name A user class extending http\Message\Body. diff --git a/http/Env/getRequestHeader.md b/http/Env/getRequestHeader.md index 17e87b7..2ed6fc2 100644 --- a/http/Env/getRequestHeader.md +++ b/http/Env/getRequestHeader.md @@ -2,7 +2,7 @@ Retrieve one or all headers of the current HTTP request. -## Parameters: +## Params: * Optional string $header_name The key of a header to retrieve. diff --git a/http/Env/getResponseCode.md b/http/Env/getResponseCode.md index bb5dba0..f85e0d3 100644 --- a/http/Env/getResponseCode.md +++ b/http/Env/getResponseCode.md @@ -2,7 +2,7 @@ Get the HTTP response code to send. -## Parameters: +## Params: None. diff --git a/http/Env/getResponseHeader.md b/http/Env/getResponseHeader.md index 7bdd37a..b7fc6d1 100644 --- a/http/Env/getResponseHeader.md +++ b/http/Env/getResponseHeader.md @@ -2,7 +2,7 @@ Get one or all HTTP response headers to be sent. -## Parameters: +## Params: * Optional string $header_name The name of the response header to retrieve. diff --git a/http/Env/getResponseStatusForAllCodes.md b/http/Env/getResponseStatusForAllCodes.md index f31941f..51023eb 100644 --- a/http/Env/getResponseStatusForAllCodes.md +++ b/http/Env/getResponseStatusForAllCodes.md @@ -2,7 +2,7 @@ Retrieve a list of all known HTTP response status. -## Parameters: +## Params: None. diff --git a/http/Env/getResponseStatusForCode.md b/http/Env/getResponseStatusForCode.md index e97b60f..1830561 100644 --- a/http/Env/getResponseStatusForCode.md +++ b/http/Env/getResponseStatusForCode.md @@ -2,13 +2,12 @@ Retrieve the string representation of specified HTTP response code. -## Parameters: +## Params: * int $code The HTTP response code to get the string representation for. ## Returns: -* string, the HTTP response status message -* empty string, if no message for this code was found +* string, the HTTP response status message (may be empty, if no message for this code was found) diff --git a/http/Env/negotiate.md b/http/Env/negotiate.md index 6463bef..cd59946 100644 --- a/http/Env/negotiate.md +++ b/http/Env/negotiate.md @@ -3,7 +3,7 @@ Generic negotiator. For specific client negotiation see http\Env::negotiateContentType() and related methods. > ***NOTE:*** -> The first elemement of $supported serves as a default if no operand matches. +> The first element of $supported serves as a default if no operand matches. ## Params: @@ -13,7 +13,7 @@ Generic negotiator. For specific client negotiation see http\Env::negotiateConte List of supported negotiation operands. * Optional string $prim_typ_sep A "primary type separator", i.e. that would be a hyphen for content language negotiation (en-US, de-DE, etc.). -* Optional reference array &$result +* Optional array &$result Out parameter recording negotiation results. ## Returns: diff --git a/http/Env/negotiateCharset.md b/http/Env/negotiateCharset.md index 084c622..4b6744b 100644 --- a/http/Env/negotiateCharset.md +++ b/http/Env/negotiateCharset.md @@ -1,15 +1,15 @@ -# static string http\Env::negotiateCharset(array $supported[, array &$result) +# static string http\Env::negotiateCharset(array $supported[, array &$result]) Negotiate the client's preferred character set. > ***NOTE:*** -> The first elemement of $supported character sets serves as a default if no character set matches. +> The first element of $supported character sets serves as a default if no character set matches. ## Params: * array $supported List of supported content character sets. -* Optional reference array &$result +* Optional array &$result Out parameter recording negotiation results. ## Returns: diff --git a/http/Env/negotiateContentType.md b/http/Env/negotiateContentType.md index ccdac81..a43180a 100644 --- a/http/Env/negotiateContentType.md +++ b/http/Env/negotiateContentType.md @@ -1,15 +1,15 @@ -# static string http\Env::negotiateContentType(array $supported[, array &$result) +# static string http\Env::negotiateContentType(array $supported[, array &$result]) Negotiate the client's preferred MIME content type. > ***NOTE:*** -> The first elemement of $supported content types serves as a default if no content-type matches. +> The first element of $supported content types serves as a default if no content-type matches. ## Params: * array $supported List of supported MIME content types. -* Optional reference array &$result +* Optional array &$result Out parameter recording negotiation results. ## Returns: diff --git a/http/Env/negotiateEncoding.md b/http/Env/negotiateEncoding.md index 60e90d2..e55213b 100644 --- a/http/Env/negotiateEncoding.md +++ b/http/Env/negotiateEncoding.md @@ -1,15 +1,15 @@ -# static string http\Env::negotiateEncoding(array $supported[, array &$result) +# static string http\Env::negotiateEncoding(array $supported[, array &$result]) Negotiate the client's preferred encoding. > ***NOTE:*** -> The first elemement of $supported encodings serves as a default if no encoding matches. +> The first element of $supported encodings serves as a default if no encoding matches. ## Params: * array $supported List of supported content encodings. -* Optional reference array &$result +* Optional array &$result Out parameter recording negotiation results. ## Returns: diff --git a/http/Env/negotiateLanguage.md b/http/Env/negotiateLanguage.md index a50561c..3dbcec4 100644 --- a/http/Env/negotiateLanguage.md +++ b/http/Env/negotiateLanguage.md @@ -1,15 +1,15 @@ -# static string http\Env::negotiateLanguage(array $supported[, array &$result) +# static string http\Env::negotiateLanguage(array $supported[, array &$result]) Negotiate the client's preferred language. > ***NOTE:*** -> The first elemement of $supported languages serves as a default if no language matches. +> The first element of $supported languages serves as a default if no language matches. ## Params: * array $supported List of supported content languages. -* Optional reference array &$result +* Optional array &$result Out parameter recording negotiation results. ## Returns: diff --git a/http/Env/setResponseHeader.md b/http/Env/setResponseHeader.md index 31eda46..fa01699 100644 --- a/http/Env/setResponseHeader.md +++ b/http/Env/setResponseHeader.md @@ -6,7 +6,7 @@ If no $header_value is specified, or $header_value is NULL, then a previously se If $response_code is not 0, the response status code is updated accordingly. -## Parameters: +## Params: * string $header_name, the name of the response header. * Optional mixed $header_value, the header value. diff --git a/http/Header/Parser/stream.md b/http/Header/Parser/stream.md index a9dc71f..6eddf33 100644 --- a/http/Header/Parser/stream.md +++ b/http/Header/Parser/stream.md @@ -4,7 +4,7 @@ Parse a stream. ## Params: -* stream $resource +* resource $stream The header stream to parse from. * int $flags Any combination of [parser flags](http/Header/Parser#Parser.flags:). diff --git a/http/Header/negotiate.md b/http/Header/negotiate.md index b9aaff9..8b53f6a 100644 --- a/http/Header/negotiate.md +++ b/http/Header/negotiate.md @@ -7,13 +7,13 @@ separator, and if the header is Accept-Language respectively, a hyphen is used instead. > ***NOTE:*** -> The first elemement of $supported serves as a default if no operand matches. +> The first element of $supported serves as a default if no operand matches. ## Params: * array $supported The list of supported values to negotiate. -* Optional reference array &$result +* Optional array &$result Out parameter recording the negotiation results. ## Returns: diff --git a/http/Message.md b/http/Message.md index c7ef74b..a134f73 100644 --- a/http/Message.md +++ b/http/Message.md @@ -24,7 +24,7 @@ See http\Client\Request and http\Client\Response, as well as http\Env\Request an * protected string $requestUrl = "" The request url if the message is of type request. * protected string $responseStatus = "" - The respose status phrase if the message is of type response. + The response status phrase if the message is of type response. * protected int $responseCode = 0 The response code if the message is of type response. * protected string $httpVersion = NULL diff --git a/http/Message/Body/toStream.md b/http/Message/Body/toStream.md index 4f04d51..d3a11b2 100644 --- a/http/Message/Body/toStream.md +++ b/http/Message/Body/toStream.md @@ -1,6 +1,6 @@ # http\Message\Body http\Message\Body::toStream(resource $stream[, int $offset = 0[, int $maxlen = 0]]) -Stream the message body into antother stream $stream, starting from $offset, streaming $maxlen at most. +Stream the message body into another stream $stream, starting from $offset, streaming $maxlen at most. ## Params: diff --git a/http/Message/Parser.md b/http/Message/Parser.md index 6bb3fae..4cfdb19 100644 --- a/http/Message/Parser.md +++ b/http/Message/Parser.md @@ -33,11 +33,13 @@ The parser which is underlying http\Message. * STATE_BODY_DUMB Soaking up all input as body. * STATE_BODY_LENGTH - Reading body as indicated by `Content-Lenght` or `Content-Range`. + Reading body as indicated by `Content-Length` or `Content-Range`. * STATE_BODY_CHUNKED Parsing `chunked` encoded body. * STATE_BODY_DONE Finished parsing the body. +* STATE_UPDATE_CL + Updating Content-Length based on body size. * STATE_DONE Finished parsing the message. diff --git a/http/Message/Parser/stream.md b/http/Message/Parser/stream.md index 717c82a..c85f80e 100644 --- a/http/Message/Parser/stream.md +++ b/http/Message/Parser/stream.md @@ -4,7 +4,7 @@ Parse a stream. ## Params: -* stream $resource +* resource $stream The message stream to parse from. * int $flags Any combination of [parser flags](http/Message/Parser#Parser.flags:). diff --git a/http/Message/getBody.md b/http/Message/getBody.md index d95d9c2..0666858 100644 --- a/http/Message/getBody.md +++ b/http/Message/getBody.md @@ -14,4 +14,4 @@ None. ## Throws: * http\Exception\InvalidArgumentException -* http\Exception\UnexpectedValueEcxeption +* http\Exception\UnexpectedValueException diff --git a/http/Message/getHttpVersion.md b/http/Message/getHttpVersion.md index 29d65d7..052fb63 100644 --- a/http/Message/getHttpVersion.md +++ b/http/Message/getHttpVersion.md @@ -1,6 +1,6 @@ # string http\Message::getHttpVersion() -Retreive the HTTP protocol version of the message. +Retrieve the HTTP protocol version of the message. See http\Message::setHttpVersion(). ## Params: diff --git a/http/Message/getInfo.md b/http/Message/getInfo.md index ec9e2bc..fcdac23 100644 --- a/http/Message/getInfo.md +++ b/http/Message/getInfo.md @@ -14,7 +14,7 @@ See http\Message::setInfo and also: None. -## Return: +## Returns: * string, the HTTP message information. * NULL, if the message is neither of type request nor response. diff --git a/http/Message/isMultipart.md b/http/Message/isMultipart.md index e61ae90..2573019 100644 --- a/http/Message/isMultipart.md +++ b/http/Message/isMultipart.md @@ -7,7 +7,7 @@ See http\Message::splitMultipartBody(). ## Params: -* Optional reference string &$boundary = NULL +* Optional string &$boundary = NULL A reference where the boundary string will be stored. ## Returns: diff --git a/http/Message/toCallback.md b/http/Message/toCallback.md index fc48ffe..1e5ecae 100644 --- a/http/Message/toCallback.md +++ b/http/Message/toCallback.md @@ -1,4 +1,4 @@ -# http\Message http\Message::toCallback(callable $callback[, int $offset = 0[, int $maxlen = 0]]) +# http\Message http\Message::toCallback(callable $callback) Stream the message through a callback. @@ -6,10 +6,6 @@ Stream the message through a callback. * callable $callback The callback of the form function(http\Message $from, string $data). -* Optional int $offset = 0 - Start to stream from this offset. -* Optional int $maxlen = 0 - Stream at most $maxlen bytes, or all if $maxlen is less than 1. ## Returns: diff --git a/http/Message/toStream.md b/http/Message/toStream.md index 31ff77c..bc92cba 100644 --- a/http/Message/toStream.md +++ b/http/Message/toStream.md @@ -1,4 +1,4 @@ -# http\Message http\Message::toStream(resource $stream[, int $offset = 0[, int $maxlen = 0]]) +# http\Message http\Message::toStream(resource $stream) Stream the message into stream $stream, starting from $offset, streaming $maxlen at most. @@ -6,10 +6,6 @@ Stream the message into stream $stream, starting from $offset, streaming $maxlen * resource $stream The resource to write to. -* Optional int $offset = 0 - The starting offset. -* Optional int $maxlen = 0 - The maximum amount of data to stream. All content if less than 1. ## Returns: diff --git a/http/Params.md b/http/Params.md index 4349769..fb28bb1 100644 --- a/http/Params.md +++ b/http/Params.md @@ -16,6 +16,8 @@ Parse, interpret and compose HTTP (header) parameters. Do not interpret the parsed parameters. * PARSE_DEFAULT Interpret input as default formatted parameters. +* PARSE_ESCAPED + Parse backslash escaped (quoted) strings. * PARSE_URLENCODED Urldecode single units of parameters, arguments and values. * PARSE_DIMENSION diff --git a/http/Params/toArray.md b/http/Params/toArray.md index 4686bf1..5c854a5 100644 --- a/http/Params/toArray.md +++ b/http/Params/toArray.md @@ -8,4 +8,4 @@ None. ## Returns: -* array of paramters. +* array of parameters. diff --git a/http/QueryString/getArray.md b/http/QueryString/getArray.md index a33c8c5..2cf7695 100644 --- a/http/QueryString/getArray.md +++ b/http/QueryString/getArray.md @@ -1,4 +1,4 @@ -# array http\QueryString::getArray(string $name[, mixed $defval = NULL[, bool $delete = false) +# array http\QueryString::getArray(string $name[, mixed $defval = NULL[, bool $delete = false]]) Retrieve an array value with at offset $name. diff --git a/http/QueryString/toString.md b/http/QueryString/toString.md index 9da189e..add3976 100644 --- a/http/QueryString/toString.md +++ b/http/QueryString/toString.md @@ -1,6 +1,6 @@ # string http\QueryString::toString() -Get the string represenation of the querystring (x-www-form-urlencoded). +Get the string representation of the querystring (x-www-form-urlencoded). ## Params: diff --git a/http/Url.md b/http/Url.md index 89cd97b..0c8aa8d 100644 --- a/http/Url.md +++ b/http/Url.md @@ -31,7 +31,7 @@ The http\Url class provides versatile means to parse, construct and manipulate U * SANITIZE_PATH Whether to sanitize the URL path (consolidate double slashes, directory jumps etc.) * PARSE_MBUTF8 - Parse UTF-8 encododed multibyte sequences. + Parse UTF-8 encoded multibyte sequences. * PARSE_MBLOC Parse locale encoded multibyte sequences (on systems with wide character support). * PARSE_TOIDN diff --git a/http/Url/mod.md b/http/Url/mod.md index 59289ff..30fce99 100644 --- a/http/Url/mod.md +++ b/http/Url/mod.md @@ -1,4 +1,4 @@ -# http\Url http\Url::mod(mixed $parts[, int $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY|http\Url::SANITIZE_PATH) +# http\Url http\Url::mod(mixed $parts[, int $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY|http\Url::SANITIZE_PATH]) Clone this URL and apply $parts to the cloned URL.