From 62de37d8c446969f97b08544af97f557b7efac9a Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 5 Nov 2013 12:14:13 +0100 Subject: [PATCH] flush --- VERSION | 2 +- http.md | 2 +- http/Client.md | 14 ++ http/Client/Curl.md | 245 ++++++++++++++++++++++++ http/Client/Request.md | 15 ++ http/Client/Response.md | 11 ++ http/Client/Response/getCookies.md | 39 ++++ http/Client/Response/getTransferInfo.md | 15 ++ http/Client/__construct.md | 17 ++ http/Client/addCookies.md | 13 ++ http/Client/addSslOptions.md | 13 ++ http/Client/attach.md | 13 ++ http/Client/dequeue.md | 18 ++ http/Client/detach.md | 12 ++ http/Client/enableEvents.md | 13 ++ http/Client/enablePipelining.md | 12 ++ http/Client/enqueue.md | 33 ++++ http/Client/getAvailableDrivers.md | 24 +++ http/Client/getCookies.md | 12 ++ http/Client/getHistory.md | 76 ++++++++ http/Client/getObservers.md | 15 ++ http/Client/getOptions.md | 12 ++ http/Client/getProgressInfo.md | 38 ++++ http/Client/getResponse.md | 36 ++++ http/Client/getSslOptions.md | 12 ++ http/Client/getTransferInfo.md | 104 ++++++++++ http/Client/notify.md | 77 ++++++++ http/Client/once.md | 41 ++++ http/Client/requeue.md | 15 ++ http/Client/reset.md | 11 ++ http/Client/send.md | 16 ++ http/Client/setCookies.md | 13 ++ http/Client/setOptions.md | 16 ++ http/Client/setSslOptions.md | 13 ++ http/Client/wait.md | 13 ++ http/Url.md | 52 +++++ http/Url/__construct.md | 17 ++ http/Url/__toString.md | 19 ++ http/Url/mod.md | 16 ++ http/Url/toArray.md | 34 ++++ http/Url/toString.md | 11 ++ index.css | 10 +- index.js | 11 +- index.php | 80 ++++++-- php/PropertyProxy.md | 11 ++ php/PropertyProxy/__construct.md | 97 ++++++++++ propro.md | 9 + raphf.md | 18 ++ raphf/clean_persistent_handles.md | 14 ++ raphf/stat_persistent_handles.md | 37 ++++ 50 files changed, 1439 insertions(+), 28 deletions(-) create mode 100644 http/Client.md create mode 100644 http/Client/Curl.md create mode 100644 http/Client/Request.md create mode 100644 http/Client/Response.md create mode 100644 http/Client/Response/getCookies.md create mode 100644 http/Client/Response/getTransferInfo.md create mode 100644 http/Client/__construct.md create mode 100644 http/Client/addCookies.md create mode 100644 http/Client/addSslOptions.md create mode 100644 http/Client/attach.md create mode 100644 http/Client/dequeue.md create mode 100644 http/Client/detach.md create mode 100644 http/Client/enableEvents.md create mode 100644 http/Client/enablePipelining.md create mode 100644 http/Client/enqueue.md create mode 100644 http/Client/getAvailableDrivers.md create mode 100644 http/Client/getCookies.md create mode 100644 http/Client/getHistory.md create mode 100644 http/Client/getObservers.md create mode 100644 http/Client/getOptions.md create mode 100644 http/Client/getProgressInfo.md create mode 100644 http/Client/getResponse.md create mode 100644 http/Client/getSslOptions.md create mode 100644 http/Client/getTransferInfo.md create mode 100644 http/Client/notify.md create mode 100644 http/Client/once.md create mode 100644 http/Client/requeue.md create mode 100644 http/Client/reset.md create mode 100644 http/Client/send.md create mode 100644 http/Client/setCookies.md create mode 100644 http/Client/setOptions.md create mode 100644 http/Client/setSslOptions.md create mode 100644 http/Client/wait.md create mode 100644 http/Url.md create mode 100644 http/Url/__construct.md create mode 100644 http/Url/__toString.md create mode 100644 http/Url/mod.md create mode 100644 http/Url/toArray.md create mode 100644 http/Url/toString.md create mode 100644 php/PropertyProxy.md create mode 100644 php/PropertyProxy/__construct.md create mode 100644 propro.md create mode 100644 raphf.md create mode 100644 raphf/clean_persistent_handles.md create mode 100644 raphf/stat_persistent_handles.md diff --git a/VERSION b/VERSION index 6e8bf73..a163131 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 +0.1.0alpha diff --git a/http.md b/http.md index f439b0d..bf651e2 100644 --- a/http.md +++ b/http.md @@ -2,7 +2,7 @@ > **Note:** This documentation is work-in-progress. -## About +## About: Extended HTTP support. Again. Keep in mind that it's got the major version 2, because it's incompatible with pecl_http v1. diff --git a/http/Client.md b/http/Client.md new file mode 100644 index 0000000..e705769 --- /dev/null +++ b/http/Client.md @@ -0,0 +1,14 @@ +# class http\Client implements SplSubject + +The HTTP client. + +## Properties: + +* private $observers = NULL + SplObjectStorage, attached observers. +* protected $options = NULL + Array of set options. +* protected $history = NULL + http\Message request/response history. +* public $recordHistory = false + Boolean flag whether to record instory in http\Client::$history. diff --git a/http/Client/Curl.md b/http/Client/Curl.md new file mode 100644 index 0000000..d0f692b --- /dev/null +++ b/http/Client/Curl.md @@ -0,0 +1,245 @@ +# namespace http\Client\Curl + +The http\Client\Curl namespace holds option value constants specific to the curl driver of the http\Client. + +## Constants: + +### HTTP Protocol Version + +* HTTP_VERSION_1_0 + Use HTTP/1.0 protocol version. +* HTTP_VERSION_1_1 + Use HTTP/1.1 protocol version. +* HTTP_VERSION_ANY + Use any HTTP protocol version. + +### SSL Protocol Version + +* SSL_VERSION_TLSv1 + Use TLSv1 encryption. +* SSL_VERSION_SSLv2 + Use SSLv2 encryption. +* SSL_VERSION_SSLv3 + Use SSLv3 encryption. +* SSL_VERSION_ANY + Use any encryption. + +### DNS IP Version + +* IPRESOLVE_V4 + Use IPv4 resolver. +* IPRESOLVE_V6 + Use IPv6 resolver. +* IPRESOLVE_ANY + Use any resolver. + +### Authentication Type + +* AUTH_BASIC + Use Basic authentication. +* AUTH_DIGEST + Use Digest authentication. +* AUTH_DIGEST_IE + Use IE (lower v7) quirks with Digest authentication. Available if libcurl is v7.19.3 or more recent. +* AUTH_NTLM + Use NTLM authentication. +* AUTH_GSSNEG + Use GSS-Negotiate authentication. +* AUTH_ANY + Use any authentication. + +### Proxy Protocol Version + +* PROXY_SOCKS4 + Use SOCKSv4 proxy protocol. +* PROXY_SOCKS4A + Use SOCKSv4a proxy protocol. +* PROXY_SOCKS5_HOSTNAME + Use SOCKS5h proxy protocol. +* PROXY_SOCKS5 + Use SOCKS5 proxy protoccol. +* PROXY_HTTP + Use HTTP/1.1 proxy protocol. +* PROXY_HTTP_1_0 + Use HTTP/1.0 proxy protocol. Available if libcurl is v7.19.4 or more recent. + +### POST Redirection Behavior + +* POSTREDIR_301 + Keep POSTing on 301 redirects. Available if libcurl is v7.19.1 or more recent. +* POSTREDIR_302 + Keep POSTing on 302 redirects. Available if libcurl is v7.19.1 or more recent. +* POSTREDIR_ALL + Keep POSTing on any redirect. Available if libcurl is v7.19.1 or more recent. + + +## Options: + +### HTTP + +* int $protocol + The HTTP protocol version. See http\Client\Curl::HTTP_VERSION_* constants. + +### Proxies + +* string $proxyhost + The hostname of the proxy. +* int $proxytype + See http\Client\Curl::PROXY_* constants. +* int $proxyport + The port number of the proxy. +* string $proxyauth + user:password +* int $proxyauthtype + See http\Client\Curl::AUTH_* constants. +* bool $proxytunnel + Tunnel all operations through the proxy. +* string $noproxy + Comma separated list of hosts where no proxy should be used. Available if libcurl is v7.19.4 or more recent. + +### DNS + +* int $dns_cache_timeout + Resolved hosts will be kept fot this number of seconds. +* int $ipresolve + See http\Client\Curl::IPRESOLVE_* constants. +* array $resolve + A list of HOST:PORT:ADDRESS mappings which pre-populate the DNS cache. Available if libcurl is v7.21.3 or more recent. +* string $dns_servers + Comma separated list of custom DNS servers of the form HOST[:PORT]. Available if libcurl is v7.24.0 or more recent. + +### Limits + +* int $low_speed_limit + Minimum speed in bytes per second. +* int $low_speed_time + Maximum time in seconds the transfer can be below $low_speed_limit before cancelling. +* int $maxfilesize + Maximum download size. + +### Connection handling + +* bool $fresh_connect + Force a new connection. +* bool $forbid_reuse + Force closing the connection. + +### Networking + +* string $interface + Outgoing interface name. +* array $portrange + A tuple of min/max ports. +* int $port + Override the URL's port. +* int $address_scope + RFC4007 zone_id. Available if libcurl is v7.19.0 or more recent. +* bool $tcp_keepalive + Whether to use TCP keepalive. Available if libcurl is v7.25.0 or more recent. +* int $tcp_keepidle + Seconds to wait before sending keepalive probes. Available if libcurl is v7.25.0 or more recent. +* int $tcp_keepintvl + Interval in seconds to wait between sending keepalive probes. Available if libcurl is v7.25.0 or more recent. + +### Authentication + +* string $httpauth + user:password +* int $httpauthtype + See http\Client\Curl::AUTH_* constants. + +### Redirection + +* int $redirect + How many redirects to follow. +* bool $unrestricted_auth + Whether to keep sending authentication credentials on redirects to different hosts. +* int $postredir + See http\Client\Curl::POSTREDIR_* constants. Available if libcurl is v7.19.1 or more recent. + +### Retries + +* int $retrycount + Retry this often. +* float $retrydelay + Pause this number of seconds between retries. + +### Special headers + +* string $referer + Custom Referer header. +* bool $autoreferer + Whether to automatically send referers. +* string $useragent + Custom User-Agent header. +* string $etag + Custom ETag. +* bool $compress + Whether to request compressed content (through Accept-Encoding). +* int $lastmodified + Custom If-(Un)Modified since time. If less than zero, the current time will be added. + +### Resume/Ranges + +* int $resume + Resume from this byte offset. +* array $range + Fetch specific ranges (if server supports byte ranges). + +### Cookies + +* bool $encodecookies + Whether to URLencode cookies. +* array $cookies + List of custom cookies in the form ["name" => "value"]. +* bool $cookiesession + Ignore previous session cookies to be loaded from $cookiestore. +* string $cookiestore + Path to a Netscape cookie file, from which cookies will be loaded resp. to which cookies will be written. + +### Timeouts + +* float $timeout + Seconds the complete transfer may take. +* float $connecttimeout + Seconds the connect may take. + +### SSL + +* array $ssl + Subarray of SSL related options: + * string $cert + SSL certificate file. + * string $certtype + Certificate type (DER, PEM). (Secure Transport additionally supports P12). + * string $key + Private key file. + * string $keytype + PK type (PEM, DER, ENG). + * string $keypasswd + The password for the private key. + * string $engine + Crypto engine to use for the private key. + * int $version + See http\Client\Curl::SSL_VERSION_* constants. + * bool $verifypeer + Whether to apply peer verification. + * bool $verifyhost + Whether to apply host verification. + * string $cipher_list + One or more cipher strings separated by colons. + * string $cainfo + CA bundle to verify the peer with. + * string $capath + Directory with prepared CA certs to verify the peer with. + * string $random_file + A file used to read from to seed the random engine. + * string $egdsocket + A Entropy Gathering Daemon socket. + * string $issuercert + CA PEM cert for peer verification. Available if libcurl is v7.19.0 or more recent. + * string $crlfile + File with the concatenation of CRL in PEM format. Available if libcurl was built with OpenSSL support. + * bool $certinfo + Enable gathering of SSL certificate chain information. Available if libcurl is v7.19.1 or more recent. + diff --git a/http/Client/Request.md b/http/Client/Request.md new file mode 100644 index 0000000..a384550 --- /dev/null +++ b/http/Client/Request.md @@ -0,0 +1,15 @@ +# class http\Client\Request extends http\Message + +The http\Client\Request class provides an HTTP message implementation tailored to represent a request message to be sent by the client. + +See http\Client::enqueue(). + +## Constants: + +None. + +## Properties: + +* array $options = NULL + Options for this request, which override client options. + diff --git a/http/Client/Response.md b/http/Client/Response.md new file mode 100644 index 0000000..0b2280a --- /dev/null +++ b/http/Client/Response.md @@ -0,0 +1,11 @@ +# class http\Client\Response extends http\Message + +The http\Client\Response class represents an HTTP message the client returns as answer from a server to an http\Client\Request. + +## Constants: + +None. + +## Properties: + +None. diff --git a/http/Client/Response/getCookies.md b/http/Client/Response/getCookies.md new file mode 100644 index 0000000..15539b9 --- /dev/null +++ b/http/Client/Response/getCookies.md @@ -0,0 +1,39 @@ +# mixed http\Client\Response::getCookies([int $flags = 0[, array $allowed_extras = NULL]]) + +Extract response cookies. +Parses any "Set-Cookie" response headers into an http\Cookie list. See http\Cookie::__construct(). + +## Params: + +* Optional int $flags = 0 + Cookie parser flags. +* Optional array $allowed_extras = NULL + List of keys treated as extras. + +## Returns: + +* array, list of http\Cookie instances. + + +## Example: + + enqueue(new http\Client\Request("GET", "http://php.net/")) + ->send() + ->getResponse(); + + foreach ($response->getCookies() as $cookie) { + /* @var $cookie http\Cookie */ + foreach ($cookie->getCookies() as $name => $value) { + printf("Got a cookie named '%s' with value '%s'\n\tdomain=%s\n\t path=%s\n", + $name, $value, $cookie->getDomain(), $cookie->getPath()); + } + } + ?> + +Yields: + + Got a cookie named 'COUNTRY' with value 'USA,72.52.91.14' + domain=.php.net + path=/ diff --git a/http/Client/Response/getTransferInfo.md b/http/Client/Response/getTransferInfo.md new file mode 100644 index 0000000..94eaf43 --- /dev/null +++ b/http/Client/Response/getTransferInfo.md @@ -0,0 +1,15 @@ +# mixed http\Response::getTransferInfo([string $name = NULL]) + +Retrieve transfer related information after the request has completed. +See http\Client::getTransferInfo(). + +## Params: + +* Optional string $name = NULL + A key to retrieve out of the transfer info. + +## Returns: + +* array, all transfer info if $name was not given. +* mixed, the specific transfer info for $name. +* false, if the request was not complete or $name was not found. diff --git a/http/Client/__construct.md b/http/Client/__construct.md new file mode 100644 index 0000000..adc6299 --- /dev/null +++ b/http/Client/__construct.md @@ -0,0 +1,17 @@ +# void http\Client::__construct([string $driver = NULL[, string $persistent_handle_id = NULL]]) + +Create a new HTTP client. + +Currently only "curl" is supported as a $driver, and used by default. +Persisted resources identified by $persistent_handle_id will be re-used if available. + +## Params: + +* string $driver = NULL + The HTTP client driver to employ. Currently only the default driver, "curl", is supported. +* string $persistent_handle_id = NULL + If supplied, created curl handles will be persisted with this identifier for later reuse. + +# Throws: + +* http\Exception diff --git a/http/Client/addCookies.md b/http/Client/addCookies.md new file mode 100644 index 0000000..69b34db --- /dev/null +++ b/http/Client/addCookies.md @@ -0,0 +1,13 @@ +# http\Client http\Client::addCookies([array $cookies = NULL]) + +Add custom cookies. +See http\Client::setCookies(). + +## Params: + +* Optional array $cookies = NULL + Custom cookies to add. + +## Returns: + +* http\Client, self. diff --git a/http/Client/addSslOptions.md b/http/Client/addSslOptions.md new file mode 100644 index 0000000..b31f2cf --- /dev/null +++ b/http/Client/addSslOptions.md @@ -0,0 +1,13 @@ +# http\Client http\Client::addSslOptions([array $ssl_options = NULL]) + +Add specific SSL options. +See http\Client::setSslOptions(), http\Client::setOptions() and http\Client\Curl::$ssl options. + +## Params: + +* Optional array $ssl_options = NULL + Add this SSL options. + +## Returns: + +* http\Client, self. diff --git a/http/Client/attach.md b/http/Client/attach.md new file mode 100644 index 0000000..8048a3e --- /dev/null +++ b/http/Client/attach.md @@ -0,0 +1,13 @@ +# http\Client http\Client::attach(SplObserver $observer) + +Implements SplSubject. Attach another observer. +Attached observers will be notified with progress of each transfer. + +## Params: + +* SplObserver $observer + An implementation of SplObserver. + +## Returns: + +* http\Client, self. diff --git a/http/Client/dequeue.md b/http/Client/dequeue.md new file mode 100644 index 0000000..1b3fd27 --- /dev/null +++ b/http/Client/dequeue.md @@ -0,0 +1,18 @@ +# http\Client http\Client::dequeue(http\Client\Request $request) + +Dequeue the http\Client\Request $request. + +See http\Client::requeue(), if you want to requeue the request, instead of calling http\Client::dequeue() and then http\Client::enqueue(). + +## Params: + +* http\Client\Request $request + The request to cancel. + +## Returns: + +* http\Client, self. + +## Throws: + +* http\Exception. diff --git a/http/Client/detach.md b/http/Client/detach.md new file mode 100644 index 0000000..a4c70e6 --- /dev/null +++ b/http/Client/detach.md @@ -0,0 +1,12 @@ +# http\Client http\Client::detach(SplObserver $observer) + +Implements SplSubject. Detach $observer, which has been previously attached. + +## Params: + +* SplObserver $observer + Previously attached instance of SplObserver implementation. + +## Returns: + +* http\Client, self. diff --git a/http/Client/enableEvents.md b/http/Client/enableEvents.md new file mode 100644 index 0000000..de38893 --- /dev/null +++ b/http/Client/enableEvents.md @@ -0,0 +1,13 @@ +# http\Client http\Client::enableEvents([bool $enable = true]) + +Enable usage of an event library like libevent, which might improve performance with big socket sets. + +## Params: + +* Optional bool $enable = true + Whether to enable libevent usage. + +## Returns: + +* http\Client, self. + diff --git a/http/Client/enablePipelining.md b/http/Client/enablePipelining.md new file mode 100644 index 0000000..6f19206 --- /dev/null +++ b/http/Client/enablePipelining.md @@ -0,0 +1,12 @@ +# http\Client http\Client::enablePipelining([bool $enable = true]) + +Enable sending pipelined requests to the same host if the driver supports it. + +## Params: + +* Optional bool $enable = true + Whether to enable pipelining. + +## Returns: + +* http\Client, self. diff --git a/http/Client/enqueue.md b/http/Client/enqueue.md new file mode 100644 index 0000000..24ba8fa --- /dev/null +++ b/http/Client/enqueue.md @@ -0,0 +1,33 @@ +# http\Client http\Client::enqueue(http\Client\Request $request[, callable $cb]) + +Add another http\Client\Request to the request queue. +If the optional callback $cb returns true, the request will be automatically dequeued. + +See http\Client::dequeue() and http\Client::send(). + +## Params: + +* http\Client\Request $request + The request to enqueue. +* Optional callable $cb + A callback to automatically call when the request has finished. + +## Returns: + +* http\Client, self. + +## Throws: + +* http\Exception. + +## Example: + + (new http\Client)->enqueue(new http\Client\Request("GET", "http://php.net"), + function(http\Client\Response $res) { + printf("%s returned %d\n", $res->getTransferInfo("effective_url"), $res->getResponseCode()); + return true; // dequeue + })->send(); + +Yields: + + http://php.net/ returned 200 diff --git a/http/Client/getAvailableDrivers.md b/http/Client/getAvailableDrivers.md new file mode 100644 index 0000000..02693f9 --- /dev/null +++ b/http/Client/getAvailableDrivers.md @@ -0,0 +1,24 @@ +# static array http\Client::getAvailableDrivers() + +List available drivers. + +## Params: + +None. + +## Returns: + +* array, list of supported drivers. + +## Example: + + + +Yields: + + array(1) { + [0]=> + string(4) "curl" + } diff --git a/http/Client/getCookies.md b/http/Client/getCookies.md new file mode 100644 index 0000000..e28864b --- /dev/null +++ b/http/Client/getCookies.md @@ -0,0 +1,12 @@ +# array http\Client::getCookies() + +Get priorly set custom cookies. +See http\Client::setCookies(). + +## Params: + +None. + +## Returns: + +* array, custom cookies. diff --git a/http/Client/getHistory.md b/http/Client/getHistory.md new file mode 100644 index 0000000..55beb65 --- /dev/null +++ b/http/Client/getHistory.md @@ -0,0 +1,76 @@ +# http\Message http\Client::getHistory() + +Simply returns the http\Message chain representing the request/response history. + +> **Note:** The history is only recorded while http\Client::$recordHistory is true. + +## Params: + +None. + +## Returns: + +* http\Message, the request/response message chain representing the client's history. + +## Example: + + enqueue(new http\Client\Request("HEAD", "http://php.net")); + $client->enqueue(new http\Client\Request("HEAD", "http://pecl.php.net")); + $client->enqueue(new http\Client\Request("HEAD", "http://pear.php.net")); + $client->recordHistory = true; + $client->send(); + + echo $client->getHistory()->toString(true); + +Yields: + + HEAD / HTTP/1.1 + User-Agent: PECL::HTTP/2.0.0dev (PHP/5.5.5) + Host: pear.php.net + Accept: */* + Content-Length: 0 + + HTTP/1.1 200 OK + Date: Mon, 04 Nov 2013 15:41:48 GMT + Server: ... + X-Powered-By: PHP/5.3.6 + Connection: close + Content-Type: text/html; charset=UTF-8 + Content-Length: 0 + + HEAD / HTTP/1.1 + User-Agent: PECL::HTTP/2.0.0dev (PHP/5.5.5) + Host: pecl.php.net + Accept: */* + Content-Length: 0 + + HTTP/1.1 200 OK + Date: Mon, 04 Nov 2013 14:34:02 GMT + Server: ... + X-Powered-By: PHP/5.2.17 + Set-Cookie: ... + Expires: Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 + Pragma: no-cache + Connection: close + Content-Type: text/html; charset=ISO-8859-1 + Content-Length: 0 + + HEAD / HTTP/1.1 + User-Agent: PECL::HTTP/2.0.0dev (PHP/5.5.5) + Host: php.net + Accept: */* + Content-Length: 0 + + HTTP/1.1 200 OK + Server: ... + Date: Mon, 04 Nov 2013 14:34:08 GMT + Content-Type: text/html;charset=utf-8 + Connection: keep-alive + X-Powered-By: PHP/5.5.4-1 + Content-Language: en + Set-Cookie: ... + Last-Modified: Mon, 04 Nov 2013 21:00:36 GMT + Content-Length: 0 diff --git a/http/Client/getObservers.md b/http/Client/getObservers.md new file mode 100644 index 0000000..fe7d0fb --- /dev/null +++ b/http/Client/getObservers.md @@ -0,0 +1,15 @@ +# SplObjectStorage http\Client::getObservers() + +Returns the SplObjectStorage holding attached observers. + +## Params: + +None. + +## Returns: + +* SplObjectStorage, observer storage. + +## Throws: + +* http\Exception. diff --git a/http/Client/getOptions.md b/http/Client/getOptions.md new file mode 100644 index 0000000..d208d9d --- /dev/null +++ b/http/Client/getOptions.md @@ -0,0 +1,12 @@ +# array http\Client::getOptions() + +Get priorly set options. +See http\Client::setOptions(). + +## Params: + +None. + +## Returns: + +* array, options. diff --git a/http/Client/getProgressInfo.md b/http/Client/getProgressInfo.md new file mode 100644 index 0000000..ca7a5e9 --- /dev/null +++ b/http/Client/getProgressInfo.md @@ -0,0 +1,38 @@ +# object http\Client::getProgressInfo(http\Client\Request $request) + +Retrieve the progress information for $request. + +## Params: + +* http\Client\Request $request + The request to retrieve the current progress information for. + +## Returns: + +* object, stdClass instance holding progress information. +* NULL, if $request is not enqueued. + +## Throws: + +* http\Exception. + +## Example: + +The progress info may look like follows: + + object(stdClass)#6 (7) { + ["started"]=> + bool(true) + ["finished"]=> + bool(true) + ["info"]=> + string(8) "finished" + ["dltotal"]=> + float(0) + ["dlnow"]=> + float(33561) + ["ultotal"]=> + float(0) + ["ulnow"]=> + float(0) + } diff --git a/http/Client/getResponse.md b/http/Client/getResponse.md new file mode 100644 index 0000000..e2dc7ca --- /dev/null +++ b/http/Client/getResponse.md @@ -0,0 +1,36 @@ +# 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. + +> **Note:** If $request is NULL, then the response is removed from the internal storage (stack-like operation). + +## Params: + +* Optional http\Client\Request $request + The request to fetch the stored response for. + +## Returns: + +* http\Client\Response, the stored response for the request, or the last that was received. +* NULL, if no response was found. + +## Example: + + enqueue(new http\Client\Request("GET", "http://php.net")); + $client->enqueue(new http\Client\Request("GET", "http://pecl.php.net")); + $client->enqueue(new http\Client\Request("GET", "http://pear.php.net")); + $client->send(); + + while ($res = $client->getResponse()) { + printf("%s returned %d\n", $res->getTransferInfo("effective_url"), + $res->getResponseCode()); + } + +Yields: + + http://php.net/ returned 200 + http://pecl.php.net/ returned 200 + http://pear.php.net/ returned 200 + diff --git a/http/Client/getSslOptions.md b/http/Client/getSslOptions.md new file mode 100644 index 0000000..cf3e233 --- /dev/null +++ b/http/Client/getSslOptions.md @@ -0,0 +1,12 @@ +# array http\Client::getSslOptions() + +Retrive priorly set SSL options. +See http\Client::getOptions() and http\Client::setSslOptions(). + +## Params: + +None. + +## Returns: + +* array, SSL options. diff --git a/http/Client/getTransferInfo.md b/http/Client/getTransferInfo.md new file mode 100644 index 0000000..30d5cc9 --- /dev/null +++ b/http/Client/getTransferInfo.md @@ -0,0 +1,104 @@ +# object http\Client::getTransferInfo(http\Client\Request $request) + +Get transfer related informatioin for a running or finished request. + +## Params: + +* http\Client\Request $request + The request to probe for transfer info. + +## Returns: + +* object, stdClass instance holding transfer related information. + +## Throws: + +* http\Exception. + +## Example: + +The transfer info might look as follows: + + object(stdClass)#6 (36) { + ["effective_url"]=> + string(16) "https://php.net/" + ["response_code"]=> + int(302) + ["total_time"]=> + float(1.011938) + ["namelookup_time"]=> + float(0.203125) + ["connect_time"]=> + float(0.387202) + ["pretransfer_time"]=> + float(0.794423) + ["size_upload"]=> + float(0) + ["size_download"]=> + float(272) + ["speed_download"]=> + float(268) + ["speed_upload"]=> + float(0) + ["header_size"]=> + int(197) + ["request_size"]=> + int(91) + ["ssl_verifyresult"]=> + int(0) + ["filetime"]=> + int(-1) + ["content_length_download"]=> + float(272) + ["content_length_upload"]=> + float(0) + ["starttransfer_time"]=> + float(1.011835) + ["content_type"]=> + string(29) "text/html; charset=iso-8859-1" + ["redirect_time"]=> + float(0) + ["redirect_count"]=> + int(0) + ["connect_code"]=> + int(0) + ["httpauth_avail"]=> + int(0) + ["proxyauth_avail"]=> + int(0) + ["os_errno"]=> + int(0) + ["num_connects"]=> + int(1) + ["ssl_engines"]=> + array(3) { + [0]=> + string(4) "rsax" + [1]=> + string(6) "rdrand" + [2]=> + string(7) "dynamic" + } + ["cookies"]=> + array(0) { + } + ["redirect_url"]=> + string(15) "http://php.net/" + ["primary_ip"]=> + string(11) "72.52.91.14" + ["appconnect_time"]=> + float(0.794327) + ["condition_unmet"]=> + int(0) + ["primary_port"]=> + int(443) + ["local_ip"]=> + string(13) "192.168.1.120" + ["local_port"]=> + int(51507) + ["certinfo"]=> + array(0) { + } + ["error"]=> + string(0) "" + } diff --git a/http/Client/notify.md b/http/Client/notify.md new file mode 100644 index 0000000..d3f0b86 --- /dev/null +++ b/http/Client/notify.md @@ -0,0 +1,77 @@ +# http\Client http\Client::notify([http\Client\Request $request = NULL[, object $progress = NULL]]) + +Implements SplSubject. Notify attached observers about progress with $request. + +## Params: + +* Optional http\Client\Request $request = NULL + The request to notify about. +* Optional object $progress = NULL + stdClass instance holding progress information. + +## Returns: + +* http\Client, self. + +## Example: + + info, + $progress->dltotal ? ($progress->dlnow*100/$progress->dltotal) : 0); + } + } + + $client = new http\Client; + + $client->attach(new Observer); + $client->enqueue(new http\Client\Request("GET", "https://php.net/images/logos/php-logo.eps")); + $client->send(); + ?> + +May yield: + + start 0% + setup 0% + setup 0% + setup 0% + setup 0% + setup 0% + resolve 0% + connect 0% + connected 0% + connected 0% + connected 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + ssl negotiation 0% + blacklist check 0% + receive 10% + receive 20% + receive 30% + receive 40% + receive 50% + receive 60% + receive 70% + receive 80% + receive 90% + receive 100% + receive 100% + not disconnected 100% + finished 100% diff --git a/http/Client/once.md b/http/Client/once.md new file mode 100644 index 0000000..42b7280 --- /dev/null +++ b/http/Client/once.md @@ -0,0 +1,41 @@ +# bool http\Client::once() + +Perform outstanding transfer actions. +See http\Client::wait() for the completing interface. + +## Params: + +None. + +## Returns: + +* bool, true if there are more transfers to complete. + +## Example: + + enqueue(new http\Client\Request("HEAD", "http://php.net")); + $client->enqueue(new http\Client\Request("HEAD", "http://pecl.php.net")); + $client->enqueue(new http\Client\Request("HEAD", "http://pear.php.net")); + + printf("Transfers ongoing"); + while ($client->once()) { + // do something else here while the network transfers are busy + printf("."); + // and then call http\Client::wait() to wait for new input + $client->wait(); + } + printf("\n"); + + while ($res = $client->getResponse()) { + printf("%s returned %d\n", $res->getTransferInfo("effective_url"), + $res->getResponseCode()); + } + +Yields: + + Transfers ongoing.................................................... + http://php.net/ returned 200 + http://pecl.php.net/ returned 200 + http://pear.php.net/ returned 200 diff --git a/http/Client/requeue.md b/http/Client/requeue.md new file mode 100644 index 0000000..1a3d6fe --- /dev/null +++ b/http/Client/requeue.md @@ -0,0 +1,15 @@ +# http\Client http\Client::requeue(http\Client\Request $request) + +Requeue an http\Client\Request. + +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. + + +## Params: + +* http\Client\Request $request + The request to queue. + +## Returns: + +* http\Client, self. diff --git a/http/Client/reset.md b/http/Client/reset.md new file mode 100644 index 0000000..0b292cc --- /dev/null +++ b/http/Client/reset.md @@ -0,0 +1,11 @@ +# http\Client http\Client::reset() + +Reset the client to the initial state. + +## Params: + +None. + +## Returns: + +* http\Client, self. diff --git a/http/Client/send.md b/http/Client/send.md new file mode 100644 index 0000000..6ea8485 --- /dev/null +++ b/http/Client/send.md @@ -0,0 +1,16 @@ +# http\Client http\Client::send() + +Send all enqueued requests. +See http\Client::once() and http\Client::wait() for a more fine grained interface. + +## Params: + +None. + +## Returns: + +* http\Client, self. + +## Throws: + +* http\Exception. diff --git a/http/Client/setCookies.md b/http/Client/setCookies.md new file mode 100644 index 0000000..415728e --- /dev/null +++ b/http/Client/setCookies.md @@ -0,0 +1,13 @@ +# http\Client http\Client::setCookies([array $cookies = NULL]) + +Set custom cookies. +See http\Client::addCookies() and http\Client::getCookies(). + +## Params: + +* Optional array $cookies = NULL + Set the custom cookies to this array. + +## Returns: + +* http\Client, self. diff --git a/http/Client/setOptions.md b/http/Client/setOptions.md new file mode 100644 index 0000000..370441d --- /dev/null +++ b/http/Client/setOptions.md @@ -0,0 +1,16 @@ +# http\Client http\Client::setOptions([array $options = NULL]) + +Set client options. +See http\Client\Curl. + +> **Note:** Only options specified prior enqueueing a request are applied to the request. + +## Params: + +* Optional array $options = NULL + The options to set. + +## Returns: + +* http\Client, self. + diff --git a/http/Client/setSslOptions.md b/http/Client/setSslOptions.md new file mode 100644 index 0000000..d79f992 --- /dev/null +++ b/http/Client/setSslOptions.md @@ -0,0 +1,13 @@ +# http\Client http\Client::setSslOptions([array $ssl_options = NULL]) + +Specifically set SSL options. +See http\Client::setOptions() and http\Client\Curl::$ssl options. + +## Params: + +* Optional array $ssl_options = NULL + Set SSL options to this array. + +## Returns: + +* http\Client, self. diff --git a/http/Client/wait.md b/http/Client/wait.md new file mode 100644 index 0000000..c7d3971 --- /dev/null +++ b/http/Client/wait.md @@ -0,0 +1,13 @@ +# bool http\Client::wait([float $timeout = 0]) + +Wait for $timeout seconds for transfers to provide data. +This is the completion call to http\Client::once(). + +## Params: + +* Optional float $timeout = 0 + Seconds to wait for data on open sockets. + +## Returns: + +* bool, success. diff --git a/http/Url.md b/http/Url.md new file mode 100644 index 0000000..8069c34 --- /dev/null +++ b/http/Url.md @@ -0,0 +1,52 @@ +# class http\Url extends http\Object + +The http\Url class provides versatile means to parse, construct and manipulate URLs. + +## Constants: + +* REPLACE + Replace parts of the old URL with parts of the new. +* JOIN_PATH + Whether a relative path should be joined into the old path. +* JOIN_QUERY + Whether the querystrings should be joined. +* STRIP_USER + Strip the user information from the URL. +* STRIP_PASS + Strip the password from the URL. +* STRIP_AUTH + Strip user and password information from URL (same as STRIP_USER|STRIP_PASS). +* STRIP_PORT + Do not include the port. +* STRIP_PATH + Do not include the URL path. +* STRIP_QUERY + Do not include the URL querystring. +* STRIP_FRAMGENT + Strip the fragment (hash) from the URL. +* STRIP_ALL + Strip everything except scheme and host information. +* FROM_ENV + Import initial URL parts from the SAPI environment. +* SANITIZE_PATH + Whether to sanitize the URL path (consolidate double slashes, directory jumps etc.) + + +## Properties: + +* public $scheme = NULL + The URL's scheme. +* public $user = NULL + Authenticating user. +* public $pass = NULL + Authentication password. +* public $host = NULL + Hostname/domain. +* public $port = NULL + Port. +* public $path = NULL + URL path. +* public $query = NULL + URL querystring. +* public $fragment = NULL + URL fragment (hash). diff --git a/http/Url/__construct.md b/http/Url/__construct.md new file mode 100644 index 0000000..6d67306 --- /dev/null +++ b/http/Url/__construct.md @@ -0,0 +1,17 @@ +# void http\Url::__construct([mixed $old_url = NULL[, mixed $new_url = NULL[, int $flags = http\Url::FROM_ENV]]]) + +Create an instance of an http\URL. + +## Params: + +* Optional mixed $old_url = NULL + Initial URL parts. Either an array, object, http\Url instance or string to parse. +* Optional mixed $new_url = NULL + Overriding URL parts. Either an array, object, http\Url instance or string to parse. +* Optional int $flags = http\Url::FROM_ENV + The modus operandi of constructing the url. See http\Url constants. + +## Throws: + +* http\Exception + diff --git a/http/Url/__toString.md b/http/Url/__toString.md new file mode 100644 index 0000000..6ef37aa --- /dev/null +++ b/http/Url/__toString.md @@ -0,0 +1,19 @@ +# string http\Url::__toString() + +String cast handler. Alias of http\Url::toString(). + +## Params: + +None. + +## Returns: + +* string, the URL as string. + +## Example: + + echo new http\Url; + +Yields: + + http://localhost/ diff --git a/http/Url/mod.md b/http/Url/mod.md new file mode 100644 index 0000000..52b1f53 --- /dev/null +++ b/http/Url/mod.md @@ -0,0 +1,16 @@ +# http\Url http\Url::mod(mixed $parts[, int $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY) + +Clone this URL and apply $parts to the cloned URL. + +> **Note:** This method returns a clone (copy) of this instance. + +## Params: + +* mixed $parts + New URL parts. +* Optional int $flags = http\Url::JOIN_PATH|http\Url::JOIN_QUERY + Modus operandi of URL construction. See http\Url constants. + +## Returns: + +* http\Url, clone. diff --git a/http/Url/toArray.md b/http/Url/toArray.md new file mode 100644 index 0000000..d800043 --- /dev/null +++ b/http/Url/toArray.md @@ -0,0 +1,34 @@ +# array http\Url::toArray() + +Retrieve the URL parts as array. + +## Params: + +None. + +## Returns: + +* array, the URL parts. + +## Example: + + var_dump((new http\Url)->toArray()); + +Yields: + + array(7) { + ["scheme"]=> + string(4) "http" + ["user"]=> + string(0) "" + ["pass"]=> + string(0) "" + ["host"]=> + string(7) "smugmug" + ["path"]=> + string(1) "/" + ["query"]=> + string(0) "" + ["fragment"]=> + string(0) "" + } diff --git a/http/Url/toString.md b/http/Url/toString.md new file mode 100644 index 0000000..78826bd --- /dev/null +++ b/http/Url/toString.md @@ -0,0 +1,11 @@ +# string http\Url::toString() + +Get the string prepresentation of the URL. + +## Params: + +None. + +## Returns: + +* string, the URL as string. diff --git a/index.css b/index.css index e91ade1..afc59ec 100644 --- a/index.css +++ b/index.css @@ -2,8 +2,10 @@ font-size: 99.9%; } -body { +body, code { font-family: Inconsolata, Monospace, 'Courier New', Courier, monospace; +} +body { font-size: 1.5em; margin: 0; padding: 0; @@ -17,12 +19,16 @@ body>* { .sidebar { font-size: .9em; float: right; - width: 500px; background: #f0f0f0; border-bottom-left-radius: 10px; padding: 0; + width: auto; + padding-right: 1em; + /* + width: 520px; margin-bottom: .2em; margin-left: 2em; + * */ } .sidebar>ul { } diff --git a/index.js b/index.js index f02ac5a..45b5bb8 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,11 @@ function log() { } function is_constant(s) { - return s.length > 1 && s.toUpperCase(s) === s; + s = s.replace(/v\d+(_\d+)?$/, ""); + if (s.length < 2) { + return false; + } + return s.toUpperCase(s) === s; } function is_variable(s) { @@ -48,6 +52,7 @@ function type(s, nn) { case "RecursiveArrayIterator": case "SplObserver": case "SplSubject": + case "SplObjectStorage": return ""; // keywords @@ -145,10 +150,10 @@ function walk(i, e) { function blink(c) { var $c = $(c); - $c.fadeOut("slow").queue(function(next) { + $c.fadeOut("fast").queue(function(next) { this.style.color = "red"; next(); - }).fadeIn("fast").fadeOut("fast").queue(function(next) { + }).fadeIn("fast").fadeOut("slow").queue(function(next) { this.style.color = ""; next(); }).fadeIn("slow"); diff --git a/index.php b/index.php index 93454ec..1e09d32 100644 --- a/index.php +++ b/index.php @@ -62,7 +62,25 @@ function head($file, $lines = 1) { return $ld; } -function ns($file) { +function ns($path) { + $ns = ""; + $parts = explode("/", $path); + $upper = ctype_upper($path[0]); + for ($i = 0; $i < count($parts); ++$i) { + if (!strlen($parts[$i]) || $parts[$i] === ".") { + continue; + } + if (strlen($ns)) { + if ($upper && !ctype_upper($parts[$i][0])) { + $ns .= "::"; + } else { + $ns .= "\\"; + } + } + $ns .= $parts[$i]; + $upper = ctype_upper($parts[$i][0]); + } + return $ns; return str_replace("/", "\\", str_replace("//", "/", trim($file, "/."))); } @@ -98,12 +116,13 @@ function ls($dir) { if (!isset($pi["extension"]) || $pi["extension"] != "md") { continue; } - if (!is_dir("$dir/".$pi["filename"])) { + /* ignore files where an accompanying directory exists */ + if (is_dir("$dir/".$pi["filename"])) { continue; } } else { - /* ignore directories where an companying file exists */ - if (is_file("$path.md")) { + /* ignore directories where no accompanying file exists */ + if (!is_file("$path.md")) { continue; } } @@ -130,24 +149,43 @@ function ml($file) { return; } if (!ctype_upper($pi["filename"][0])) { - return; - } - $dir = $pi["dirname"] . "/" . $pi["filename"]; - if (is_dir($dir)) { - printf("

Methods:

\n"); - printf("\n"); } } @@ -160,7 +198,7 @@ function md($file) { case "md": $r = fopen($file, "r"); $md = MarkdownDocument::createFromStream($r); - $md->compile(MarkdownDocument::AUTOLINK); + $md->compile(MarkdownDocument::AUTOLINK|MarkdownDocument::TOC); print str_replace("
","
",$md->getHtml()); fclose($r); ml($file); diff --git a/php/PropertyProxy.md b/php/PropertyProxy.md new file mode 100644 index 0000000..5e82e3e --- /dev/null +++ b/php/PropertyProxy.md @@ -0,0 +1,11 @@ +# final class php\PropertyProxy + +This is the user-land visible PropertyProxy class. + +## Constants: + +None. + +## Properties: + +None. diff --git a/php/PropertyProxy/__construct.md b/php/PropertyProxy/__construct.md new file mode 100644 index 0000000..747e8c1 --- /dev/null +++ b/php/PropertyProxy/__construct.md @@ -0,0 +1,97 @@ +# void php\PropertyProxy::__construct(mixed &$object, string $member[, php\PropertyProxy $parent = NLL]) + +Create a new property proxy for the property $member of $object. + +## Params: + +* mixed reference &$object + The storage from which to reference the property. +* string $member + The name of the property to reference. +* php\PropertyProxy $parent = NULL + Any parent property proxy. + +## Example: + + class c { + private $storage = array(); + function __get($p) { + return new php\PropertyProxy($this->storage, $p); + } + function __set($p, $v) { + $this->storage[$p] = $v; + } + } + + $c = new c; + $c->data["foo"] = 1; + + var_dump($c); + + $c->data[] = 1; + $c->data[] = 2; + $c->data[] = 3; + $c->data["bar"][] = 123; + $c->data["bar"][] = 456; + + var_dump($c); + unset($c->data["bar"][0]); + + var_dump($c); + +Yields: + + object(c)#1 (1) { + ["storage":"c":private]=> + array(1) { + ["data"]=> + array(1) { + ["foo"]=> + int(1) + } + } + } + object(c)#1 (1) { + ["storage":"c":private]=> + array(1) { + ["data"]=> + array(5) { + ["foo"]=> + int(1) + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + ["bar"]=> + array(2) { + [0]=> + int(123) + [1]=> + int(456) + } + } + } + } + object(c)#1 (1) { + ["storage":"c":private]=> + array(1) { + ["data"]=> + array(5) { + ["foo"]=> + int(1) + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + ["bar"]=> + array(1) { + [1]=> + int(456) + } + } + } + } diff --git a/propro.md b/propro.md new file mode 100644 index 0000000..bd01503 --- /dev/null +++ b/propro.md @@ -0,0 +1,9 @@ +# pecl/propro + +## About: + +The "Property Proxy" extension provides a fairly transparent proxy for internal object properties hidden in custom non-zval implementations. + +> **Note:** This extension mostly only provides infrastructure for other extensions. + +See the php\PropertyProxy class, for the user-land visible part of the implementation. diff --git a/raphf.md b/raphf.md new file mode 100644 index 0000000..5b112a2 --- /dev/null +++ b/raphf.md @@ -0,0 +1,18 @@ +# pecl/raphf + +## About: + +The **"Resource and Persistent Handle Factory"** extension provides facilities to manage those in a convenient manner. + +> **Note:** This extension mostly only provides infrastructure for other extensions. + +## Installation: + +This extension is hosted at PECL () and can be installed eith PEAR's pecl command: + + # pecl install raphf + +## INI Directives: + +* raphf.persistent_handle.limit = -1 + The per process/thread persistent handle limit. diff --git a/raphf/clean_persistent_handles.md b/raphf/clean_persistent_handles.md new file mode 100644 index 0000000..ad8a8ac --- /dev/null +++ b/raphf/clean_persistent_handles.md @@ -0,0 +1,14 @@ +# void raphf\clean_persistent_handles([string name = NULL[, string $ident]]) + +Clean persistent handles whith id $name->$ident. + +## Params + +* Optional string $name = NULL + The persistent handle id. +* Optional string $ident = NULL + The unique identifier within the persistent handle id. + +## Example: + + raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "php.net:80"); diff --git a/raphf/stat_persistent_handles.md b/raphf/stat_persistent_handles.md new file mode 100644 index 0000000..7764187 --- /dev/null +++ b/raphf/stat_persistent_handles.md @@ -0,0 +1,37 @@ +# object raphf\stat_persistent_handles() + +Retrieve statistics about current process'/thread's persistent handles. + +## Params: + +None. + +## Returns: + +* object, stdClass instance + + +## Example: + + var_dump(raphf\stat_persistent_handles()); + +Yields: + + object(stdClass)#6 (3) { + ["http\Client\Curl"]=> + array(0) { + } + ["http\Client\Curl\Request"]=> + array(1) { + ["php.net:80"]=> + array(2) { + ["used"]=> + int(2) + ["free"]=> + int(1) + } + } + ["pq\Connection"]=> + array(0) { + } + } -- 2.30.2