Projects
Kolab:16:Testing
php-pear-HTTP-Request2
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
php-pear-HTTP-Request2.spec
Changed
@@ -28,7 +28,7 @@ %else Name: php-pear-HTTP-Request2 %endif -Version: 2.3.0 +Version: 2.6.0 Release: 1%{?dist} Summary: Provides an easy way to perform HTTP requests @@ -149,6 +149,9 @@ %changelog +* Tue Jul 09 2024 Christoph Erhardt <kolab@sicherha.de> - 2.6.0-1 +- Update to 2.6.0 + * Sun Feb 14 2016 Remi Collet <remi@fedoraproject.org> - 2.3.0-1 - update to 2.3.0 (stable) - raise dependency on Net_URL2 >= 2.2.0
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2.php
Deleted
@@ -1,1037 +0,0 @@ -<?php -/** - * Class representing a HTTP request message - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** - * A class representing an URL as per RFC 3986. - */ -if (!class_exists('Net_URL2', true)) { - require_once 'Net/URL2.php'; -} - -/** - * Exception class for HTTP_Request2 package - */ -require_once 'HTTP/Request2/Exception.php'; - -/** - * Class representing a HTTP request message - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - * @link http://tools.ietf.org/html/rfc2616#section-5 - */ -class HTTP_Request2 implements SplSubject -{ - /**#@+ - * Constants for HTTP request methods - * - * @link http://tools.ietf.org/html/rfc2616#section-5.1.1 - */ - const METHOD_OPTIONS = 'OPTIONS'; - const METHOD_GET = 'GET'; - const METHOD_HEAD = 'HEAD'; - const METHOD_POST = 'POST'; - const METHOD_PUT = 'PUT'; - const METHOD_DELETE = 'DELETE'; - const METHOD_TRACE = 'TRACE'; - const METHOD_CONNECT = 'CONNECT'; - /**#@-*/ - - /**#@+ - * Constants for HTTP authentication schemes - * - * @link http://tools.ietf.org/html/rfc2617 - */ - const AUTH_BASIC = 'basic'; - const AUTH_DIGEST = 'digest'; - /**#@-*/ - - /** - * Regular expression used to check for invalid symbols in RFC 2616 tokens - * @link http://pear.php.net/bugs/bug.php?id=15630 - */ - const REGEXP_INVALID_TOKEN = '!\x00-\x1f\x7f-\xff()<>@,;:\\\\"/\\?={}\s!'; - - /** - * Regular expression used to check for invalid symbols in cookie strings - * @link http://pear.php.net/bugs/bug.php?id=15630 - * @link http://web.archive.org/web/20080331104521/http://cgi.netscape.com/newsref/std/cookie_spec.html - */ - const REGEXP_INVALID_COOKIE = '/\s,;/'; - - /** - * Fileinfo magic database resource - * @var resource - * @see detectMimeType() - */ - private static $_fileinfoDb; - - /** - * Observers attached to the request (instances of SplObserver) - * @var array - */ - protected $observers = array(); - - /** - * Request URL - * @var Net_URL2 - */ - protected $url; - - /** - * Request method - * @var string - */ - protected $method = self::METHOD_GET; - - /** - * Authentication data - * @var array - * @see getAuth() - */ - protected $auth; - - /** - * Request headers - * @var array - */ - protected $headers = array(); - - /** - * Configuration parameters - * @var array - * @see setConfig() - */ - protected $config = array( - 'adapter' => 'HTTP_Request2_Adapter_Socket', - 'connect_timeout' => 10, - 'timeout' => 0, - 'use_brackets' => true, - 'protocol_version' => '1.1', - 'buffer_size' => 16384, - 'store_body' => true, - 'local_ip' => null, - - 'proxy_host' => '', - 'proxy_port' => '', - 'proxy_user' => '', - 'proxy_password' => '', - 'proxy_auth_scheme' => self::AUTH_BASIC, - 'proxy_type' => 'http', - - 'ssl_verify_peer' => true, - 'ssl_verify_host' => true, - 'ssl_cafile' => null, - 'ssl_capath' => null, - 'ssl_local_cert' => null, - 'ssl_passphrase' => null, - - 'digest_compat_ie' => false, - - 'follow_redirects' => false, - 'max_redirects' => 5, - 'strict_redirects' => false - ); - - /** - * Last event in request / response handling, intended for observers - * @var array - * @see getLastEvent() - */ - protected $lastEvent = array( - 'name' => 'start', - 'data' => null - ); - - /** - * Request body - * @var string|resource - * @see setBody() - */ - protected $body = ''; - - /** - * Array of POST parameters - * @var array - */ - protected $postParams = array(); - - /** - * Array of file uploads (for multipart/form-data POST requests) - * @var array - */ - protected $uploads = array(); - - /** - * Adapter used to perform actual HTTP request - * @var HTTP_Request2_Adapter - */ - protected $adapter; - - /** - * Cookie jar to persist cookies between requests - * @var HTTP_Request2_CookieJar - */ - protected $cookieJar = null; - - /** - * Constructor. Can set request URL, method and configuration array. - * - * Also sets a default value for User-Agent header. - * - * @param string|Net_Url2 $url Request URL - * @param string $method Request method - * @param array $config Configuration for this Request instance - */ - public function __construct( - $url = null, $method = self::METHOD_GET, array $config = array() - ) { - $this->setConfig($config); - if (!empty($url)) { - $this->setUrl($url); - } - if (!empty($method)) { - $this->setMethod($method); - } - $this->setHeader( - 'user-agent', 'HTTP_Request2/2.3.0 ' . - '(http://pear.php.net/package/http_request2) PHP/' . phpversion() - ); - } - - /** - * Sets the URL for this request - * - * If the URL has userinfo part (username & password) these will be removed - * and converted to auth data. If the URL does not have a path component, - * that will be set to '/'. - * - * @param string|Net_URL2 $url Request URL - * - * @return HTTP_Request2 - * @throws HTTP_Request2_LogicException - */ - public function setUrl($url) - { - if (is_string($url)) { - $url = new Net_URL2( - $url, array(Net_URL2::OPTION_USE_BRACKETS => $this->config'use_brackets') - ); - } - if (!$url instanceof Net_URL2) { - throw new HTTP_Request2_LogicException( - 'Parameter is not a valid HTTP URL', - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - // URL contains username / password? - if ($url->getUserinfo()) { - $username = $url->getUser(); - $password = $url->getPassword(); - $this->setAuth(rawurldecode($username), $password? rawurldecode($password): ''); - $url->setUserinfo(''); - } - if ('' == $url->getPath()) { - $url->setPath('/'); - } - $this->url = $url; - - return $this; - } - - /** - * Returns the request URL - * - * @return Net_URL2 - */ - public function getUrl() - { - return $this->url; - } - - /** - * Sets the request method - * - * @param string $method one of the methods defined in RFC 2616 - * - * @return HTTP_Request2 - * @throws HTTP_Request2_LogicException if the method name is invalid - */ - public function setMethod($method) - { - // Method name should be a token: http://tools.ietf.org/html/rfc2616#section-5.1.1 - if (preg_match(self::REGEXP_INVALID_TOKEN, $method)) { - throw new HTTP_Request2_LogicException( - "Invalid request method '{$method}'", - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - $this->method = $method; - - return $this; - } - - /** - * Returns the request method - * - * @return string - */ - public function getMethod() - { - return $this->method; - } - - /** - * Sets the configuration parameter(s) - * - * The following parameters are available: - * <ul> - * <li> 'adapter' - adapter to use (string)</li> - * <li> 'connect_timeout' - Connection timeout in seconds (integer)</li> - * <li> 'timeout' - Total number of seconds a request can take. - * Use 0 for no limit, should be greater than - * 'connect_timeout' if set (integer)</li> - * <li> 'use_brackets' - Whether to append to array variable names (bool)</li> - * <li> 'protocol_version' - HTTP Version to use, '1.0' or '1.1' (string)</li> - * <li> 'buffer_size' - Buffer size to use for reading and writing (int)</li> - * <li> 'store_body' - Whether to store response body in response object. - * Set to false if receiving a huge response and - * using an Observer to save it (boolean)</li> - * <li> 'local_ip' - Specifies the IP address that will be used for accessing - * the network (string)</li> - * <li> 'proxy_type' - Proxy type, 'http' or 'socks5' (string)</li> - * <li> 'proxy_host' - Proxy server host (string)</li> - * <li> 'proxy_port' - Proxy server port (integer)</li> - * <li> 'proxy_user' - Proxy auth username (string)</li> - * <li> 'proxy_password' - Proxy auth password (string)</li> - * <li> 'proxy_auth_scheme' - Proxy auth scheme, one of HTTP_Request2::AUTH_* constants (string)</li> - * <li> 'proxy' - Shorthand for proxy_* parameters, proxy given as URL, - * e.g. 'socks5://localhost:1080/' (string)</li> - * <li> 'ssl_verify_peer' - Whether to verify peer's SSL certificate (bool)</li> - * <li> 'ssl_verify_host' - Whether to check that Common Name in SSL - * certificate matches host name (bool)</li> - * <li> 'ssl_cafile' - Cerificate Authority file to verify the peer - * with (use with 'ssl_verify_peer') (string)</li> - * <li> 'ssl_capath' - Directory holding multiple Certificate - * Authority files (string)</li> - * <li> 'ssl_local_cert' - Name of a file containing local cerificate (string)</li> - * <li> 'ssl_passphrase' - Passphrase with which local certificate - * was encoded (string)</li> - * <li> 'digest_compat_ie' - Whether to imitate behaviour of MSIE 5 and 6 - * in using URL without query string in digest - * authentication (boolean)</li> - * <li> 'follow_redirects' - Whether to automatically follow HTTP Redirects (boolean)</li> - * <li> 'max_redirects' - Maximum number of redirects to follow (integer)</li> - * <li> 'strict_redirects' - Whether to keep request method on redirects via status 301 and - * 302 (true, needed for compatibility with RFC 2616) - * or switch to GET (false, needed for compatibility with most - * browsers) (boolean)</li> - * </ul> - * - * @param string|array $nameOrConfig configuration parameter name or array - * ('parameter name' => 'parameter value') - * @param mixed $value parameter value if $nameOrConfig is not an array - * - * @return HTTP_Request2 - * @throws HTTP_Request2_LogicException If the parameter is unknown - */ - public function setConfig($nameOrConfig, $value = null) - { - if (is_array($nameOrConfig)) { - foreach ($nameOrConfig as $name => $value) { - $this->setConfig($name, $value); - } - - } elseif ('proxy' == $nameOrConfig) { - $url = new Net_URL2($value); - $this->setConfig(array( - 'proxy_type' => $url->getScheme(), - 'proxy_host' => $url->getHost(), - 'proxy_port' => $url->getPort(), - 'proxy_user' => rawurldecode($url->getUser()), - 'proxy_password' => rawurldecode($url->getPassword()) - )); - - } else { - if (!array_key_exists($nameOrConfig, $this->config)) { - throw new HTTP_Request2_LogicException( - "Unknown configuration parameter '{$nameOrConfig}'", - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - $this->config$nameOrConfig = $value; - } - - return $this; - } - - /** - * Returns the value(s) of the configuration parameter(s) - * - * @param string $name parameter name - * - * @return mixed value of $name parameter, array of all configuration - * parameters if $name is not given - * @throws HTTP_Request2_LogicException If the parameter is unknown - */ - public function getConfig($name = null) - { - if (null === $name) { - return $this->config; - } elseif (!array_key_exists($name, $this->config)) { - throw new HTTP_Request2_LogicException( - "Unknown configuration parameter '{$name}'", - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - return $this->config$name; - } - - /** - * Sets the autentification data - * - * @param string $user user name - * @param string $password password - * @param string $scheme authentication scheme - * - * @return HTTP_Request2 - */ - public function setAuth($user, $password = '', $scheme = self::AUTH_BASIC) - { - if (empty($user)) { - $this->auth = null; - } else { - $this->auth = array( - 'user' => (string)$user, - 'password' => (string)$password, - 'scheme' => $scheme - ); - } - - return $this; - } - - /** - * Returns the authentication data - * - * The array has the keys 'user', 'password' and 'scheme', where 'scheme' - * is one of the HTTP_Request2::AUTH_* constants. - * - * @return array - */ - public function getAuth() - { - return $this->auth; - } - - /** - * Sets request header(s) - * - * The first parameter may be either a full header string 'header: value' or - * header name. In the former case $value parameter is ignored, in the latter - * the header's value will either be set to $value or the header will be - * removed if $value is null. The first parameter can also be an array of - * headers, in that case method will be called recursively. - * - * Note that headers are treated case insensitively as per RFC 2616. - * - * <code> - * $req->setHeader('Foo: Bar'); // sets the value of 'Foo' header to 'Bar' - * $req->setHeader('FoO', 'Baz'); // sets the value of 'Foo' header to 'Baz' - * $req->setHeader(array('foo' => 'Quux')); // sets the value of 'Foo' header to 'Quux' - * $req->setHeader('FOO'); // removes 'Foo' header from request - * </code> - * - * @param string|array $name header name, header string ('Header: value') - * or an array of headers - * @param string|array|null $value header value if $name is not an array, - * header will be removed if value is null - * @param bool $replace whether to replace previous header with the - * same name or append to its value - * - * @return HTTP_Request2 - * @throws HTTP_Request2_LogicException - */ - public function setHeader($name, $value = null, $replace = true) - { - if (is_array($name)) { - foreach ($name as $k => $v) { - if (is_string($k)) { - $this->setHeader($k, $v, $replace); - } else { - $this->setHeader($v, null, $replace); - } - } - } else { - if (null === $value && strpos($name, ':')) { - list($name, $value) = array_map('trim', explode(':', $name, 2)); - } - // Header name should be a token: http://tools.ietf.org/html/rfc2616#section-4.2 - if (preg_match(self::REGEXP_INVALID_TOKEN, $name)) { - throw new HTTP_Request2_LogicException( - "Invalid header name '{$name}'", - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - // Header names are case insensitive anyway - $name = strtolower($name); - if (null === $value) { - unset($this->headers$name); - - } else { - if (is_array($value)) { - $value = implode(', ', array_map('trim', $value)); - } elseif (is_string($value)) { - $value = trim($value); - } - if (!isset($this->headers$name) || $replace) { - $this->headers$name = $value; - } else { - $this->headers$name .= ', ' . $value; - } - } - } - - return $this; - } - - /** - * Returns the request headers - * - * The array is of the form ('header name' => 'header value'), header names - * are lowercased - * - * @return array - */ - public function getHeaders() - { - return $this->headers; - } - - /** - * Adds a cookie to the request - * - * If the request does not have a CookieJar object set, this method simply - * appends a cookie to "Cookie:" header. - * - * If a CookieJar object is available, the cookie is stored in that object. - * Data from request URL will be used for setting its 'domain' and 'path' - * parameters, 'expires' and 'secure' will be set to null and false, - * respectively. If you need further control, use CookieJar's methods. - * - * @param string $name cookie name - * @param string $value cookie value - * - * @return HTTP_Request2 - * @throws HTTP_Request2_LogicException - * @see setCookieJar() - */ - public function addCookie($name, $value) - { - if (!empty($this->cookieJar)) { - $this->cookieJar->store( - array('name' => $name, 'value' => $value), $this->url - ); - - } else { - $cookie = $name . '=' . $value; - if (preg_match(self::REGEXP_INVALID_COOKIE, $cookie)) { - throw new HTTP_Request2_LogicException( - "Invalid cookie: '{$cookie}'", - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - $cookies = empty($this->headers'cookie')? '': $this->headers'cookie' . '; '; - $this->setHeader('cookie', $cookies . $cookie); - } - - return $this; - } - - /** - * Sets the request body - * - * If you provide file pointer rather than file name, it should support - * fstat() and rewind() operations. - * - * @param string|resource|HTTP_Request2_MultipartBody $body Either a - * string with the body or filename containing body or - * pointer to an open file or object with multipart body data - * @param bool $isFilename Whether - * first parameter is a filename - * - * @return HTTP_Request2 - * @throws HTTP_Request2_LogicException - */ - public function setBody($body, $isFilename = false) - { - if (!$isFilename && !is_resource($body)) { - if (!$body instanceof HTTP_Request2_MultipartBody) { - $this->body = (string)$body; - } else { - $this->body = $body; - } - } else { - $fileData = $this->fopenWrapper($body, empty($this->headers'content-type')); - $this->body = $fileData'fp'; - if (empty($this->headers'content-type')) { - $this->setHeader('content-type', $fileData'type'); - } - } - $this->postParams = $this->uploads = array(); - - return $this; - } - - /** - * Returns the request body - * - * @return string|resource|HTTP_Request2_MultipartBody - */ - public function getBody() - { - if (self::METHOD_POST == $this->method - && (!empty($this->postParams) || !empty($this->uploads)) - ) { - if (0 === strpos($this->headers'content-type', 'application/x-www-form-urlencoded')) { - $body = http_build_query($this->postParams, '', '&'); - if (!$this->getConfig('use_brackets')) { - $body = preg_replace('/%5B\d+%5D=/', '=', $body); - } - // support RFC 3986 by not encoding '~' symbol (request #15368) - return str_replace('%7E', '~', $body); - - } elseif (0 === strpos($this->headers'content-type', 'multipart/form-data')) { - require_once 'HTTP/Request2/MultipartBody.php'; - return new HTTP_Request2_MultipartBody( - $this->postParams, $this->uploads, $this->getConfig('use_brackets') - ); - } - } - return $this->body; - } - - /** - * Adds a file to form-based file upload - * - * Used to emulate file upload via a HTML form. The method also sets - * Content-Type of HTTP request to 'multipart/form-data'. - * - * If you just want to send the contents of a file as the body of HTTP - * request you should use setBody() method. - * - * If you provide file pointers rather than file names, they should support - * fstat() and rewind() operations. - * - * @param string $fieldName name of file-upload field - * @param string|resource|array $filename full name of local file, - * pointer to open file or an array of files - * @param string $sendFilename filename to send in the request - * @param string $contentType content-type of file being uploaded - * - * @return HTTP_Request2 - * @throws HTTP_Request2_LogicException - */ - public function addUpload( - $fieldName, $filename, $sendFilename = null, $contentType = null - ) { - if (!is_array($filename)) { - $fileData = $this->fopenWrapper($filename, empty($contentType)); - $this->uploads$fieldName = array( - 'fp' => $fileData'fp', - 'filename' => !empty($sendFilename)? $sendFilename - :(is_string($filename)? basename($filename): 'anonymous.blob') , - 'size' => $fileData'size', - 'type' => empty($contentType)? $fileData'type': $contentType - ); - } else { - $fps = $names = $sizes = $types = array(); - foreach ($filename as $f) { - if (!is_array($f)) { - $f = array($f); - } - $fileData = $this->fopenWrapper($f0, empty($f2)); - $fps = $fileData'fp'; - $names = !empty($f1)? $f1 - :(is_string($f0)? basename($f0): 'anonymous.blob'); - $sizes = $fileData'size'; - $types = empty($f2)? $fileData'type': $f2; - } - $this->uploads$fieldName = array( - 'fp' => $fps, 'filename' => $names, 'size' => $sizes, 'type' => $types - ); - } - if (empty($this->headers'content-type') - || 'application/x-www-form-urlencoded' == $this->headers'content-type' - ) { - $this->setHeader('content-type', 'multipart/form-data'); - } - - return $this; - } - - /** - * Adds POST parameter(s) to the request. - * - * @param string|array $name parameter name or array ('name' => 'value') - * @param mixed $value parameter value (can be an array) - * - * @return HTTP_Request2 - */ - public function addPostParameter($name, $value = null) - { - if (!is_array($name)) { - $this->postParams$name = $value; - } else { - foreach ($name as $k => $v) { - $this->addPostParameter($k, $v); - } - } - if (empty($this->headers'content-type')) { - $this->setHeader('content-type', 'application/x-www-form-urlencoded'); - } - - return $this; - } - - /** - * Attaches a new observer - * - * @param SplObserver $observer any object implementing SplObserver - */ - public function attach(SplObserver $observer) - { - foreach ($this->observers as $attached) { - if ($attached === $observer) { - return; - } - } - $this->observers = $observer; - } - - /** - * Detaches an existing observer - * - * @param SplObserver $observer any object implementing SplObserver - */ - public function detach(SplObserver $observer) - { - foreach ($this->observers as $key => $attached) { - if ($attached === $observer) { - unset($this->observers$key); - return; - } - } - } - - /** - * Notifies all observers - */ - public function notify() - { - foreach ($this->observers as $observer) { - $observer->update($this); - } - } - - /** - * Sets the last event - * - * Adapters should use this method to set the current state of the request - * and notify the observers. - * - * @param string $name event name - * @param mixed $data event data - */ - public function setLastEvent($name, $data = null) - { - $this->lastEvent = array( - 'name' => $name, - 'data' => $data - ); - $this->notify(); - } - - /** - * Returns the last event - * - * Observers should use this method to access the last change in request. - * The following event names are possible: - * <ul> - * <li>'connect' - after connection to remote server, - * data is the destination (string)</li> - * <li>'disconnect' - after disconnection from server</li> - * <li>'sentHeaders' - after sending the request headers, - * data is the headers sent (string)</li> - * <li>'sentBodyPart' - after sending a part of the request body, - * data is the length of that part (int)</li> - * <li>'sentBody' - after sending the whole request body, - * data is request body length (int)</li> - * <li>'receivedHeaders' - after receiving the response headers, - * data is HTTP_Request2_Response object</li> - * <li>'receivedBodyPart' - after receiving a part of the response - * body, data is that part (string)</li> - * <li>'receivedEncodedBodyPart' - as 'receivedBodyPart', but data is still - * encoded by Content-Encoding</li> - * <li>'receivedBody' - after receiving the complete response - * body, data is HTTP_Request2_Response object</li> - * <li>'warning' - a problem arose during the request - * that is not severe enough to throw - * an Exception, data is the warning - * message (string). Currently dispatched if - * response body was received incompletely.</li> - * </ul> - * Different adapters may not send all the event types. Mock adapter does - * not send any events to the observers. - * - * @return array The array has two keys: 'name' and 'data' - */ - public function getLastEvent() - { - return $this->lastEvent; - } - - /** - * Sets the adapter used to actually perform the request - * - * You can pass either an instance of a class implementing HTTP_Request2_Adapter - * or a class name. The method will only try to include a file if the class - * name starts with HTTP_Request2_Adapter_, it will also try to prepend this - * prefix to the class name if it doesn't contain any underscores, so that - * <code> - * $request->setAdapter('curl'); - * </code> - * will work. - * - * @param string|HTTP_Request2_Adapter $adapter Adapter to use - * - * @return HTTP_Request2 - * @throws HTTP_Request2_LogicException - */ - public function setAdapter($adapter) - { - if (is_string($adapter)) { - if (!class_exists($adapter, false)) { - if (false === strpos($adapter, '_')) { - $adapter = 'HTTP_Request2_Adapter_' . ucfirst($adapter); - } - if (!class_exists($adapter, false) - && preg_match('/^HTTP_Request2_Adapter_(a-zA-Z0-9+)$/', $adapter) - ) { - include_once str_replace('_', DIRECTORY_SEPARATOR, $adapter) . '.php'; - } - if (!class_exists($adapter, false)) { - throw new HTTP_Request2_LogicException( - "Class {$adapter} not found", - HTTP_Request2_Exception::MISSING_VALUE - ); - } - } - $adapter = new $adapter; - } - if (!$adapter instanceof HTTP_Request2_Adapter) { - throw new HTTP_Request2_LogicException( - 'Parameter is not a HTTP request adapter', - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - $this->adapter = $adapter; - - return $this; - } - - /** - * Sets the cookie jar - * - * A cookie jar is used to maintain cookies across HTTP requests and - * responses. Cookies from jar will be automatically added to the request - * headers based on request URL. - * - * @param HTTP_Request2_CookieJar|bool $jar Existing CookieJar object, true to - * create a new one, false to remove - * - * @return HTTP_Request2 - * @throws HTTP_Request2_LogicException - */ - public function setCookieJar($jar = true) - { - if (!class_exists('HTTP_Request2_CookieJar', false)) { - require_once 'HTTP/Request2/CookieJar.php'; - } - - if ($jar instanceof HTTP_Request2_CookieJar) { - $this->cookieJar = $jar; - } elseif (true === $jar) { - $this->cookieJar = new HTTP_Request2_CookieJar(); - } elseif (!$jar) { - $this->cookieJar = null; - } else { - throw new HTTP_Request2_LogicException( - 'Invalid parameter passed to setCookieJar()', - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - - return $this; - } - - /** - * Returns current CookieJar object or null if none - * - * @return HTTP_Request2_CookieJar|null - */ - public function getCookieJar() - { - return $this->cookieJar; - } - - /** - * Sends the request and returns the response - * - * @throws HTTP_Request2_Exception - * @return HTTP_Request2_Response - */ - public function send() - { - // Sanity check for URL - if (!$this->url instanceof Net_URL2 - || !$this->url->isAbsolute() - || !in_array(strtolower($this->url->getScheme()), array('https', 'http')) - ) { - throw new HTTP_Request2_LogicException( - 'HTTP_Request2 needs an absolute HTTP(S) request URL, ' - . ($this->url instanceof Net_URL2 - ? "'" . $this->url->__toString() . "'" : 'none') - . ' given', - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - if (empty($this->adapter)) { - $this->setAdapter($this->getConfig('adapter')); - } - // magic_quotes_runtime may break file uploads and chunked response - // processing; see bug #4543. Don't use ini_get() here; see bug #16440. - if ($magicQuotes = get_magic_quotes_runtime()) { - set_magic_quotes_runtime(false); - } - // force using single byte encoding if mbstring extension overloads - // strlen() and substr(); see bug #1781, bug #10605 - if (extension_loaded('mbstring') && (2 & ini_get('mbstring.func_overload'))) { - $oldEncoding = mb_internal_encoding(); - mb_internal_encoding('8bit'); - } - - try { - $response = $this->adapter->sendRequest($this); - } catch (Exception $e) { - } - // cleanup in either case (poor man's "finally" clause) - if ($magicQuotes) { - set_magic_quotes_runtime(true); - } - if (!empty($oldEncoding)) { - mb_internal_encoding($oldEncoding); - } - // rethrow the exception - if (!empty($e)) { - throw $e; - } - return $response; - } - - /** - * Wrapper around fopen()/fstat() used by setBody() and addUpload() - * - * @param string|resource $file file name or pointer to open file - * @param bool $detectType whether to try autodetecting MIME - * type of file, will only work if $file is a - * filename, not pointer - * - * @return array array('fp' => file pointer, 'size' => file size, 'type' => MIME type) - * @throws HTTP_Request2_LogicException - */ - protected function fopenWrapper($file, $detectType = false) - { - if (!is_string($file) && !is_resource($file)) { - throw new HTTP_Request2_LogicException( - "Filename or file pointer resource expected", - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - $fileData = array( - 'fp' => is_string($file)? null: $file, - 'type' => 'application/octet-stream', - 'size' => 0 - ); - if (is_string($file)) { - if (!($fileData'fp' = @fopen($file, 'rb'))) { - $error = error_get_last(); - throw new HTTP_Request2_LogicException( - $error'message', HTTP_Request2_Exception::READ_ERROR - ); - } - if ($detectType) { - $fileData'type' = self::detectMimeType($file); - } - } - if (!($stat = fstat($fileData'fp'))) { - throw new HTTP_Request2_LogicException( - "fstat() call failed", HTTP_Request2_Exception::READ_ERROR - ); - } - $fileData'size' = $stat'size'; - - return $fileData; - } - - /** - * Tries to detect MIME type of a file - * - * The method will try to use fileinfo extension if it is available, - * deprecated mime_content_type() function in the other case. If neither - * works, default 'application/octet-stream' MIME type is returned - * - * @param string $filename file name - * - * @return string file MIME type - */ - protected static function detectMimeType($filename) - { - // finfo extension from PECL available - if (function_exists('finfo_open')) { - if (!isset(self::$_fileinfoDb)) { - self::$_fileinfoDb = @finfo_open(FILEINFO_MIME); - } - if (self::$_fileinfoDb) { - $info = finfo_file(self::$_fileinfoDb, $filename); - } - } - // (deprecated) mime_content_type function available - if (empty($info) && function_exists('mime_content_type')) { - $info = mime_content_type($filename); - } - return empty($info)? 'application/octet-stream': $info; - } -} -?>
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/Adapter.php
Deleted
@@ -1,137 +0,0 @@ -<?php -/** - * Base class for HTTP_Request2 adapters - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** - * Class representing a HTTP response - */ -require_once 'HTTP/Request2/Response.php'; - -/** - * Base class for HTTP_Request2 adapters - * - * HTTP_Request2 class itself only defines methods for aggregating the request - * data, all actual work of sending the request to the remote server and - * receiving its response is performed by adapters. - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -abstract class HTTP_Request2_Adapter -{ - /** - * A list of methods that MUST NOT have a request body, per RFC 2616 - * @var array - */ - protected static $bodyDisallowed = array('TRACE'); - - /** - * Methods having defined semantics for request body - * - * Content-Length header (indicating that the body follows, section 4.3 of - * RFC 2616) will be sent for these methods even if no body was added - * - * @var array - * @link http://pear.php.net/bugs/bug.php?id=12900 - * @link http://pear.php.net/bugs/bug.php?id=14740 - */ - protected static $bodyRequired = array('POST', 'PUT'); - - /** - * Request being sent - * @var HTTP_Request2 - */ - protected $request; - - /** - * Request body - * @var string|resource|HTTP_Request2_MultipartBody - * @see HTTP_Request2::getBody() - */ - protected $requestBody; - - /** - * Length of the request body - * @var integer - */ - protected $contentLength; - - /** - * Sends request to the remote server and returns its response - * - * @param HTTP_Request2 $request HTTP request message - * - * @return HTTP_Request2_Response - * @throws HTTP_Request2_Exception - */ - abstract public function sendRequest(HTTP_Request2 $request); - - /** - * Calculates length of the request body, adds proper headers - * - * @param array &$headers associative array of request headers, this method - * will add proper 'Content-Length' and 'Content-Type' - * headers to this array (or remove them if not needed) - */ - protected function calculateRequestLength(&$headers) - { - $this->requestBody = $this->request->getBody(); - - if (is_string($this->requestBody)) { - $this->contentLength = strlen($this->requestBody); - } elseif (is_resource($this->requestBody)) { - $stat = fstat($this->requestBody); - $this->contentLength = $stat'size'; - rewind($this->requestBody); - } else { - $this->contentLength = $this->requestBody->getLength(); - $headers'content-type' = 'multipart/form-data; boundary=' . - $this->requestBody->getBoundary(); - $this->requestBody->rewind(); - } - - if (in_array($this->request->getMethod(), self::$bodyDisallowed) - || 0 == $this->contentLength - ) { - // No body: send a Content-Length header nonetheless (request #12900), - // but do that only for methods that require a body (bug #14740) - if (in_array($this->request->getMethod(), self::$bodyRequired)) { - $headers'content-length' = 0; - } else { - unset($headers'content-length'); - // if the method doesn't require a body and doesn't have a - // body, don't send a Content-Type header. (request #16799) - unset($headers'content-type'); - } - } else { - if (empty($headers'content-type')) { - $headers'content-type' = 'application/x-www-form-urlencoded'; - } - // Content-Length should not be sent for chunked Transfer-Encoding (bug #20125) - if (!isset($headers'transfer-encoding')) { - $headers'content-length' = $this->contentLength; - } - } - } -} -?>
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/Adapter/Curl.php
Deleted
@@ -1,577 +0,0 @@ -<?php -/** - * Adapter for HTTP_Request2 wrapping around cURL extension - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** - * Base class for HTTP_Request2 adapters - */ -require_once 'HTTP/Request2/Adapter.php'; - -/** - * Adapter for HTTP_Request2 wrapping around cURL extension - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_Adapter_Curl extends HTTP_Request2_Adapter -{ - /** - * Mapping of header names to cURL options - * @var array - */ - protected static $headerMap = array( - 'accept-encoding' => CURLOPT_ENCODING, - 'cookie' => CURLOPT_COOKIE, - 'referer' => CURLOPT_REFERER, - 'user-agent' => CURLOPT_USERAGENT - ); - - /** - * Mapping of SSL context options to cURL options - * @var array - */ - protected static $sslContextMap = array( - 'ssl_verify_peer' => CURLOPT_SSL_VERIFYPEER, - 'ssl_cafile' => CURLOPT_CAINFO, - 'ssl_capath' => CURLOPT_CAPATH, - 'ssl_local_cert' => CURLOPT_SSLCERT, - 'ssl_passphrase' => CURLOPT_SSLCERTPASSWD - ); - - /** - * Mapping of CURLE_* constants to Exception subclasses and error codes - * @var array - */ - protected static $errorMap = array( - CURLE_UNSUPPORTED_PROTOCOL => array('HTTP_Request2_MessageException', - HTTP_Request2_Exception::NON_HTTP_REDIRECT), - CURLE_COULDNT_RESOLVE_PROXY => array('HTTP_Request2_ConnectionException'), - CURLE_COULDNT_RESOLVE_HOST => array('HTTP_Request2_ConnectionException'), - CURLE_COULDNT_CONNECT => array('HTTP_Request2_ConnectionException'), - // error returned from write callback - CURLE_WRITE_ERROR => array('HTTP_Request2_MessageException', - HTTP_Request2_Exception::NON_HTTP_REDIRECT), - CURLE_OPERATION_TIMEOUTED => array('HTTP_Request2_MessageException', - HTTP_Request2_Exception::TIMEOUT), - CURLE_HTTP_RANGE_ERROR => array('HTTP_Request2_MessageException'), - CURLE_SSL_CONNECT_ERROR => array('HTTP_Request2_ConnectionException'), - CURLE_LIBRARY_NOT_FOUND => array('HTTP_Request2_LogicException', - HTTP_Request2_Exception::MISCONFIGURATION), - CURLE_FUNCTION_NOT_FOUND => array('HTTP_Request2_LogicException', - HTTP_Request2_Exception::MISCONFIGURATION), - CURLE_ABORTED_BY_CALLBACK => array('HTTP_Request2_MessageException', - HTTP_Request2_Exception::NON_HTTP_REDIRECT), - CURLE_TOO_MANY_REDIRECTS => array('HTTP_Request2_MessageException', - HTTP_Request2_Exception::TOO_MANY_REDIRECTS), - CURLE_SSL_PEER_CERTIFICATE => array('HTTP_Request2_ConnectionException'), - CURLE_GOT_NOTHING => array('HTTP_Request2_MessageException'), - CURLE_SSL_ENGINE_NOTFOUND => array('HTTP_Request2_LogicException', - HTTP_Request2_Exception::MISCONFIGURATION), - CURLE_SSL_ENGINE_SETFAILED => array('HTTP_Request2_LogicException', - HTTP_Request2_Exception::MISCONFIGURATION), - CURLE_SEND_ERROR => array('HTTP_Request2_MessageException'), - CURLE_RECV_ERROR => array('HTTP_Request2_MessageException'), - CURLE_SSL_CERTPROBLEM => array('HTTP_Request2_LogicException', - HTTP_Request2_Exception::INVALID_ARGUMENT), - CURLE_SSL_CIPHER => array('HTTP_Request2_ConnectionException'), - CURLE_SSL_CACERT => array('HTTP_Request2_ConnectionException'), - CURLE_BAD_CONTENT_ENCODING => array('HTTP_Request2_MessageException'), - ); - - /** - * Response being received - * @var HTTP_Request2_Response - */ - protected $response; - - /** - * Whether 'sentHeaders' event was sent to observers - * @var boolean - */ - protected $eventSentHeaders = false; - - /** - * Whether 'receivedHeaders' event was sent to observers - * @var boolean - */ - protected $eventReceivedHeaders = false; - - /** - * Whether 'sentBoody' event was sent to observers - * @var boolean - */ - protected $eventSentBody = false; - - /** - * Position within request body - * @var integer - * @see callbackReadBody() - */ - protected $position = 0; - - /** - * Information about last transfer, as returned by curl_getinfo() - * @var array - */ - protected $lastInfo; - - /** - * Creates a subclass of HTTP_Request2_Exception from curl error data - * - * @param resource $ch curl handle - * - * @return HTTP_Request2_Exception - */ - protected static function wrapCurlError($ch) - { - $nativeCode = curl_errno($ch); - $message = 'Curl error: ' . curl_error($ch); - if (!isset(self::$errorMap$nativeCode)) { - return new HTTP_Request2_Exception($message, 0, $nativeCode); - } else { - $class = self::$errorMap$nativeCode0; - $code = empty(self::$errorMap$nativeCode1) - ? 0 : self::$errorMap$nativeCode1; - return new $class($message, $code, $nativeCode); - } - } - - /** - * Sends request to the remote server and returns its response - * - * @param HTTP_Request2 $request HTTP request message - * - * @return HTTP_Request2_Response - * @throws HTTP_Request2_Exception - */ - public function sendRequest(HTTP_Request2 $request) - { - if (!extension_loaded('curl')) { - throw new HTTP_Request2_LogicException( - 'cURL extension not available', HTTP_Request2_Exception::MISCONFIGURATION - ); - } - - $this->request = $request; - $this->response = null; - $this->position = 0; - $this->eventSentHeaders = false; - $this->eventReceivedHeaders = false; - $this->eventSentBody = false; - - try { - if (false === curl_exec($ch = $this->createCurlHandle())) { - $e = self::wrapCurlError($ch); - } - } catch (Exception $e) { - } - if (isset($ch)) { - $this->lastInfo = curl_getinfo($ch); - if (CURLE_OK !== curl_errno($ch)) { - $this->request->setLastEvent('warning', curl_error($ch)); - } - curl_close($ch); - } - - $response = $this->response; - unset($this->request, $this->requestBody, $this->response); - - if (!empty($e)) { - throw $e; - } - - if ($jar = $request->getCookieJar()) { - $jar->addCookiesFromResponse($response); - } - - if (0 < $this->lastInfo'size_download') { - $request->setLastEvent('receivedBody', $response); - } - return $response; - } - - /** - * Returns information about last transfer - * - * @return array associative array as returned by curl_getinfo() - */ - public function getInfo() - { - return $this->lastInfo; - } - - /** - * Creates a new cURL handle and populates it with data from the request - * - * @return resource a cURL handle, as created by curl_init() - * @throws HTTP_Request2_LogicException - * @throws HTTP_Request2_NotImplementedException - */ - protected function createCurlHandle() - { - $ch = curl_init(); - - curl_setopt_array($ch, array( - // setup write callbacks - CURLOPT_HEADERFUNCTION => array($this, 'callbackWriteHeader'), - CURLOPT_WRITEFUNCTION => array($this, 'callbackWriteBody'), - // buffer size - CURLOPT_BUFFERSIZE => $this->request->getConfig('buffer_size'), - // connection timeout - CURLOPT_CONNECTTIMEOUT => $this->request->getConfig('connect_timeout'), - // save full outgoing headers, in case someone is interested - CURLINFO_HEADER_OUT => true, - // request url - CURLOPT_URL => $this->request->getUrl()->getUrl() - )); - - // set up redirects - if (!$this->request->getConfig('follow_redirects')) { - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); - } else { - if (!@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true)) { - throw new HTTP_Request2_LogicException( - 'Redirect support in curl is unavailable due to open_basedir or safe_mode setting', - HTTP_Request2_Exception::MISCONFIGURATION - ); - } - curl_setopt($ch, CURLOPT_MAXREDIRS, $this->request->getConfig('max_redirects')); - // limit redirects to http(s), works in 5.2.10+ - if (defined('CURLOPT_REDIR_PROTOCOLS')) { - curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); - } - // works in 5.3.2+, http://bugs.php.net/bug.php?id=49571 - if ($this->request->getConfig('strict_redirects') && defined('CURLOPT_POSTREDIR')) { - curl_setopt($ch, CURLOPT_POSTREDIR, 3); - } - } - - // set local IP via CURLOPT_INTERFACE (request #19515) - if ($ip = $this->request->getConfig('local_ip')) { - curl_setopt($ch, CURLOPT_INTERFACE, $ip); - } - - // request timeout - if ($timeout = $this->request->getConfig('timeout')) { - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - } - - // set HTTP version - switch ($this->request->getConfig('protocol_version')) { - case '1.0': - curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); - break; - case '1.1': - curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); - } - - // set request method - switch ($this->request->getMethod()) { - case HTTP_Request2::METHOD_GET: - curl_setopt($ch, CURLOPT_HTTPGET, true); - break; - case HTTP_Request2::METHOD_POST: - curl_setopt($ch, CURLOPT_POST, true); - break; - case HTTP_Request2::METHOD_HEAD: - curl_setopt($ch, CURLOPT_NOBODY, true); - break; - case HTTP_Request2::METHOD_PUT: - curl_setopt($ch, CURLOPT_UPLOAD, true); - break; - default: - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->request->getMethod()); - } - - // set proxy, if needed - if ($host = $this->request->getConfig('proxy_host')) { - if (!($port = $this->request->getConfig('proxy_port'))) { - throw new HTTP_Request2_LogicException( - 'Proxy port not provided', HTTP_Request2_Exception::MISSING_VALUE - ); - } - curl_setopt($ch, CURLOPT_PROXY, $host . ':' . $port); - if ($user = $this->request->getConfig('proxy_user')) { - curl_setopt( - $ch, CURLOPT_PROXYUSERPWD, - $user . ':' . $this->request->getConfig('proxy_password') - ); - switch ($this->request->getConfig('proxy_auth_scheme')) { - case HTTP_Request2::AUTH_BASIC: - curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); - break; - case HTTP_Request2::AUTH_DIGEST: - curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_DIGEST); - } - } - if ($type = $this->request->getConfig('proxy_type')) { - switch ($type) { - case 'http': - curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - break; - case 'socks5': - curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); - break; - default: - throw new HTTP_Request2_NotImplementedException( - "Proxy type '{$type}' is not supported" - ); - } - } - } - - // set authentication data - if ($auth = $this->request->getAuth()) { - curl_setopt($ch, CURLOPT_USERPWD, $auth'user' . ':' . $auth'password'); - switch ($auth'scheme') { - case HTTP_Request2::AUTH_BASIC: - curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); - break; - case HTTP_Request2::AUTH_DIGEST: - curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); - } - } - - // set SSL options - foreach ($this->request->getConfig() as $name => $value) { - if ('ssl_verify_host' == $name && null !== $value) { - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $value? 2: 0); - } elseif (isset(self::$sslContextMap$name) && null !== $value) { - curl_setopt($ch, self::$sslContextMap$name, $value); - } - } - - $headers = $this->request->getHeaders(); - // make cURL automagically send proper header - if (!isset($headers'accept-encoding')) { - $headers'accept-encoding' = ''; - } - - if (($jar = $this->request->getCookieJar()) - && ($cookies = $jar->getMatching($this->request->getUrl(), true)) - ) { - $headers'cookie' = (empty($headers'cookie')? '': $headers'cookie' . '; ') . $cookies; - } - - // set headers having special cURL keys - foreach (self::$headerMap as $name => $option) { - if (isset($headers$name)) { - curl_setopt($ch, $option, $headers$name); - unset($headers$name); - } - } - - $this->calculateRequestLength($headers); - if (isset($headers'content-length') || isset($headers'transfer-encoding')) { - $this->workaroundPhpBug47204($ch, $headers); - } - - // set headers not having special keys - $headersFmt = array(); - foreach ($headers as $name => $value) { - $canonicalName = implode('-', array_map('ucfirst', explode('-', $name))); - $headersFmt = $canonicalName . ': ' . $value; - } - curl_setopt($ch, CURLOPT_HTTPHEADER, $headersFmt); - - return $ch; - } - - /** - * Workaround for PHP bug #47204 that prevents rewinding request body - * - * The workaround consists of reading the entire request body into memory - * and setting it as CURLOPT_POSTFIELDS, so it isn't recommended for large - * file uploads, use Socket adapter instead. - * - * @param resource $ch cURL handle - * @param array &$headers Request headers - */ - protected function workaroundPhpBug47204($ch, &$headers) - { - // no redirects, no digest auth -> probably no rewind needed - // also apply workaround only for POSTs, othrerwise we get - // https://pear.php.net/bugs/bug.php?id=20440 for PUTs - if (!$this->request->getConfig('follow_redirects') - && (!($auth = $this->request->getAuth()) - || HTTP_Request2::AUTH_DIGEST != $auth'scheme') - || HTTP_Request2::METHOD_POST !== $this->request->getMethod() - ) { - curl_setopt($ch, CURLOPT_READFUNCTION, array($this, 'callbackReadBody')); - - } else { - // rewind may be needed, read the whole body into memory - if ($this->requestBody instanceof HTTP_Request2_MultipartBody) { - $this->requestBody = $this->requestBody->__toString(); - - } elseif (is_resource($this->requestBody)) { - $fp = $this->requestBody; - $this->requestBody = ''; - while (!feof($fp)) { - $this->requestBody .= fread($fp, 16384); - } - } - // curl hangs up if content-length is present - unset($headers'content-length'); - curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody); - } - } - - /** - * Callback function called by cURL for reading the request body - * - * @param resource $ch cURL handle - * @param resource $fd file descriptor (not used) - * @param integer $length maximum length of data to return - * - * @return string part of the request body, up to $length bytes - */ - protected function callbackReadBody($ch, $fd, $length) - { - if (!$this->eventSentHeaders) { - $this->request->setLastEvent( - 'sentHeaders', curl_getinfo($ch, CURLINFO_HEADER_OUT) - ); - $this->eventSentHeaders = true; - } - if (in_array($this->request->getMethod(), self::$bodyDisallowed) - || 0 == $this->contentLength || $this->position >= $this->contentLength - ) { - return ''; - } - if (is_string($this->requestBody)) { - $string = substr($this->requestBody, $this->position, $length); - } elseif (is_resource($this->requestBody)) { - $string = fread($this->requestBody, $length); - } else { - $string = $this->requestBody->read($length); - } - $this->request->setLastEvent('sentBodyPart', strlen($string)); - $this->position += strlen($string); - return $string; - } - - /** - * Callback function called by cURL for saving the response headers - * - * @param resource $ch cURL handle - * @param string $string response header (with trailing CRLF) - * - * @return integer number of bytes saved - * @see HTTP_Request2_Response::parseHeaderLine() - */ - protected function callbackWriteHeader($ch, $string) - { - if (!$this->eventSentHeaders - // we may receive a second set of headers if doing e.g. digest auth - // but don't bother with 100-Continue responses (bug #15785) - || $this->eventReceivedHeaders && $this->response->getStatus() >= 200 - ) { - $this->request->setLastEvent( - 'sentHeaders', curl_getinfo($ch, CURLINFO_HEADER_OUT) - ); - } - if (!$this->eventSentBody) { - $upload = curl_getinfo($ch, CURLINFO_SIZE_UPLOAD); - // if body wasn't read by the callback, send event with total body size - if ($upload > $this->position) { - $this->request->setLastEvent( - 'sentBodyPart', $upload - $this->position - ); - } - if ($upload > 0) { - $this->request->setLastEvent('sentBody', $upload); - } - } - $this->eventSentHeaders = true; - $this->eventSentBody = true; - - if ($this->eventReceivedHeaders || empty($this->response)) { - $this->eventReceivedHeaders = false; - $this->response = new HTTP_Request2_Response( - $string, false, curl_getinfo($ch, CURLINFO_EFFECTIVE_URL) - ); - - } else { - $this->response->parseHeaderLine($string); - if ('' == trim($string)) { - // don't bother with 100-Continue responses (bug #15785) - if (200 <= $this->response->getStatus()) { - $this->request->setLastEvent('receivedHeaders', $this->response); - } - - if ($this->request->getConfig('follow_redirects') && $this->response->isRedirect()) { - $redirectUrl = new Net_URL2($this->response->getHeader('location')); - - // for versions lower than 5.2.10, check the redirection URL protocol - if (!defined('CURLOPT_REDIR_PROTOCOLS') && $redirectUrl->isAbsolute() - && !in_array($redirectUrl->getScheme(), array('http', 'https')) - ) { - return -1; - } - - if ($jar = $this->request->getCookieJar()) { - $jar->addCookiesFromResponse($this->response); - if (!$redirectUrl->isAbsolute()) { - $redirectUrl = $this->request->getUrl()->resolve($redirectUrl); - } - if ($cookies = $jar->getMatching($redirectUrl, true)) { - curl_setopt($ch, CURLOPT_COOKIE, $cookies); - } - } - } - $this->eventReceivedHeaders = true; - $this->eventSentBody = false; - } - } - return strlen($string); - } - - /** - * Callback function called by cURL for saving the response body - * - * @param resource $ch cURL handle (not used) - * @param string $string part of the response body - * - * @return integer number of bytes saved - * @throws HTTP_Request2_MessageException - * @see HTTP_Request2_Response::appendBody() - */ - protected function callbackWriteBody($ch, $string) - { - // cURL calls WRITEFUNCTION callback without calling HEADERFUNCTION if - // response doesn't start with proper HTTP status line (see bug #15716) - if (empty($this->response)) { - throw new HTTP_Request2_MessageException( - "Malformed response: {$string}", - HTTP_Request2_Exception::MALFORMED_RESPONSE - ); - } - if ($this->request->getConfig('store_body')) { - $this->response->appendBody($string); - } - $this->request->setLastEvent('receivedBodyPart', $string); - return strlen($string); - } -} -?>
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/Adapter/Mock.php
Deleted
@@ -1,166 +0,0 @@ -<?php -/** - * Mock adapter intended for testing - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** - * Base class for HTTP_Request2 adapters - */ -require_once 'HTTP/Request2/Adapter.php'; - -/** - * Mock adapter intended for testing - * - * Can be used to test applications depending on HTTP_Request2 package without - * actually performing any HTTP requests. This adapter will return responses - * previously added via addResponse() - * <code> - * $mock = new HTTP_Request2_Adapter_Mock(); - * $mock->addResponse("HTTP/1.1 ... "); - * - * $request = new HTTP_Request2(); - * $request->setAdapter($mock); - * - * // This will return the response set above - * $response = $req->send(); - * </code> - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_Adapter_Mock extends HTTP_Request2_Adapter -{ - /** - * A queue of responses to be returned by sendRequest() - * @var array - */ - protected $responses = array(); - - /** - * Returns the next response from the queue built by addResponse() - * - * Only responses without explicit URLs or with URLs equal to request URL - * will be considered. If matching response is not found or the queue is - * empty then default empty response with status 400 will be returned, - * if an Exception object was added to the queue it will be thrown. - * - * @param HTTP_Request2 $request HTTP request message - * - * @return HTTP_Request2_Response - * @throws Exception - */ - public function sendRequest(HTTP_Request2 $request) - { - $requestUrl = (string)$request->getUrl(); - $response = null; - foreach ($this->responses as $k => $v) { - if (!$v1 || $requestUrl == $v1) { - $response = $v0; - array_splice($this->responses, $k, 1); - break; - } - } - if (!$response) { - return self::createResponseFromString("HTTP/1.1 400 Bad Request\r\n\r\n"); - - } elseif ($response instanceof HTTP_Request2_Response) { - return $response; - - } else { - // rethrow the exception - $class = get_class($response); - $message = $response->getMessage(); - $code = $response->getCode(); - throw new $class($message, $code); - } - } - - /** - * Adds response to the queue - * - * @param mixed $response either a string, a pointer to an open file, - * an instance of HTTP_Request2_Response or Exception - * @param string $url A request URL this response should be valid for - * (see {@link http://pear.php.net/bugs/bug.php?id=19276}) - * - * @throws HTTP_Request2_Exception - */ - public function addResponse($response, $url = null) - { - if (is_string($response)) { - $response = self::createResponseFromString($response); - } elseif (is_resource($response)) { - $response = self::createResponseFromFile($response); - } elseif (!$response instanceof HTTP_Request2_Response && - !$response instanceof Exception - ) { - throw new HTTP_Request2_Exception('Parameter is not a valid response'); - } - $this->responses = array($response, $url); - } - - /** - * Creates a new HTTP_Request2_Response object from a string - * - * @param string $str string containing HTTP response message - * - * @return HTTP_Request2_Response - * @throws HTTP_Request2_Exception - */ - public static function createResponseFromString($str) - { - $parts = preg_split('!(\r?\n){2}!m', $str, 2); - $headerLines = explode("\n", $parts0); - $response = new HTTP_Request2_Response(array_shift($headerLines)); - foreach ($headerLines as $headerLine) { - $response->parseHeaderLine($headerLine); - } - $response->parseHeaderLine(''); - if (isset($parts1)) { - $response->appendBody($parts1); - } - return $response; - } - - /** - * Creates a new HTTP_Request2_Response object from a file - * - * @param resource $fp file pointer returned by fopen() - * - * @return HTTP_Request2_Response - * @throws HTTP_Request2_Exception - */ - public static function createResponseFromFile($fp) - { - $response = new HTTP_Request2_Response(fgets($fp)); - do { - $headerLine = fgets($fp); - $response->parseHeaderLine($headerLine); - } while ('' != trim($headerLine)); - - while (!feof($fp)) { - $response->appendBody(fread($fp, 8192)); - } - return $response; - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/Adapter/Socket.php
Deleted
@@ -1,1138 +0,0 @@ -<?php -/** - * Socket-based adapter for HTTP_Request2 - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Base class for HTTP_Request2 adapters */ -require_once 'HTTP/Request2/Adapter.php'; - -/** Socket wrapper class */ -require_once 'HTTP/Request2/SocketWrapper.php'; - -/** - * Socket-based adapter for HTTP_Request2 - * - * This adapter uses only PHP sockets and will work on almost any PHP - * environment. Code is based on original HTTP_Request PEAR package. - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_Adapter_Socket extends HTTP_Request2_Adapter -{ - /** - * Regular expression for 'token' rule from RFC 2616 - */ - const REGEXP_TOKEN = '^\x00-\x1f\x7f-\xff()<>@,;:\\\\"/\\?={}\s+'; - - /** - * Regular expression for 'quoted-string' rule from RFC 2616 - */ - const REGEXP_QUOTED_STRING = '"(?>^"\\\\+|\\\\.)*"'; - - /** - * Connected sockets, needed for Keep-Alive support - * @var array - * @see connect() - */ - protected static $sockets = array(); - - /** - * Data for digest authentication scheme - * - * The keys for the array are URL prefixes. - * - * The values are associative arrays with data (realm, nonce, nonce-count, - * opaque...) needed for digest authentication. Stored here to prevent making - * duplicate requests to digest-protected resources after we have already - * received the challenge. - * - * @var array - */ - protected static $challenges = array(); - - /** - * Connected socket - * @var HTTP_Request2_SocketWrapper - * @see connect() - */ - protected $socket; - - /** - * Challenge used for server digest authentication - * @var array - */ - protected $serverChallenge; - - /** - * Challenge used for proxy digest authentication - * @var array - */ - protected $proxyChallenge; - - /** - * Remaining length of the current chunk, when reading chunked response - * @var integer - * @see readChunked() - */ - protected $chunkLength = 0; - - /** - * Remaining amount of redirections to follow - * - * Starts at 'max_redirects' configuration parameter and is reduced on each - * subsequent redirect. An Exception will be thrown once it reaches zero. - * - * @var integer - */ - protected $redirectCountdown = null; - - /** - * Whether to wait for "100 Continue" response before sending request body - * @var bool - */ - protected $expect100Continue = false; - - /** - * Sends request to the remote server and returns its response - * - * @param HTTP_Request2 $request HTTP request message - * - * @return HTTP_Request2_Response - * @throws HTTP_Request2_Exception - */ - public function sendRequest(HTTP_Request2 $request) - { - $this->request = $request; - - try { - $keepAlive = $this->connect(); - $headers = $this->prepareHeaders(); - $this->socket->write($headers); - // provide request headers to the observer, see request #7633 - $this->request->setLastEvent('sentHeaders', $headers); - - if (!$this->expect100Continue) { - $this->writeBody(); - $response = $this->readResponse(); - - } else { - $response = $this->readResponse(); - if (!$response || 100 == $response->getStatus()) { - $this->expect100Continue = false; - // either got "100 Continue" or timed out -> send body - $this->writeBody(); - $response = $this->readResponse(); - } - } - - - if ($jar = $request->getCookieJar()) { - $jar->addCookiesFromResponse($response); - } - - if (!$this->canKeepAlive($keepAlive, $response)) { - $this->disconnect(); - } - - if ($this->shouldUseProxyDigestAuth($response)) { - return $this->sendRequest($request); - } - if ($this->shouldUseServerDigestAuth($response)) { - return $this->sendRequest($request); - } - if ($authInfo = $response->getHeader('authentication-info')) { - $this->updateChallenge($this->serverChallenge, $authInfo); - } - if ($proxyInfo = $response->getHeader('proxy-authentication-info')) { - $this->updateChallenge($this->proxyChallenge, $proxyInfo); - } - - } catch (Exception $e) { - $this->disconnect(); - } - - unset($this->request, $this->requestBody); - - if (!empty($e)) { - $this->redirectCountdown = null; - throw $e; - } - - if (!$request->getConfig('follow_redirects') || !$response->isRedirect()) { - $this->redirectCountdown = null; - return $response; - } else { - return $this->handleRedirect($request, $response); - } - } - - /** - * Connects to the remote server - * - * @return bool whether the connection can be persistent - * @throws HTTP_Request2_Exception - */ - protected function connect() - { - $secure = 0 == strcasecmp($this->request->getUrl()->getScheme(), 'https'); - $tunnel = HTTP_Request2::METHOD_CONNECT == $this->request->getMethod(); - $headers = $this->request->getHeaders(); - $reqHost = $this->request->getUrl()->getHost(); - if (!($reqPort = $this->request->getUrl()->getPort())) { - $reqPort = $secure? 443: 80; - } - - $httpProxy = $socksProxy = false; - if (!($host = $this->request->getConfig('proxy_host'))) { - $host = $reqHost; - $port = $reqPort; - } else { - if (!($port = $this->request->getConfig('proxy_port'))) { - throw new HTTP_Request2_LogicException( - 'Proxy port not provided', - HTTP_Request2_Exception::MISSING_VALUE - ); - } - if ('http' == ($type = $this->request->getConfig('proxy_type'))) { - $httpProxy = true; - } elseif ('socks5' == $type) { - $socksProxy = true; - } else { - throw new HTTP_Request2_NotImplementedException( - "Proxy type '{$type}' is not supported" - ); - } - } - - if ($tunnel && !$httpProxy) { - throw new HTTP_Request2_LogicException( - "Trying to perform CONNECT request without proxy", - HTTP_Request2_Exception::MISSING_VALUE - ); - } - if ($secure && !in_array('ssl', stream_get_transports())) { - throw new HTTP_Request2_LogicException( - 'Need OpenSSL support for https:// requests', - HTTP_Request2_Exception::MISCONFIGURATION - ); - } - - // RFC 2068, section 19.7.1: A client MUST NOT send the Keep-Alive - // connection token to a proxy server... - if ($httpProxy && !$secure && !empty($headers'connection') - && 'Keep-Alive' == $headers'connection' - ) { - $this->request->setHeader('connection'); - } - - $keepAlive = ('1.1' == $this->request->getConfig('protocol_version') && - empty($headers'connection')) || - (!empty($headers'connection') && - 'Keep-Alive' == $headers'connection'); - - $options = array(); - if ($ip = $this->request->getConfig('local_ip')) { - $options'socket' = array( - 'bindto' => (false === strpos($ip, ':') ? $ip : '' . $ip . '') . ':0' - ); - } - if ($secure || $tunnel) { - $options'ssl' = array(); - foreach ($this->request->getConfig() as $name => $value) { - if ('ssl_' == substr($name, 0, 4) && null !== $value) { - if ('ssl_verify_host' == $name) { - if (version_compare(phpversion(), '5.6', '<')) { - if ($value) { - $options'ssl''CN_match' = $reqHost; - } - - } else { - $options'ssl''verify_peer_name' = $value; - $options'ssl''peer_name' = $reqHost; - } - - } else { - $options'ssl'substr($name, 4) = $value; - } - } - } - ksort($options'ssl'); - } - - // Use global request timeout if given, see feature requests #5735, #8964 - if ($timeout = $this->request->getConfig('timeout')) { - $deadline = time() + $timeout; - } else { - $deadline = null; - } - - // Changing SSL context options after connection is established does *not* - // work, we need a new connection if options change - $remote = ((!$secure || $httpProxy || $socksProxy)? 'tcp://': 'tls://') - . $host . ':' . $port; - $socketKey = $remote . ( - ($secure && $httpProxy || $socksProxy) - ? "->{$reqHost}:{$reqPort}" : '' - ) . (empty($options)? '': ':' . serialize($options)); - unset($this->socket); - - // We use persistent connections and have a connected socket? - // Ensure that the socket is still connected, see bug #16149 - if ($keepAlive && !empty(self::$sockets$socketKey) - && !self::$sockets$socketKey->eof() - ) { - $this->socket =& self::$sockets$socketKey; - - } else { - if ($socksProxy) { - require_once 'HTTP/Request2/SOCKS5.php'; - - $this->socket = new HTTP_Request2_SOCKS5( - $remote, $this->request->getConfig('connect_timeout'), - $options, $this->request->getConfig('proxy_user'), - $this->request->getConfig('proxy_password') - ); - // handle request timeouts ASAP - $this->socket->setDeadline($deadline, $this->request->getConfig('timeout')); - $this->socket->connect($reqHost, $reqPort); - if (!$secure) { - $conninfo = "tcp://{$reqHost}:{$reqPort} via {$remote}"; - } else { - $this->socket->enableCrypto(); - $conninfo = "tls://{$reqHost}:{$reqPort} via {$remote}"; - } - - } elseif ($secure && $httpProxy && !$tunnel) { - $this->establishTunnel(); - $conninfo = "tls://{$reqHost}:{$reqPort} via {$remote}"; - - } else { - $this->socket = new HTTP_Request2_SocketWrapper( - $remote, $this->request->getConfig('connect_timeout'), $options - ); - } - $this->request->setLastEvent('connect', empty($conninfo)? $remote: $conninfo); - self::$sockets$socketKey =& $this->socket; - } - $this->socket->setDeadline($deadline, $this->request->getConfig('timeout')); - return $keepAlive; - } - - /** - * Establishes a tunnel to a secure remote server via HTTP CONNECT request - * - * This method will fail if 'ssl_verify_peer' is enabled. Probably because PHP - * sees that we are connected to a proxy server (duh!) rather than the server - * that presents its certificate. - * - * @link http://tools.ietf.org/html/rfc2817#section-5.2 - * @throws HTTP_Request2_Exception - */ - protected function establishTunnel() - { - $donor = new self; - $connect = new HTTP_Request2( - $this->request->getUrl(), HTTP_Request2::METHOD_CONNECT, - array_merge($this->request->getConfig(), array('adapter' => $donor)) - ); - $response = $connect->send(); - // Need any successful (2XX) response - if (200 > $response->getStatus() || 300 <= $response->getStatus()) { - throw new HTTP_Request2_ConnectionException( - 'Failed to connect via HTTPS proxy. Proxy response: ' . - $response->getStatus() . ' ' . $response->getReasonPhrase() - ); - } - $this->socket = $donor->socket; - $this->socket->enableCrypto(); - } - - /** - * Checks whether current connection may be reused or should be closed - * - * @param boolean $requestKeepAlive whether connection could - * be persistent in the first place - * @param HTTP_Request2_Response $response response object to check - * - * @return boolean - */ - protected function canKeepAlive($requestKeepAlive, HTTP_Request2_Response $response) - { - // Do not close socket on successful CONNECT request - if (HTTP_Request2::METHOD_CONNECT == $this->request->getMethod() - && 200 <= $response->getStatus() && 300 > $response->getStatus() - ) { - return true; - } - - $lengthKnown = 'chunked' == strtolower($response->getHeader('transfer-encoding')) - || null !== $response->getHeader('content-length') - // no body possible for such responses, see also request #17031 - || HTTP_Request2::METHOD_HEAD == $this->request->getMethod() - || in_array($response->getStatus(), array(204, 304)); - $persistent = 'keep-alive' == strtolower($response->getHeader('connection')) || - (null === $response->getHeader('connection') && - '1.1' == $response->getVersion()); - return $requestKeepAlive && $lengthKnown && $persistent; - } - - /** - * Disconnects from the remote server - */ - protected function disconnect() - { - if (!empty($this->socket)) { - $this->socket = null; - $this->request->setLastEvent('disconnect'); - } - } - - /** - * Handles HTTP redirection - * - * This method will throw an Exception if redirect to a non-HTTP(S) location - * is attempted, also if number of redirects performed already is equal to - * 'max_redirects' configuration parameter. - * - * @param HTTP_Request2 $request Original request - * @param HTTP_Request2_Response $response Response containing redirect - * - * @return HTTP_Request2_Response Response from a new location - * @throws HTTP_Request2_Exception - */ - protected function handleRedirect( - HTTP_Request2 $request, HTTP_Request2_Response $response - ) { - if (is_null($this->redirectCountdown)) { - $this->redirectCountdown = $request->getConfig('max_redirects'); - } - if (0 == $this->redirectCountdown) { - $this->redirectCountdown = null; - // Copying cURL behaviour - throw new HTTP_Request2_MessageException( - 'Maximum (' . $request->getConfig('max_redirects') . ') redirects followed', - HTTP_Request2_Exception::TOO_MANY_REDIRECTS - ); - } - $redirectUrl = new Net_URL2( - $response->getHeader('location'), - array(Net_URL2::OPTION_USE_BRACKETS => $request->getConfig('use_brackets')) - ); - // refuse non-HTTP redirect - if ($redirectUrl->isAbsolute() - && !in_array($redirectUrl->getScheme(), array('http', 'https')) - ) { - $this->redirectCountdown = null; - throw new HTTP_Request2_MessageException( - 'Refusing to redirect to a non-HTTP URL ' . $redirectUrl->__toString(), - HTTP_Request2_Exception::NON_HTTP_REDIRECT - ); - } - // Theoretically URL should be absolute (see http://tools.ietf.org/html/rfc2616#section-14.30), - // but in practice it is often not - if (!$redirectUrl->isAbsolute()) { - $redirectUrl = $request->getUrl()->resolve($redirectUrl); - } - $redirect = clone $request; - $redirect->setUrl($redirectUrl); - if (303 == $response->getStatus() - || (!$request->getConfig('strict_redirects') - && in_array($response->getStatus(), array(301, 302))) - ) { - $redirect->setMethod(HTTP_Request2::METHOD_GET); - $redirect->setBody(''); - } - - if (0 < $this->redirectCountdown) { - $this->redirectCountdown--; - } - return $this->sendRequest($redirect); - } - - /** - * Checks whether another request should be performed with server digest auth - * - * Several conditions should be satisfied for it to return true: - * - response status should be 401 - * - auth credentials should be set in the request object - * - response should contain WWW-Authenticate header with digest challenge - * - there is either no challenge stored for this URL or new challenge - * contains stale=true parameter (in other case we probably just failed - * due to invalid username / password) - * - * The method stores challenge values in $challenges static property - * - * @param HTTP_Request2_Response $response response to check - * - * @return boolean whether another request should be performed - * @throws HTTP_Request2_Exception in case of unsupported challenge parameters - */ - protected function shouldUseServerDigestAuth(HTTP_Request2_Response $response) - { - // no sense repeating a request if we don't have credentials - if (401 != $response->getStatus() || !$this->request->getAuth()) { - return false; - } - if (!$challenge = $this->parseDigestChallenge($response->getHeader('www-authenticate'))) { - return false; - } - - $url = $this->request->getUrl(); - $scheme = $url->getScheme(); - $host = $scheme . '://' . $url->getHost(); - if ($port = $url->getPort()) { - if ((0 == strcasecmp($scheme, 'http') && 80 != $port) - || (0 == strcasecmp($scheme, 'https') && 443 != $port) - ) { - $host .= ':' . $port; - } - } - - if (!empty($challenge'domain')) { - $prefixes = array(); - foreach (preg_split('/\\s+/', $challenge'domain') as $prefix) { - // don't bother with different servers - if ('/' == substr($prefix, 0, 1)) { - $prefixes = $host . $prefix; - } - } - } - if (empty($prefixes)) { - $prefixes = array($host . '/'); - } - - $ret = true; - foreach ($prefixes as $prefix) { - if (!empty(self::$challenges$prefix) - && (empty($challenge'stale') || strcasecmp('true', $challenge'stale')) - ) { - // probably credentials are invalid - $ret = false; - } - self::$challenges$prefix =& $challenge; - } - return $ret; - } - - /** - * Checks whether another request should be performed with proxy digest auth - * - * Several conditions should be satisfied for it to return true: - * - response status should be 407 - * - proxy auth credentials should be set in the request object - * - response should contain Proxy-Authenticate header with digest challenge - * - there is either no challenge stored for this proxy or new challenge - * contains stale=true parameter (in other case we probably just failed - * due to invalid username / password) - * - * The method stores challenge values in $challenges static property - * - * @param HTTP_Request2_Response $response response to check - * - * @return boolean whether another request should be performed - * @throws HTTP_Request2_Exception in case of unsupported challenge parameters - */ - protected function shouldUseProxyDigestAuth(HTTP_Request2_Response $response) - { - if (407 != $response->getStatus() || !$this->request->getConfig('proxy_user')) { - return false; - } - if (!($challenge = $this->parseDigestChallenge($response->getHeader('proxy-authenticate')))) { - return false; - } - - $key = 'proxy://' . $this->request->getConfig('proxy_host') . - ':' . $this->request->getConfig('proxy_port'); - - if (!empty(self::$challenges$key) - && (empty($challenge'stale') || strcasecmp('true', $challenge'stale')) - ) { - $ret = false; - } else { - $ret = true; - } - self::$challenges$key = $challenge; - return $ret; - } - - /** - * Extracts digest method challenge from (WWW|Proxy)-Authenticate header value - * - * There is a problem with implementation of RFC 2617: several of the parameters - * are defined as quoted-string there and thus may contain backslash escaped - * double quotes (RFC 2616, section 2.2). However, RFC 2617 defines unq(X) as - * just value of quoted-string X without surrounding quotes, it doesn't speak - * about removing backslash escaping. - * - * Now realm parameter is user-defined and human-readable, strange things - * happen when it contains quotes: - * - Apache allows quotes in realm, but apparently uses realm value without - * backslashes for digest computation - * - Squid allows (manually escaped) quotes there, but it is impossible to - * authorize with either escaped or unescaped quotes used in digest, - * probably it can't parse the response (?) - * - Both IE and Firefox display realm value with backslashes in - * the password popup and apparently use the same value for digest - * - * HTTP_Request2 follows IE and Firefox (and hopefully RFC 2617) in - * quoted-string handling, unfortunately that means failure to authorize - * sometimes - * - * @param string $headerValue value of WWW-Authenticate or Proxy-Authenticate header - * - * @return mixed associative array with challenge parameters, false if - * no challenge is present in header value - * @throws HTTP_Request2_NotImplementedException in case of unsupported challenge parameters - */ - protected function parseDigestChallenge($headerValue) - { - $authParam = '(' . self::REGEXP_TOKEN . ')\\s*=\\s*(' . - self::REGEXP_TOKEN . '|' . self::REGEXP_QUOTED_STRING . ')'; - $challenge = "!(?<=^|\\s|,)Digest ({$authParam}\\s*(,\\s*|$))+!"; - if (!preg_match($challenge, $headerValue, $matches)) { - return false; - } - - preg_match_all('!' . $authParam . '!', $matches0, $params); - $paramsAry = array(); - $knownParams = array('realm', 'domain', 'nonce', 'opaque', 'stale', - 'algorithm', 'qop'); - for ($i = 0; $i < count($params0); $i++) { - // section 3.2.1: Any unrecognized directive MUST be ignored. - if (in_array($params1$i, $knownParams)) { - if ('"' == substr($params2$i, 0, 1)) { - $paramsAry$params1$i = substr($params2$i, 1, -1); - } else { - $paramsAry$params1$i = $params2$i; - } - } - } - // we only support qop=auth - if (!empty($paramsAry'qop') - && !in_array('auth', array_map('trim', explode(',', $paramsAry'qop'))) - ) { - throw new HTTP_Request2_NotImplementedException( - "Only 'auth' qop is currently supported in digest authentication, " . - "server requested '{$paramsAry'qop'}'" - ); - } - // we only support algorithm=MD5 - if (!empty($paramsAry'algorithm') && 'MD5' != $paramsAry'algorithm') { - throw new HTTP_Request2_NotImplementedException( - "Only 'MD5' algorithm is currently supported in digest authentication, " . - "server requested '{$paramsAry'algorithm'}'" - ); - } - - return $paramsAry; - } - - /** - * Parses Proxy-Authentication-Info header value and updates challenge - * - * @param array &$challenge challenge to update - * @param string $headerValue value of Proxy-Authentication-Info header - * - * @todo validate server rspauth response - */ - protected function updateChallenge(&$challenge, $headerValue) - { - $authParam = '!(' . self::REGEXP_TOKEN . ')\\s*=\\s*(' . - self::REGEXP_TOKEN . '|' . self::REGEXP_QUOTED_STRING . ')!'; - $paramsAry = array(); - - preg_match_all($authParam, $headerValue, $params); - for ($i = 0; $i < count($params0); $i++) { - if ('"' == substr($params2$i, 0, 1)) { - $paramsAry$params1$i = substr($params2$i, 1, -1); - } else { - $paramsAry$params1$i = $params2$i; - } - } - // for now, just update the nonce value - if (!empty($paramsAry'nextnonce')) { - $challenge'nonce' = $paramsAry'nextnonce'; - $challenge'nc' = 1; - } - } - - /** - * Creates a value for Proxy-Authorization header when using digest authentication - * - * @param string $user user name - * @param string $password password - * @param string $url request URL - * @param array &$challenge digest challenge parameters - * - * @return string value of Proxy-Authorization request header - * @link http://tools.ietf.org/html/rfc2617#section-3.2.2 - */ - protected function createDigestResponse($user, $password, $url, &$challenge) - { - if (false !== ($q = strpos($url, '?')) - && $this->request->getConfig('digest_compat_ie') - ) { - $url = substr($url, 0, $q); - } - - $a1 = md5($user . ':' . $challenge'realm' . ':' . $password); - $a2 = md5($this->request->getMethod() . ':' . $url); - - if (empty($challenge'qop')) { - $digest = md5($a1 . ':' . $challenge'nonce' . ':' . $a2); - } else { - $challenge'cnonce' = 'Req2.' . rand(); - if (empty($challenge'nc')) { - $challenge'nc' = 1; - } - $nc = sprintf('%08x', $challenge'nc'++); - $digest = md5( - $a1 . ':' . $challenge'nonce' . ':' . $nc . ':' . - $challenge'cnonce' . ':auth:' . $a2 - ); - } - return 'Digest username="' . str_replace(array('\\', '"'), array('\\\\', '\\"'), $user) . '", ' . - 'realm="' . $challenge'realm' . '", ' . - 'nonce="' . $challenge'nonce' . '", ' . - 'uri="' . $url . '", ' . - 'response="' . $digest . '"' . - (!empty($challenge'opaque')? - ', opaque="' . $challenge'opaque' . '"': - '') . - (!empty($challenge'qop')? - ', qop="auth", nc=' . $nc . ', cnonce="' . $challenge'cnonce' . '"': - ''); - } - - /** - * Adds 'Authorization' header (if needed) to request headers array - * - * @param array &$headers request headers - * @param string $requestHost request host (needed for digest authentication) - * @param string $requestUrl request URL (needed for digest authentication) - * - * @throws HTTP_Request2_NotImplementedException - */ - protected function addAuthorizationHeader(&$headers, $requestHost, $requestUrl) - { - if (!($auth = $this->request->getAuth())) { - return; - } - switch ($auth'scheme') { - case HTTP_Request2::AUTH_BASIC: - $headers'authorization' = 'Basic ' . base64_encode( - $auth'user' . ':' . $auth'password' - ); - break; - - case HTTP_Request2::AUTH_DIGEST: - unset($this->serverChallenge); - $fullUrl = ('/' == $requestUrl0)? - $this->request->getUrl()->getScheme() . '://' . - $requestHost . $requestUrl: - $requestUrl; - foreach (array_keys(self::$challenges) as $key) { - if ($key == substr($fullUrl, 0, strlen($key))) { - $headers'authorization' = $this->createDigestResponse( - $auth'user', $auth'password', - $requestUrl, self::$challenges$key - ); - $this->serverChallenge =& self::$challenges$key; - break; - } - } - break; - - default: - throw new HTTP_Request2_NotImplementedException( - "Unknown HTTP authentication scheme '{$auth'scheme'}'" - ); - } - } - - /** - * Adds 'Proxy-Authorization' header (if needed) to request headers array - * - * @param array &$headers request headers - * @param string $requestUrl request URL (needed for digest authentication) - * - * @throws HTTP_Request2_NotImplementedException - */ - protected function addProxyAuthorizationHeader(&$headers, $requestUrl) - { - if (!$this->request->getConfig('proxy_host') - || !($user = $this->request->getConfig('proxy_user')) - || (0 == strcasecmp('https', $this->request->getUrl()->getScheme()) - && HTTP_Request2::METHOD_CONNECT != $this->request->getMethod()) - ) { - return; - } - - $password = $this->request->getConfig('proxy_password'); - switch ($this->request->getConfig('proxy_auth_scheme')) { - case HTTP_Request2::AUTH_BASIC: - $headers'proxy-authorization' = 'Basic ' . base64_encode( - $user . ':' . $password - ); - break; - - case HTTP_Request2::AUTH_DIGEST: - unset($this->proxyChallenge); - $proxyUrl = 'proxy://' . $this->request->getConfig('proxy_host') . - ':' . $this->request->getConfig('proxy_port'); - if (!empty(self::$challenges$proxyUrl)) { - $headers'proxy-authorization' = $this->createDigestResponse( - $user, $password, - $requestUrl, self::$challenges$proxyUrl - ); - $this->proxyChallenge =& self::$challenges$proxyUrl; - } - break; - - default: - throw new HTTP_Request2_NotImplementedException( - "Unknown HTTP authentication scheme '" . - $this->request->getConfig('proxy_auth_scheme') . "'" - ); - } - } - - - /** - * Creates the string with the Request-Line and request headers - * - * @return string - * @throws HTTP_Request2_Exception - */ - protected function prepareHeaders() - { - $headers = $this->request->getHeaders(); - $url = $this->request->getUrl(); - $connect = HTTP_Request2::METHOD_CONNECT == $this->request->getMethod(); - $host = $url->getHost(); - - $defaultPort = 0 == strcasecmp($url->getScheme(), 'https')? 443: 80; - if (($port = $url->getPort()) && $port != $defaultPort || $connect) { - $host .= ':' . (empty($port)? $defaultPort: $port); - } - // Do not overwrite explicitly set 'Host' header, see bug #16146 - if (!isset($headers'host')) { - $headers'host' = $host; - } - - if ($connect) { - $requestUrl = $host; - - } else { - if (!$this->request->getConfig('proxy_host') - || 'http' != $this->request->getConfig('proxy_type') - || 0 == strcasecmp($url->getScheme(), 'https') - ) { - $requestUrl = ''; - } else { - $requestUrl = $url->getScheme() . '://' . $host; - } - $path = $url->getPath(); - $query = $url->getQuery(); - $requestUrl .= (empty($path)? '/': $path) . (empty($query)? '': '?' . $query); - } - - if ('1.1' == $this->request->getConfig('protocol_version') - && extension_loaded('zlib') && !isset($headers'accept-encoding') - ) { - $headers'accept-encoding' = 'gzip, deflate'; - } - if (($jar = $this->request->getCookieJar()) - && ($cookies = $jar->getMatching($this->request->getUrl(), true)) - ) { - $headers'cookie' = (empty($headers'cookie')? '': $headers'cookie' . '; ') . $cookies; - } - - $this->addAuthorizationHeader($headers, $host, $requestUrl); - $this->addProxyAuthorizationHeader($headers, $requestUrl); - $this->calculateRequestLength($headers); - if ('1.1' == $this->request->getConfig('protocol_version')) { - $this->updateExpectHeader($headers); - } else { - $this->expect100Continue = false; - } - - $headersStr = $this->request->getMethod() . ' ' . $requestUrl . ' HTTP/' . - $this->request->getConfig('protocol_version') . "\r\n"; - foreach ($headers as $name => $value) { - $canonicalName = implode('-', array_map('ucfirst', explode('-', $name))); - $headersStr .= $canonicalName . ': ' . $value . "\r\n"; - } - return $headersStr . "\r\n"; - } - - /** - * Adds or removes 'Expect: 100-continue' header from request headers - * - * Also sets the $expect100Continue property. Parsing of existing header - * is somewhat needed due to its complex structure and due to the - * requirement in section 8.2.3 of RFC 2616: - * > A client MUST NOT send an Expect request-header field (section - * > 14.20) with the "100-continue" expectation if it does not intend - * > to send a request body. - * - * @param array &$headers Array of headers prepared for the request - * - * @throws HTTP_Request2_LogicException - * @link http://pear.php.net/bugs/bug.php?id=19233 - * @link http://tools.ietf.org/html/rfc2616#section-8.2.3 - */ - protected function updateExpectHeader(&$headers) - { - $this->expect100Continue = false; - $expectations = array(); - if (isset($headers'expect')) { - if ('' === $headers'expect') { - // empty 'Expect' header is technically invalid, so just get rid of it - unset($headers'expect'); - return; - } - // build regexp to parse the value of existing Expect header - $expectParam = ';\s*' . self::REGEXP_TOKEN . '(?:\s*=\s*(?:' - . self::REGEXP_TOKEN . '|' - . self::REGEXP_QUOTED_STRING . '))?\s*'; - $expectExtension = self::REGEXP_TOKEN . '(?:\s*=\s*(?:' - . self::REGEXP_TOKEN . '|' - . self::REGEXP_QUOTED_STRING . ')\s*(?:' - . $expectParam . ')*)?'; - $expectItem = '!(100-continue|' . $expectExtension . ')!A'; - - $pos = 0; - $length = strlen($headers'expect'); - - while ($pos < $length) { - $pos += strspn($headers'expect', " \t", $pos); - if (',' === substr($headers'expect', $pos, 1)) { - $pos++; - continue; - - } elseif (!preg_match($expectItem, $headers'expect', $m, 0, $pos)) { - throw new HTTP_Request2_LogicException( - "Cannot parse value '{$headers'expect'}' of Expect header", - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - - } else { - $pos += strlen($m0); - if (strcasecmp('100-continue', $m0)) { - $expectations = $m0; - } - } - } - } - - if (1024 < $this->contentLength) { - $expectations = '100-continue'; - $this->expect100Continue = true; - } - - if (empty($expectations)) { - unset($headers'expect'); - } else { - $headers'expect' = implode(',', $expectations); - } - } - - /** - * Sends the request body - * - * @throws HTTP_Request2_MessageException - */ - protected function writeBody() - { - if (in_array($this->request->getMethod(), self::$bodyDisallowed) - || 0 == $this->contentLength - ) { - return; - } - - $position = 0; - $bufferSize = $this->request->getConfig('buffer_size'); - $headers = $this->request->getHeaders(); - $chunked = isset($headers'transfer-encoding'); - while ($position < $this->contentLength) { - if (is_string($this->requestBody)) { - $str = substr($this->requestBody, $position, $bufferSize); - } elseif (is_resource($this->requestBody)) { - $str = fread($this->requestBody, $bufferSize); - } else { - $str = $this->requestBody->read($bufferSize); - } - if (!$chunked) { - $this->socket->write($str); - } else { - $this->socket->write(dechex(strlen($str)) . "\r\n{$str}\r\n"); - } - // Provide the length of written string to the observer, request #7630 - $this->request->setLastEvent('sentBodyPart', strlen($str)); - $position += strlen($str); - } - - // write zero-length chunk - if ($chunked) { - $this->socket->write("0\r\n\r\n"); - } - $this->request->setLastEvent('sentBody', $this->contentLength); - } - - /** - * Reads the remote server's response - * - * @return HTTP_Request2_Response - * @throws HTTP_Request2_Exception - */ - protected function readResponse() - { - $bufferSize = $this->request->getConfig('buffer_size'); - // http://tools.ietf.org/html/rfc2616#section-8.2.3 - // ...the client SHOULD NOT wait for an indefinite period before sending the request body - $timeout = $this->expect100Continue ? 1 : null; - - do { - try { - $response = new HTTP_Request2_Response( - $this->socket->readLine($bufferSize, $timeout), true, $this->request->getUrl() - ); - do { - $headerLine = $this->socket->readLine($bufferSize); - $response->parseHeaderLine($headerLine); - } while ('' != $headerLine); - - } catch (HTTP_Request2_MessageException $e) { - if (HTTP_Request2_Exception::TIMEOUT === $e->getCode() - && $this->expect100Continue - ) { - return null; - } - throw $e; - } - if ($this->expect100Continue && 100 == $response->getStatus()) { - return $response; - } - } while (in_array($response->getStatus(), array(100, 101))); - - $this->request->setLastEvent('receivedHeaders', $response); - - // No body possible in such responses - if (HTTP_Request2::METHOD_HEAD == $this->request->getMethod() - || (HTTP_Request2::METHOD_CONNECT == $this->request->getMethod() - && 200 <= $response->getStatus() && 300 > $response->getStatus()) - || in_array($response->getStatus(), array(204, 304)) - ) { - return $response; - } - - $chunked = 'chunked' == $response->getHeader('transfer-encoding'); - $length = $response->getHeader('content-length'); - $hasBody = false; - // RFC 2616, section 4.4: - // 3. ... If a message is received with both a - // Transfer-Encoding header field and a Content-Length header field, - // the latter MUST be ignored. - $toRead = ($chunked || null === $length)? null: $length; - $this->chunkLength = 0; - - if ($chunked || null === $length || 0 < intval($length)) { - while (!$this->socket->eof() && (is_null($toRead) || 0 < $toRead)) { - if ($chunked) { - $data = $this->readChunked($bufferSize); - } elseif (is_null($toRead)) { - $data = $this->socket->read($bufferSize); - } else { - $data = $this->socket->read(min($toRead, $bufferSize)); - $toRead -= strlen($data); - } - if ('' == $data && (!$this->chunkLength || $this->socket->eof())) { - break; - } - - $hasBody = true; - if ($this->request->getConfig('store_body')) { - $response->appendBody($data); - } - if (!in_array($response->getHeader('content-encoding'), array('identity', null))) { - $this->request->setLastEvent('receivedEncodedBodyPart', $data); - } else { - $this->request->setLastEvent('receivedBodyPart', $data); - } - } - } - if (0 !== $this->chunkLength || null !== $toRead && $toRead > 0) { - $this->request->setLastEvent( - 'warning', 'transfer closed with outstanding read data remaining' - ); - } - - if ($hasBody) { - $this->request->setLastEvent('receivedBody', $response); - } - return $response; - } - - /** - * Reads a part of response body encoded with chunked Transfer-Encoding - * - * @param int $bufferSize buffer size to use for reading - * - * @return string - * @throws HTTP_Request2_MessageException - */ - protected function readChunked($bufferSize) - { - // at start of the next chunk? - if (0 == $this->chunkLength) { - $line = $this->socket->readLine($bufferSize); - if ('' === $line && $this->socket->eof()) { - $this->chunkLength = -1; // indicate missing chunk - return ''; - - } elseif (!preg_match('/^(0-9a-f+)/i', $line, $matches)) { - throw new HTTP_Request2_MessageException( - "Cannot decode chunked response, invalid chunk length '{$line}'", - HTTP_Request2_Exception::DECODE_ERROR - ); - - } else { - $this->chunkLength = hexdec($matches1); - // Chunk with zero length indicates the end - if (0 == $this->chunkLength) { - $this->socket->readLine($bufferSize); - return ''; - } - } - } - $data = $this->socket->read(min($this->chunkLength, $bufferSize)); - $this->chunkLength -= strlen($data); - if (0 == $this->chunkLength) { - $this->socket->readLine($bufferSize); // Trailing CRLF - } - return $data; - } -} - -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/CookieJar.php
Deleted
@@ -1,547 +0,0 @@ -<?php -/** - * Stores cookies and passes them between HTTP requests - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Class representing a HTTP request message */ -require_once 'HTTP/Request2.php'; - -/** - * Stores cookies and passes them between HTTP requests - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: @package_version@ - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_CookieJar implements Serializable -{ - /** - * Array of stored cookies - * - * The array is indexed by domain, path and cookie name - * .example.com - * / - * some_cookie => cookie data - * /subdir - * other_cookie => cookie data - * .example.org - * ... - * - * @var array - */ - protected $cookies = array(); - - /** - * Whether session cookies should be serialized when serializing the jar - * @var bool - */ - protected $serializeSession = false; - - /** - * Whether Public Suffix List should be used for domain matching - * @var bool - */ - protected $useList = true; - - /** - * Whether an attempt to store an invalid cookie should be ignored, rather than cause an Exception - * @var bool - */ - protected $ignoreInvalid = false; - - /** - * Array with Public Suffix List data - * @var array - * @link http://publicsuffix.org/ - */ - protected static $psl = array(); - - /** - * Class constructor, sets various options - * - * @param bool $serializeSessionCookies Controls serializing session cookies, - * see {@link serializeSessionCookies()} - * @param bool $usePublicSuffixList Controls using Public Suffix List, - * see {@link usePublicSuffixList()} - * @param bool $ignoreInvalidCookies Whether invalid cookies should be ignored, - * see {@link ignoreInvalidCookies()} - */ - public function __construct( - $serializeSessionCookies = false, $usePublicSuffixList = true, - $ignoreInvalidCookies = false - ) { - $this->serializeSessionCookies($serializeSessionCookies); - $this->usePublicSuffixList($usePublicSuffixList); - $this->ignoreInvalidCookies($ignoreInvalidCookies); - } - - /** - * Returns current time formatted in ISO-8601 at UTC timezone - * - * @return string - */ - protected function now() - { - $dt = new DateTime(); - $dt->setTimezone(new DateTimeZone('UTC')); - return $dt->format(DateTime::ISO8601); - } - - /** - * Checks cookie array for correctness, possibly updating its 'domain', 'path' and 'expires' fields - * - * The checks are as follows: - * - cookie array should contain 'name' and 'value' fields; - * - name and value should not contain disallowed symbols; - * - 'expires' should be either empty parseable by DateTime; - * - 'domain' and 'path' should be either not empty or an URL where - * cookie was set should be provided. - * - if $setter is provided, then document at that URL should be allowed - * to set a cookie for that 'domain'. If $setter is not provided, - * then no domain checks will be made. - * - * 'expires' field will be converted to ISO8601 format from COOKIE format, - * 'domain' and 'path' will be set from setter URL if empty. - * - * @param array $cookie cookie data, as returned by - * {@link HTTP_Request2_Response::getCookies()} - * @param Net_URL2 $setter URL of the document that sent Set-Cookie header - * - * @return array Updated cookie array - * @throws HTTP_Request2_LogicException - * @throws HTTP_Request2_MessageException - */ - protected function checkAndUpdateFields(array $cookie, Net_URL2 $setter = null) - { - if ($missing = array_diff(array('name', 'value'), array_keys($cookie))) { - throw new HTTP_Request2_LogicException( - "Cookie array should contain 'name' and 'value' fields", - HTTP_Request2_Exception::MISSING_VALUE - ); - } - if (preg_match(HTTP_Request2::REGEXP_INVALID_COOKIE, $cookie'name')) { - throw new HTTP_Request2_LogicException( - "Invalid cookie name: '{$cookie'name'}'", - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - if (preg_match(HTTP_Request2::REGEXP_INVALID_COOKIE, $cookie'value')) { - throw new HTTP_Request2_LogicException( - "Invalid cookie value: '{$cookie'value'}'", - HTTP_Request2_Exception::INVALID_ARGUMENT - ); - } - $cookie += array('domain' => '', 'path' => '', 'expires' => null, 'secure' => false); - - // Need ISO-8601 date @ UTC timezone - if (!empty($cookie'expires') - && !preg_match('/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\+0000$/', $cookie'expires') - ) { - try { - $dt = new DateTime($cookie'expires'); - $dt->setTimezone(new DateTimeZone('UTC')); - $cookie'expires' = $dt->format(DateTime::ISO8601); - } catch (Exception $e) { - throw new HTTP_Request2_LogicException($e->getMessage()); - } - } - - if (empty($cookie'domain') || empty($cookie'path')) { - if (!$setter) { - throw new HTTP_Request2_LogicException( - 'Cookie misses domain and/or path component, cookie setter URL needed', - HTTP_Request2_Exception::MISSING_VALUE - ); - } - if (empty($cookie'domain')) { - if ($host = $setter->getHost()) { - $cookie'domain' = $host; - } else { - throw new HTTP_Request2_LogicException( - 'Setter URL does not contain host part, can\'t set cookie domain', - HTTP_Request2_Exception::MISSING_VALUE - ); - } - } - if (empty($cookie'path')) { - $path = $setter->getPath(); - $cookie'path' = empty($path)? '/': substr($path, 0, strrpos($path, '/') + 1); - } - } - - if ($setter && !$this->domainMatch($setter->getHost(), $cookie'domain')) { - throw new HTTP_Request2_MessageException( - "Domain " . $setter->getHost() . " cannot set cookies for " - . $cookie'domain' - ); - } - - return $cookie; - } - - /** - * Stores a cookie in the jar - * - * @param array $cookie cookie data, as returned by - * {@link HTTP_Request2_Response::getCookies()} - * @param Net_URL2 $setter URL of the document that sent Set-Cookie header - * - * @return bool whether the cookie was successfully stored - * @throws HTTP_Request2_Exception - */ - public function store(array $cookie, Net_URL2 $setter = null) - { - try { - $cookie = $this->checkAndUpdateFields($cookie, $setter); - } catch (HTTP_Request2_Exception $e) { - if ($this->ignoreInvalid) { - return false; - } else { - throw $e; - } - } - - if (strlen($cookie'value') - && (is_null($cookie'expires') || $cookie'expires' > $this->now()) - ) { - if (!isset($this->cookies$cookie'domain')) { - $this->cookies$cookie'domain' = array(); - } - if (!isset($this->cookies$cookie'domain'$cookie'path')) { - $this->cookies$cookie'domain'$cookie'path' = array(); - } - $this->cookies$cookie'domain'$cookie'path'$cookie'name' = $cookie; - - } elseif (isset($this->cookies$cookie'domain'$cookie'path'$cookie'name')) { - unset($this->cookies$cookie'domain'$cookie'path'$cookie'name'); - } - - return true; - } - - /** - * Adds cookies set in HTTP response to the jar - * - * @param HTTP_Request2_Response $response HTTP response message - * @param Net_URL2 $setter original request URL, needed for - * setting default domain/path. If not given, - * effective URL from response will be used. - * - * @return bool whether all cookies were successfully stored - * @throws HTTP_Request2_LogicException - */ - public function addCookiesFromResponse(HTTP_Request2_Response $response, Net_URL2 $setter = null) - { - if (null === $setter) { - if (!($effectiveUrl = $response->getEffectiveUrl())) { - throw new HTTP_Request2_LogicException( - 'Response URL required for adding cookies from response', - HTTP_Request2_Exception::MISSING_VALUE - ); - } - $setter = new Net_URL2($effectiveUrl); - } - - $success = true; - foreach ($response->getCookies() as $cookie) { - $success = $this->store($cookie, $setter) && $success; - } - return $success; - } - - /** - * Returns all cookies matching a given request URL - * - * The following checks are made: - * - cookie domain should match request host - * - cookie path should be a prefix for request path - * - 'secure' cookies will only be sent for HTTPS requests - * - * @param Net_URL2 $url Request url - * @param bool $asString Whether to return cookies as string for "Cookie: " header - * - * @return array|string Matching cookies - */ - public function getMatching(Net_URL2 $url, $asString = false) - { - $host = $url->getHost(); - $path = $url->getPath(); - $secure = 0 == strcasecmp($url->getScheme(), 'https'); - - $matched = $ret = array(); - foreach (array_keys($this->cookies) as $domain) { - if ($this->domainMatch($host, $domain)) { - foreach (array_keys($this->cookies$domain) as $cPath) { - if (0 === strpos($path, $cPath)) { - foreach ($this->cookies$domain$cPath as $name => $cookie) { - if (!$cookie'secure' || $secure) { - $matched$namestrlen($cookie'path') = $cookie; - } - } - } - } - } - } - foreach ($matched as $cookies) { - krsort($cookies); - $ret = array_merge($ret, $cookies); - } - if (!$asString) { - return $ret; - } else { - $str = ''; - foreach ($ret as $c) { - $str .= (empty($str)? '': '; ') . $c'name' . '=' . $c'value'; - } - return $str; - } - } - - /** - * Returns all cookies stored in a jar - * - * @return array - */ - public function getAll() - { - $cookies = array(); - foreach (array_keys($this->cookies) as $domain) { - foreach (array_keys($this->cookies$domain) as $path) { - foreach ($this->cookies$domain$path as $name => $cookie) { - $cookies = $cookie; - } - } - } - return $cookies; - } - - /** - * Sets whether session cookies should be serialized when serializing the jar - * - * @param boolean $serialize serialize? - */ - public function serializeSessionCookies($serialize) - { - $this->serializeSession = (bool)$serialize; - } - - /** - * Sets whether invalid cookies should be silently ignored or cause an Exception - * - * @param boolean $ignore ignore? - * @link http://pear.php.net/bugs/bug.php?id=19937 - * @link http://pear.php.net/bugs/bug.php?id=20401 - */ - public function ignoreInvalidCookies($ignore) - { - $this->ignoreInvalid = (bool)$ignore; - } - - /** - * Sets whether Public Suffix List should be used for restricting cookie-setting - * - * Without PSL {@link domainMatch()} will only prevent setting cookies for - * top-level domains like '.com' or '.org'. However, it will not prevent - * setting a cookie for '.co.uk' even though only third-level registrations - * are possible in .uk domain. - * - * With the List it is possible to find the highest level at which a domain - * may be registered for a particular top-level domain and consequently - * prevent cookies set for '.co.uk' or '.msk.ru'. The same list is used by - * Firefox, Chrome and Opera browsers to restrict cookie setting. - * - * Note that PSL is licensed differently to HTTP_Request2 package (refer to - * the license information in public-suffix-list.php), so you can disable - * its use if this is an issue for you. - * - * @param boolean $useList use the list? - * - * @link http://publicsuffix.org/learn/ - */ - public function usePublicSuffixList($useList) - { - $this->useList = (bool)$useList; - } - - /** - * Returns string representation of object - * - * @return string - * - * @see Serializable::serialize() - */ - public function serialize() - { - $cookies = $this->getAll(); - if (!$this->serializeSession) { - for ($i = count($cookies) - 1; $i >= 0; $i--) { - if (empty($cookies$i'expires')) { - unset($cookies$i); - } - } - } - return serialize(array( - 'cookies' => $cookies, - 'serializeSession' => $this->serializeSession, - 'useList' => $this->useList, - 'ignoreInvalid' => $this->ignoreInvalid - )); - } - - /** - * Constructs the object from serialized string - * - * @param string $serialized string representation - * - * @see Serializable::unserialize() - */ - public function unserialize($serialized) - { - $data = unserialize($serialized); - $now = $this->now(); - $this->serializeSessionCookies($data'serializeSession'); - $this->usePublicSuffixList($data'useList'); - if (array_key_exists('ignoreInvalid', $data)) { - $this->ignoreInvalidCookies($data'ignoreInvalid'); - } - foreach ($data'cookies' as $cookie) { - if (!empty($cookie'expires') && $cookie'expires' <= $now) { - continue; - } - if (!isset($this->cookies$cookie'domain')) { - $this->cookies$cookie'domain' = array(); - } - if (!isset($this->cookies$cookie'domain'$cookie'path')) { - $this->cookies$cookie'domain'$cookie'path' = array(); - } - $this->cookies$cookie'domain'$cookie'path'$cookie'name' = $cookie; - } - } - - /** - * Checks whether a cookie domain matches a request host. - * - * The method is used by {@link store()} to check for whether a document - * at given URL can set a cookie with a given domain attribute and by - * {@link getMatching()} to find cookies matching the request URL. - * - * @param string $requestHost request host - * @param string $cookieDomain cookie domain - * - * @return bool match success - */ - public function domainMatch($requestHost, $cookieDomain) - { - if ($requestHost == $cookieDomain) { - return true; - } - // IP address, we require exact match - if (preg_match('/^(?:\d{1,3}\.){3}\d{1,3}$/', $requestHost)) { - return false; - } - if ('.' != $cookieDomain0) { - $cookieDomain = '.' . $cookieDomain; - } - // prevents setting cookies for '.com' and similar domains - if (!$this->useList && substr_count($cookieDomain, '.') < 2 - || $this->useList && !self::getRegisteredDomain($cookieDomain) - ) { - return false; - } - return substr('.' . $requestHost, -strlen($cookieDomain)) == $cookieDomain; - } - - /** - * Removes subdomains to get the registered domain (the first after top-level) - * - * The method will check Public Suffix List to find out where top-level - * domain ends and registered domain starts. It will remove domain parts - * to the left of registered one. - * - * @param string $domain domain name - * - * @return string|bool registered domain, will return false if $domain is - * either invalid or a TLD itself - */ - public static function getRegisteredDomain($domain) - { - $domainParts = explode('.', ltrim($domain, '.')); - - // load the list if needed - if (empty(self::$psl)) { - $path = '@data_dir@' . DIRECTORY_SEPARATOR . 'HTTP_Request2'; - if (0 === strpos($path, '@' . 'data_dir@')) { - $path = realpath( - dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' - . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data' - ); - } - self::$psl = include_once $path . DIRECTORY_SEPARATOR . 'public-suffix-list.php'; - } - - if (!($result = self::checkDomainsList($domainParts, self::$psl))) { - // known TLD, invalid domain name - return false; - } - - // unknown TLD - if (!strpos($result, '.')) { - // fallback to checking that domain "has at least two dots" - if (2 > ($count = count($domainParts))) { - return false; - } - return $domainParts$count - 2 . '.' . $domainParts$count - 1; - } - return $result; - } - - /** - * Recursive helper method for {@link getRegisteredDomain()} - * - * @param array $domainParts remaining domain parts - * @param mixed $listNode node in {@link HTTP_Request2_CookieJar::$psl} to check - * - * @return string|null concatenated domain parts, null in case of error - */ - protected static function checkDomainsList(array $domainParts, $listNode) - { - $sub = array_pop($domainParts); - $result = null; - - if (!is_array($listNode) || is_null($sub) - || array_key_exists('!' . $sub, $listNode) - ) { - return $sub; - - } elseif (array_key_exists($sub, $listNode)) { - $result = self::checkDomainsList($domainParts, $listNode$sub); - - } elseif (array_key_exists('*', $listNode)) { - $result = self::checkDomainsList($domainParts, $listNode'*'); - - } else { - return $sub; - } - - return (strlen($result) > 0) ? ($result . '.' . $sub) : null; - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/Exception.php
Deleted
@@ -1,160 +0,0 @@ -<?php -/** - * Exception classes for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** - * Base class for exceptions in PEAR - */ -require_once 'PEAR/Exception.php'; - -/** - * Base exception class for HTTP_Request2 package - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=132 - */ -class HTTP_Request2_Exception extends PEAR_Exception -{ - /** An invalid argument was passed to a method */ - const INVALID_ARGUMENT = 1; - /** Some required value was not available */ - const MISSING_VALUE = 2; - /** Request cannot be processed due to errors in PHP configuration */ - const MISCONFIGURATION = 3; - /** Error reading the local file */ - const READ_ERROR = 4; - - /** Server returned a response that does not conform to HTTP protocol */ - const MALFORMED_RESPONSE = 10; - /** Failure decoding Content-Encoding or Transfer-Encoding of response */ - const DECODE_ERROR = 20; - /** Operation timed out */ - const TIMEOUT = 30; - /** Number of redirects exceeded 'max_redirects' configuration parameter */ - const TOO_MANY_REDIRECTS = 40; - /** Redirect to a protocol other than http(s):// */ - const NON_HTTP_REDIRECT = 50; - - /** - * Native error code - * @var int - */ - private $_nativeCode; - - /** - * Constructor, can set package error code and native error code - * - * @param string $message exception message - * @param int $code package error code, one of class constants - * @param int $nativeCode error code from underlying PHP extension - */ - public function __construct($message = null, $code = null, $nativeCode = null) - { - parent::__construct($message, $code); - $this->_nativeCode = $nativeCode; - } - - /** - * Returns error code produced by underlying PHP extension - * - * For Socket Adapter this may contain error number returned by - * stream_socket_client(), for Curl Adapter this will contain error number - * returned by curl_errno() - * - * @return integer - */ - public function getNativeCode() - { - return $this->_nativeCode; - } -} - -/** - * Exception thrown in case of missing features - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_NotImplementedException extends HTTP_Request2_Exception -{ -} - -/** - * Exception that represents error in the program logic - * - * This exception usually implies a programmer's error, like passing invalid - * data to methods or trying to use PHP extensions that weren't installed or - * enabled. Usually exceptions of this kind will be thrown before request even - * starts. - * - * The exception will usually contain a package error code. - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_LogicException extends HTTP_Request2_Exception -{ -} - -/** - * Exception thrown when connection to a web or proxy server fails - * - * The exception will not contain a package error code, but will contain - * native error code, as returned by stream_socket_client() or curl_errno(). - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_ConnectionException extends HTTP_Request2_Exception -{ -} - -/** - * Exception thrown when sending or receiving HTTP message fails - * - * The exception may contain both package error code and native error code. - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_MessageException extends HTTP_Request2_Exception -{ -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/MultipartBody.php
Deleted
@@ -1,268 +0,0 @@ -<?php -/** - * Helper class for building multipart/form-data request body - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Exception class for HTTP_Request2 package */ -require_once 'HTTP/Request2/Exception.php'; - -/** - * Class for building multipart/form-data request body - * - * The class helps to reduce memory consumption by streaming large file uploads - * from disk, it also allows monitoring of upload progress (see request #7630) - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - * @link http://tools.ietf.org/html/rfc1867 - */ -class HTTP_Request2_MultipartBody -{ - /** - * MIME boundary - * @var string - */ - private $_boundary; - - /** - * Form parameters added via {@link HTTP_Request2::addPostParameter()} - * @var array - */ - private $_params = array(); - - /** - * File uploads added via {@link HTTP_Request2::addUpload()} - * @var array - */ - private $_uploads = array(); - - /** - * Header for parts with parameters - * @var string - */ - private $_headerParam = "--%s\r\nContent-Disposition: form-data; name=\"%s\"\r\n\r\n"; - - /** - * Header for parts with uploads - * @var string - */ - private $_headerUpload = "--%s\r\nContent-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\nContent-Type: %s\r\n\r\n"; - - /** - * Current position in parameter and upload arrays - * - * First number is index of "current" part, second number is position within - * "current" part - * - * @var array - */ - private $_pos = array(0, 0); - - - /** - * Constructor. Sets the arrays with POST data. - * - * @param array $params values of form fields set via - * {@link HTTP_Request2::addPostParameter()} - * @param array $uploads file uploads set via - * {@link HTTP_Request2::addUpload()} - * @param bool $useBrackets whether to append brackets to array variable names - */ - public function __construct(array $params, array $uploads, $useBrackets = true) - { - $this->_params = self::_flattenArray('', $params, $useBrackets); - foreach ($uploads as $fieldName => $f) { - if (!is_array($f'fp')) { - $this->_uploads = $f + array('name' => $fieldName); - } else { - for ($i = 0; $i < count($f'fp'); $i++) { - $upload = array( - 'name' => ($useBrackets? $fieldName . '' . $i . '': $fieldName) - ); - foreach (array('fp', 'filename', 'size', 'type') as $key) { - $upload$key = $f$key$i; - } - $this->_uploads = $upload; - } - } - } - } - - /** - * Returns the length of the body to use in Content-Length header - * - * @return integer - */ - public function getLength() - { - $boundaryLength = strlen($this->getBoundary()); - $headerParamLength = strlen($this->_headerParam) - 4 + $boundaryLength; - $headerUploadLength = strlen($this->_headerUpload) - 8 + $boundaryLength; - $length = $boundaryLength + 6; - foreach ($this->_params as $p) { - $length += $headerParamLength + strlen($p0) + strlen($p1) + 2; - } - foreach ($this->_uploads as $u) { - $length += $headerUploadLength + strlen($u'name') + strlen($u'type') + - strlen($u'filename') + $u'size' + 2; - } - return $length; - } - - /** - * Returns the boundary to use in Content-Type header - * - * @return string - */ - public function getBoundary() - { - if (empty($this->_boundary)) { - $this->_boundary = '--' . md5('PEAR-HTTP_Request2-' . microtime()); - } - return $this->_boundary; - } - - /** - * Returns next chunk of request body - * - * @param integer $length Number of bytes to read - * - * @return string Up to $length bytes of data, empty string if at end - * @throws HTTP_Request2_LogicException - */ - public function read($length) - { - $ret = ''; - $boundary = $this->getBoundary(); - $paramCount = count($this->_params); - $uploadCount = count($this->_uploads); - while ($length > 0 && $this->_pos0 <= $paramCount + $uploadCount) { - $oldLength = $length; - if ($this->_pos0 < $paramCount) { - $param = sprintf( - $this->_headerParam, $boundary, $this->_params$this->_pos00 - ) . $this->_params$this->_pos01 . "\r\n"; - $ret .= substr($param, $this->_pos1, $length); - $length -= min(strlen($param) - $this->_pos1, $length); - - } elseif ($this->_pos0 < $paramCount + $uploadCount) { - $pos = $this->_pos0 - $paramCount; - $header = sprintf( - $this->_headerUpload, $boundary, $this->_uploads$pos'name', - $this->_uploads$pos'filename', $this->_uploads$pos'type' - ); - if ($this->_pos1 < strlen($header)) { - $ret .= substr($header, $this->_pos1, $length); - $length -= min(strlen($header) - $this->_pos1, $length); - } - $filePos = max(0, $this->_pos1 - strlen($header)); - if ($filePos < $this->_uploads$pos'size') { - while ($length > 0 && !feof($this->_uploads$pos'fp')) { - if (false === ($chunk = fread($this->_uploads$pos'fp', $length))) { - throw new HTTP_Request2_LogicException( - 'Failed reading file upload', HTTP_Request2_Exception::READ_ERROR - ); - } - $ret .= $chunk; - $length -= strlen($chunk); - } - } - if ($length > 0) { - $start = $this->_pos1 + ($oldLength - $length) - - strlen($header) - $this->_uploads$pos'size'; - $ret .= substr("\r\n", $start, $length); - $length -= min(2 - $start, $length); - } - - } else { - $closing = '--' . $boundary . "--\r\n"; - $ret .= substr($closing, $this->_pos1, $length); - $length -= min(strlen($closing) - $this->_pos1, $length); - } - if ($length > 0) { - $this->_pos = array($this->_pos0 + 1, 0); - } else { - $this->_pos1 += $oldLength; - } - } - return $ret; - } - - /** - * Sets the current position to the start of the body - * - * This allows reusing the same body in another request - */ - public function rewind() - { - $this->_pos = array(0, 0); - foreach ($this->_uploads as $u) { - rewind($u'fp'); - } - } - - /** - * Returns the body as string - * - * Note that it reads all file uploads into memory so it is a good idea not - * to use this method with large file uploads and rely on read() instead. - * - * @return string - */ - public function __toString() - { - $this->rewind(); - return $this->read($this->getLength()); - } - - - /** - * Helper function to change the (probably multidimensional) associative array - * into the simple one. - * - * @param string $name name for item - * @param mixed $values item's values - * @param bool $useBrackets whether to append to array variables' names - * - * @return array array with the following items: array('item name', 'item value'); - */ - private static function _flattenArray($name, $values, $useBrackets) - { - if (!is_array($values)) { - return array(array($name, $values)); - } else { - $ret = array(); - foreach ($values as $k => $v) { - if (empty($name)) { - $newName = $k; - } elseif ($useBrackets) { - $newName = $name . '' . $k . ''; - } else { - $newName = $name; - } - $ret = array_merge($ret, self::_flattenArray($newName, $v, $useBrackets)); - } - return $ret; - } - } -} -?>
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/Observer/Log.php
Deleted
@@ -1,192 +0,0 @@ -<?php -/** - * An observer useful for debugging / testing. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author David Jean Louis <izi@php.net> - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** - * Exception class for HTTP_Request2 package - */ -require_once 'HTTP/Request2/Exception.php'; - -/** - * A debug observer useful for debugging / testing. - * - * This observer logs to a log target data corresponding to the various request - * and response events, it logs by default to php://output but can be configured - * to log to a file or via the PEAR Log package. - * - * A simple example: - * <code> - * require_once 'HTTP/Request2.php'; - * require_once 'HTTP/Request2/Observer/Log.php'; - * - * $request = new HTTP_Request2('http://www.example.com'); - * $observer = new HTTP_Request2_Observer_Log(); - * $request->attach($observer); - * $request->send(); - * </code> - * - * A more complex example with PEAR Log: - * <code> - * require_once 'HTTP/Request2.php'; - * require_once 'HTTP/Request2/Observer/Log.php'; - * require_once 'Log.php'; - * - * $request = new HTTP_Request2('http://www.example.com'); - * // we want to log with PEAR log - * $observer = new HTTP_Request2_Observer_Log(Log::factory('console')); - * - * // we only want to log received headers - * $observer->events = array('receivedHeaders'); - * - * $request->attach($observer); - * $request->send(); - * </code> - * - * @category HTTP - * @package HTTP_Request2 - * @author David Jean Louis <izi@php.net> - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_Observer_Log implements SplObserver -{ - // properties {{{ - - /** - * The log target, it can be a a resource or a PEAR Log instance. - * - * @var resource|Log $target - */ - protected $target = null; - - /** - * The events to log. - * - * @var array $events - */ - public $events = array( - 'connect', - 'sentHeaders', - 'sentBody', - 'receivedHeaders', - 'receivedBody', - 'disconnect', - ); - - // }}} - // __construct() {{{ - - /** - * Constructor. - * - * @param mixed $target Can be a file path (default: php://output), a resource, - * or an instance of the PEAR Log class. - * @param array $events Array of events to listen to (default: all events) - * - * @return void - */ - public function __construct($target = 'php://output', array $events = array()) - { - if (!empty($events)) { - $this->events = $events; - } - if (is_resource($target) || $target instanceof Log) { - $this->target = $target; - } elseif (false === ($this->target = @fopen($target, 'ab'))) { - throw new HTTP_Request2_Exception("Unable to open '{$target}'"); - } - } - - // }}} - // update() {{{ - - /** - * Called when the request notifies us of an event. - * - * @param HTTP_Request2 $subject The HTTP_Request2 instance - * - * @return void - */ - public function update(SplSubject $subject) - { - $event = $subject->getLastEvent(); - if (!in_array($event'name', $this->events)) { - return; - } - - switch ($event'name') { - case 'connect': - $this->log('* Connected to ' . $event'data'); - break; - case 'sentHeaders': - $headers = explode("\r\n", $event'data'); - array_pop($headers); - foreach ($headers as $header) { - $this->log('> ' . $header); - } - break; - case 'sentBody': - $this->log('> ' . $event'data' . ' byte(s) sent'); - break; - case 'receivedHeaders': - $this->log(sprintf( - '< HTTP/%s %s %s', $event'data'->getVersion(), - $event'data'->getStatus(), $event'data'->getReasonPhrase() - )); - $headers = $event'data'->getHeader(); - foreach ($headers as $key => $val) { - $this->log('< ' . $key . ': ' . $val); - } - $this->log('< '); - break; - case 'receivedBody': - $this->log($event'data'->getBody()); - break; - case 'disconnect': - $this->log('* Disconnected'); - break; - } - } - - // }}} - // log() {{{ - - /** - * Logs the given message to the configured target. - * - * @param string $message Message to display - * - * @return void - */ - protected function log($message) - { - if ($this->target instanceof Log) { - $this->target->debug($message); - } elseif (is_resource($this->target)) { - fwrite($this->target, $message . "\r\n"); - } - } - - // }}} -} - -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/Observer/UncompressingDownload.php
Deleted
@@ -1,265 +0,0 @@ -<?php -/** - * An observer that saves response body to stream, possibly uncompressing it - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Delian Krustev <krustev@krustev.net> - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -require_once 'HTTP/Request2/Response.php'; - -/** - * An observer that saves response body to stream, possibly uncompressing it - * - * This Observer is written in compliment to pear's HTTP_Request2 in order to - * avoid reading the whole response body in memory. Instead it writes the body - * to a stream. If the body is transferred with content-encoding set to - * "deflate" or "gzip" it is decoded on the fly. - * - * The constructor accepts an already opened (for write) stream (file_descriptor). - * If the response is deflate/gzip encoded a "zlib.inflate" filter is applied - * to the stream. When the body has been read from the request and written to - * the stream ("receivedBody" event) the filter is removed from the stream. - * - * The "zlib.inflate" filter works fine with pure "deflate" encoding. It does - * not understand the "deflate+zlib" and "gzip" headers though, so they have to - * be removed prior to being passed to the stream. This is done in the "update" - * method. - * - * It is also possible to limit the size of written extracted bytes by passing - * "max_bytes" to the constructor. This is important because e.g. 1GB of - * zeroes take about a MB when compressed. - * - * Exceptions are being thrown if data could not be written to the stream or - * the written bytes have already exceeded the requested maximum. If the "gzip" - * header is malformed or could not be parsed an exception will be thrown too. - * - * Example usage follows: - * - * <code> - * require_once 'HTTP/Request2.php'; - * require_once 'HTTP/Request2/Observer/UncompressingDownload.php'; - * - * #$inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html'; - * #$inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on'; - * $inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on&zlib=on'; - * #$outPath = "/dev/null"; - * $outPath = "delme"; - * - * $stream = fopen($outPath, 'wb'); - * if (!$stream) { - * throw new Exception('fopen failed'); - * } - * - * $request = new HTTP_Request2( - * $inPath, - * HTTP_Request2::METHOD_GET, - * array( - * 'store_body' => false, - * 'connect_timeout' => 5, - * 'timeout' => 10, - * 'ssl_verify_peer' => true, - * 'ssl_verify_host' => true, - * 'ssl_cafile' => null, - * 'ssl_capath' => '/etc/ssl/certs', - * 'max_redirects' => 10, - * 'follow_redirects' => true, - * 'strict_redirects' => false - * ) - * ); - * - * $observer = new HTTP_Request2_Observer_UncompressingDownload($stream, 9999999); - * $request->attach($observer); - * - * $response = $request->send(); - * - * fclose($stream); - * echo "OK\n"; - * </code> - * - * @category HTTP - * @package HTTP_Request2 - * @author Delian Krustev <krustev@krustev.net> - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - */ -class HTTP_Request2_Observer_UncompressingDownload implements SplObserver -{ - /** - * The stream to write response body to - * @var resource - */ - private $_stream; - - /** - * zlib.inflate filter possibly added to stream - * @var resource - */ - private $_streamFilter; - - /** - * The value of response's Content-Encoding header - * @var string - */ - private $_encoding; - - /** - * Whether the observer is still waiting for gzip/deflate header - * @var bool - */ - private $_processingHeader = true; - - /** - * Starting position in the stream observer writes to - * @var int - */ - private $_startPosition = 0; - - /** - * Maximum bytes to write - * @var int|null - */ - private $_maxDownloadSize; - - /** - * Whether response being received is a redirect - * @var bool - */ - private $_redirect = false; - - /** - * Accumulated body chunks that may contain (gzip) header - * @var string - */ - private $_possibleHeader = ''; - - /** - * Class constructor - * - * Note that there might be problems with max_bytes and files bigger - * than 2 GB on 32bit platforms - * - * @param resource $stream a stream (or file descriptor) opened for writing. - * @param int $maxDownloadSize maximum bytes to write - */ - public function __construct($stream, $maxDownloadSize = null) - { - $this->_stream = $stream; - if ($maxDownloadSize) { - $this->_maxDownloadSize = $maxDownloadSize; - $this->_startPosition = ftell($this->_stream); - } - } - - /** - * Called when the request notifies us of an event. - * - * @param SplSubject $request The HTTP_Request2 instance - * - * @return void - * @throws HTTP_Request2_MessageException - */ - public function update(SplSubject $request) - { - /* @var $request HTTP_Request2 */ - $event = $request->getLastEvent(); - $encoded = false; - - /* @var $event'data' HTTP_Request2_Response */ - switch ($event'name') { - case 'receivedHeaders': - $this->_processingHeader = true; - $this->_redirect = $event'data'->isRedirect(); - $this->_encoding = strtolower($event'data'->getHeader('content-encoding')); - $this->_possibleHeader = ''; - break; - - case 'receivedEncodedBodyPart': - if (!$this->_streamFilter - && ($this->_encoding === 'deflate' || $this->_encoding === 'gzip') - ) { - $this->_streamFilter = stream_filter_append( - $this->_stream, 'zlib.inflate', STREAM_FILTER_WRITE - ); - } - $encoded = true; - // fall-through is intentional - - case 'receivedBodyPart': - if ($this->_redirect) { - break; - } - - if (!$encoded || !$this->_processingHeader) { - $bytes = fwrite($this->_stream, $event'data'); - - } else { - $offset = 0; - $this->_possibleHeader .= $event'data'; - if ('deflate' === $this->_encoding) { - if (2 > strlen($this->_possibleHeader)) { - break; - } - $header = unpack('n', substr($this->_possibleHeader, 0, 2)); - if (0 == $header1 % 31) { - $offset = 2; - } - - } elseif ('gzip' === $this->_encoding) { - if (10 > strlen($this->_possibleHeader)) { - break; - } - try { - $offset = HTTP_Request2_Response::parseGzipHeader($this->_possibleHeader, false); - - } catch (HTTP_Request2_MessageException $e) { - // need more data? - if (false !== strpos($e->getMessage(), 'data too short')) { - break; - } - throw $e; - } - } - - $this->_processingHeader = false; - $bytes = fwrite($this->_stream, substr($this->_possibleHeader, $offset)); - } - - if (false === $bytes) { - throw new HTTP_Request2_MessageException('fwrite failed.'); - } - - if ($this->_maxDownloadSize - && ftell($this->_stream) - $this->_startPosition > $this->_maxDownloadSize - ) { - throw new HTTP_Request2_MessageException(sprintf( - 'Body length limit (%d bytes) reached', - $this->_maxDownloadSize - )); - } - break; - - case 'receivedBody': - if ($this->_streamFilter) { - stream_filter_remove($this->_streamFilter); - $this->_streamFilter = null; - } - break; - } - } -}
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/Response.php
Deleted
@@ -1,680 +0,0 @@ -<?php -/** - * Class representing a HTTP response - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** - * Exception class for HTTP_Request2 package - */ -require_once 'HTTP/Request2/Exception.php'; - -/** - * Class representing a HTTP response - * - * The class is designed to be used in "streaming" scenario, building the - * response as it is being received: - * <code> - * $statusLine = read_status_line(); - * $response = new HTTP_Request2_Response($statusLine); - * do { - * $headerLine = read_header_line(); - * $response->parseHeaderLine($headerLine); - * } while ($headerLine != ''); - * - * while ($chunk = read_body()) { - * $response->appendBody($chunk); - * } - * - * var_dump($response->getHeader(), $response->getCookies(), $response->getBody()); - * </code> - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - * @link http://tools.ietf.org/html/rfc2616#section-6 - */ -class HTTP_Request2_Response -{ - /** - * HTTP protocol version (e.g. 1.0, 1.1) - * @var string - */ - protected $version; - - /** - * Status code - * @var integer - * @link http://tools.ietf.org/html/rfc2616#section-6.1.1 - */ - protected $code; - - /** - * Reason phrase - * @var string - * @link http://tools.ietf.org/html/rfc2616#section-6.1.1 - */ - protected $reasonPhrase; - - /** - * Effective URL (may be different from original request URL in case of redirects) - * @var string - */ - protected $effectiveUrl; - - /** - * Associative array of response headers - * @var array - */ - protected $headers = array(); - - /** - * Cookies set in the response - * @var array - */ - protected $cookies = array(); - - /** - * Name of last header processed by parseHederLine() - * - * Used to handle the headers that span multiple lines - * - * @var string - */ - protected $lastHeader = null; - - /** - * Response body - * @var string - */ - protected $body = ''; - - /** - * Whether the body is still encoded by Content-Encoding - * - * cURL provides the decoded body to the callback; if we are reading from - * socket the body is still gzipped / deflated - * - * @var bool - */ - protected $bodyEncoded; - - /** - * Associative array of HTTP status code / reason phrase. - * - * @var array - * @link http://tools.ietf.org/html/rfc2616#section-10 - */ - protected static $phrases = array( - - // 1xx: Informational - Request received, continuing process - 100 => 'Continue', - 101 => 'Switching Protocols', - - // 2xx: Success - The action was successfully received, understood and - // accepted - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - - // 3xx: Redirection - Further action must be taken in order to complete - // the request - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', // 1.1 - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 307 => 'Temporary Redirect', - - // 4xx: Client Error - The request contains bad syntax or cannot be - // fulfilled - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - - // 5xx: Server Error - The server failed to fulfill an apparently - // valid request - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported', - 509 => 'Bandwidth Limit Exceeded', - - ); - - /** - * Returns the default reason phrase for the given code or all reason phrases - * - * @param int $code Response code - * - * @return string|array|null Default reason phrase for $code if $code is given - * (null if no phrase is available), array of all - * reason phrases if $code is null - * @link http://pear.php.net/bugs/18716 - */ - public static function getDefaultReasonPhrase($code = null) - { - if (null === $code) { - return self::$phrases; - } else { - return isset(self::$phrases$code) ? self::$phrases$code : null; - } - } - - /** - * Constructor, parses the response status line - * - * @param string $statusLine Response status line (e.g. "HTTP/1.1 200 OK") - * @param bool $bodyEncoded Whether body is still encoded by Content-Encoding - * @param string $effectiveUrl Effective URL of the response - * - * @throws HTTP_Request2_MessageException if status line is invalid according to spec - */ - public function __construct($statusLine, $bodyEncoded = true, $effectiveUrl = null) - { - if (!preg_match('!^HTTP/(\d\.\d) (\d{3})(?: (.+))?!', $statusLine, $m)) { - throw new HTTP_Request2_MessageException( - "Malformed response: {$statusLine}", - HTTP_Request2_Exception::MALFORMED_RESPONSE - ); - } - $this->version = $m1; - $this->code = intval($m2); - $this->reasonPhrase = !empty($m3) ? trim($m3) : self::getDefaultReasonPhrase($this->code); - $this->bodyEncoded = (bool)$bodyEncoded; - $this->effectiveUrl = (string)$effectiveUrl; - } - - /** - * Parses the line from HTTP response filling $headers array - * - * The method should be called after reading the line from socket or receiving - * it into cURL callback. Passing an empty string here indicates the end of - * response headers and triggers additional processing, so be sure to pass an - * empty string in the end. - * - * @param string $headerLine Line from HTTP response - */ - public function parseHeaderLine($headerLine) - { - $headerLine = trim($headerLine, "\r\n"); - - if ('' == $headerLine) { - // empty string signals the end of headers, process the received ones - if (!empty($this->headers'set-cookie')) { - $cookies = is_array($this->headers'set-cookie')? - $this->headers'set-cookie': - array($this->headers'set-cookie'); - foreach ($cookies as $cookieString) { - $this->parseCookie($cookieString); - } - unset($this->headers'set-cookie'); - } - foreach (array_keys($this->headers) as $k) { - if (is_array($this->headers$k)) { - $this->headers$k = implode(', ', $this->headers$k); - } - } - - } elseif (preg_match('!^(^\x00-\x1f\x7f-\xff()<>@,;:\\\\"/\\?={}\s+):(.+)$!', $headerLine, $m)) { - // string of the form header-name: header value - $name = strtolower($m1); - $value = trim($m2); - if (empty($this->headers$name)) { - $this->headers$name = $value; - } else { - if (!is_array($this->headers$name)) { - $this->headers$name = array($this->headers$name); - } - $this->headers$name = $value; - } - $this->lastHeader = $name; - - } elseif (preg_match('!^\s+(.+)$!', $headerLine, $m) && $this->lastHeader) { - // continuation of a previous header - if (!is_array($this->headers$this->lastHeader)) { - $this->headers$this->lastHeader .= ' ' . trim($m1); - } else { - $key = count($this->headers$this->lastHeader) - 1; - $this->headers$this->lastHeader$key .= ' ' . trim($m1); - } - } - } - - /** - * Parses a Set-Cookie header to fill $cookies array - * - * @param string $cookieString value of Set-Cookie header - * - * @link http://web.archive.org/web/20080331104521/http://cgi.netscape.com/newsref/std/cookie_spec.html - */ - protected function parseCookie($cookieString) - { - $cookie = array( - 'expires' => null, - 'domain' => null, - 'path' => null, - 'secure' => false - ); - - if (!strpos($cookieString, ';')) { - // Only a name=value pair - $pos = strpos($cookieString, '='); - $cookie'name' = trim(substr($cookieString, 0, $pos)); - $cookie'value' = trim(substr($cookieString, $pos + 1)); - - } else { - // Some optional parameters are supplied - $elements = explode(';', $cookieString); - $pos = strpos($elements0, '='); - $cookie'name' = trim(substr($elements0, 0, $pos)); - $cookie'value' = trim(substr($elements0, $pos + 1)); - - for ($i = 1; $i < count($elements); $i++) { - if (false === strpos($elements$i, '=')) { - $elName = trim($elements$i); - $elValue = null; - } else { - list ($elName, $elValue) = array_map('trim', explode('=', $elements$i)); - } - $elName = strtolower($elName); - if ('secure' == $elName) { - $cookie'secure' = true; - } elseif ('expires' == $elName) { - $cookie'expires' = str_replace('"', '', $elValue); - } elseif ('path' == $elName || 'domain' == $elName) { - $cookie$elName = urldecode($elValue); - } else { - $cookie$elName = $elValue; - } - } - } - $this->cookies = $cookie; - } - - /** - * Appends a string to the response body - * - * @param string $bodyChunk part of response body - */ - public function appendBody($bodyChunk) - { - $this->body .= $bodyChunk; - } - - /** - * Returns the effective URL of the response - * - * This may be different from the request URL if redirects were followed. - * - * @return string - * @link http://pear.php.net/bugs/bug.php?id=18412 - */ - public function getEffectiveUrl() - { - return $this->effectiveUrl; - } - - /** - * Returns the status code - * - * @return integer - */ - public function getStatus() - { - return $this->code; - } - - /** - * Returns the reason phrase - * - * @return string - */ - public function getReasonPhrase() - { - return $this->reasonPhrase; - } - - /** - * Whether response is a redirect that can be automatically handled by HTTP_Request2 - * - * @return bool - */ - public function isRedirect() - { - return in_array($this->code, array(300, 301, 302, 303, 307)) - && isset($this->headers'location'); - } - - /** - * Returns either the named header or all response headers - * - * @param string $headerName Name of header to return - * - * @return string|array Value of $headerName header (null if header is - * not present), array of all response headers if - * $headerName is null - */ - public function getHeader($headerName = null) - { - if (null === $headerName) { - return $this->headers; - } else { - $headerName = strtolower($headerName); - return isset($this->headers$headerName)? $this->headers$headerName: null; - } - } - - /** - * Returns cookies set in response - * - * @return array - */ - public function getCookies() - { - return $this->cookies; - } - - /** - * Returns the body of the response - * - * @return string - * @throws HTTP_Request2_Exception if body cannot be decoded - */ - public function getBody() - { - if (0 == strlen($this->body) || !$this->bodyEncoded - || !in_array(strtolower($this->getHeader('content-encoding')), array('gzip', 'deflate')) - ) { - return $this->body; - - } else { - if (extension_loaded('mbstring') && (2 & ini_get('mbstring.func_overload'))) { - $oldEncoding = mb_internal_encoding(); - mb_internal_encoding('8bit'); - } - - try { - switch (strtolower($this->getHeader('content-encoding'))) { - case 'gzip': - $decoded = self::decodeGzip($this->body); - break; - case 'deflate': - $decoded = self::decodeDeflate($this->body); - } - } catch (Exception $e) { - } - - if (!empty($oldEncoding)) { - mb_internal_encoding($oldEncoding); - } - if (!empty($e)) { - throw $e; - } - return $decoded; - } - } - - /** - * Get the HTTP version of the response - * - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Checks whether data starts with GZIP format identification bytes from RFC 1952 - * - * @param string $data gzip-encoded (presumably) data - * - * @return bool - */ - public static function hasGzipIdentification($data) - { - return 0 === strcmp(substr($data, 0, 2), "\x1f\x8b"); - } - - /** - * Tries to parse GZIP format header in the given string - * - * If the header conforms to RFC 1952, its length is returned. If any - * sanity check fails, HTTP_Request2_MessageException is thrown. - * - * Note: This function might be usable outside of HTTP_Request2 so it might - * be good idea to be moved to some common package. (Delian Krustev) - * - * @param string $data Either the complete response body or - * the leading part of it - * @param boolean $dataComplete Whether $data contains complete response body - * - * @return int gzip header length in bytes - * @throws HTTP_Request2_MessageException - * @link http://tools.ietf.org/html/rfc1952 - */ - public static function parseGzipHeader($data, $dataComplete = false) - { - // if data is complete, trailing 8 bytes should be present for size and crc32 - $length = strlen($data) - ($dataComplete ? 8 : 0); - - if ($length < 10 || !self::hasGzipIdentification($data)) { - throw new HTTP_Request2_MessageException( - 'The data does not seem to contain a valid gzip header', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - - $method = ord(substr($data, 2, 1)); - if (8 != $method) { - throw new HTTP_Request2_MessageException( - 'Error parsing gzip header: unknown compression method', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - $flags = ord(substr($data, 3, 1)); - if ($flags & 224) { - throw new HTTP_Request2_MessageException( - 'Error parsing gzip header: reserved bits are set', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - - // header is 10 bytes minimum. may be longer, though. - $headerLength = 10; - // extra fields, need to skip 'em - if ($flags & 4) { - if ($length - $headerLength - 2 < 0) { - throw new HTTP_Request2_MessageException( - 'Error parsing gzip header: data too short', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - $extraLength = unpack('v', substr($data, 10, 2)); - if ($length - $headerLength - 2 - $extraLength1 < 0) { - throw new HTTP_Request2_MessageException( - 'Error parsing gzip header: data too short', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - $headerLength += $extraLength1 + 2; - } - // file name, need to skip that - if ($flags & 8) { - if ($length - $headerLength - 1 < 0) { - throw new HTTP_Request2_MessageException( - 'Error parsing gzip header: data too short', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - $filenameLength = strpos(substr($data, $headerLength), chr(0)); - if (false === $filenameLength - || $length - $headerLength - $filenameLength - 1 < 0 - ) { - throw new HTTP_Request2_MessageException( - 'Error parsing gzip header: data too short', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - $headerLength += $filenameLength + 1; - } - // comment, need to skip that also - if ($flags & 16) { - if ($length - $headerLength - 1 < 0) { - throw new HTTP_Request2_MessageException( - 'Error parsing gzip header: data too short', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - $commentLength = strpos(substr($data, $headerLength), chr(0)); - if (false === $commentLength - || $length - $headerLength - $commentLength - 1 < 0 - ) { - throw new HTTP_Request2_MessageException( - 'Error parsing gzip header: data too short', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - $headerLength += $commentLength + 1; - } - // have a CRC for header. let's check - if ($flags & 2) { - if ($length - $headerLength - 2 < 0) { - throw new HTTP_Request2_MessageException( - 'Error parsing gzip header: data too short', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - $crcReal = 0xffff & crc32(substr($data, 0, $headerLength)); - $crcStored = unpack('v', substr($data, $headerLength, 2)); - if ($crcReal != $crcStored1) { - throw new HTTP_Request2_MessageException( - 'Header CRC check failed', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - $headerLength += 2; - } - return $headerLength; - } - - /** - * Decodes the message-body encoded by gzip - * - * The real decoding work is done by gzinflate() built-in function, this - * method only parses the header and checks data for compliance with - * RFC 1952 - * - * @param string $data gzip-encoded data - * - * @return string decoded data - * @throws HTTP_Request2_LogicException - * @throws HTTP_Request2_MessageException - * @link http://tools.ietf.org/html/rfc1952 - */ - public static function decodeGzip($data) - { - // If it doesn't look like gzip-encoded data, don't bother - if (!self::hasGzipIdentification($data)) { - return $data; - } - if (!function_exists('gzinflate')) { - throw new HTTP_Request2_LogicException( - 'Unable to decode body: gzip extension not available', - HTTP_Request2_Exception::MISCONFIGURATION - ); - } - - // unpacked data CRC and size at the end of encoded data - $tmp = unpack('V2', substr($data, -8)); - $dataCrc = $tmp1; - $dataSize = $tmp2; - - $headerLength = self::parseGzipHeader($data, true); - - // don't pass $dataSize to gzinflate, see bugs #13135, #14370 - $unpacked = gzinflate(substr($data, $headerLength, -8)); - if (false === $unpacked) { - throw new HTTP_Request2_MessageException( - 'gzinflate() call failed', - HTTP_Request2_Exception::DECODE_ERROR - ); - } elseif ($dataSize != strlen($unpacked)) { - throw new HTTP_Request2_MessageException( - 'Data size check failed', - HTTP_Request2_Exception::DECODE_ERROR - ); - } elseif ((0xffffffff & $dataCrc) != (0xffffffff & crc32($unpacked))) { - throw new HTTP_Request2_MessageException( - 'Data CRC check failed', - HTTP_Request2_Exception::DECODE_ERROR - ); - } - return $unpacked; - } - - /** - * Decodes the message-body encoded by deflate - * - * @param string $data deflate-encoded data - * - * @return string decoded data - * @throws HTTP_Request2_LogicException - */ - public static function decodeDeflate($data) - { - if (!function_exists('gzuncompress')) { - throw new HTTP_Request2_LogicException( - 'Unable to decode body: gzip extension not available', - HTTP_Request2_Exception::MISCONFIGURATION - ); - } - // RFC 2616 defines 'deflate' encoding as zlib format from RFC 1950, - // while many applications send raw deflate stream from RFC 1951. - // We should check for presence of zlib header and use gzuncompress() or - // gzinflate() as needed. See bug #15305 - $header = unpack('n', substr($data, 0, 2)); - return (0 == $header1 % 31)? gzuncompress($data): gzinflate($data); - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/SOCKS5.php
Deleted
@@ -1,135 +0,0 @@ -<?php -/** - * SOCKS5 proxy connection class - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Socket wrapper class used by Socket Adapter */ -require_once 'HTTP/Request2/SocketWrapper.php'; - -/** - * SOCKS5 proxy connection class (used by Socket Adapter) - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - * @link http://pear.php.net/bugs/bug.php?id=19332 - * @link http://tools.ietf.org/html/rfc1928 - */ -class HTTP_Request2_SOCKS5 extends HTTP_Request2_SocketWrapper -{ - /** - * Constructor, tries to connect and authenticate to a SOCKS5 proxy - * - * @param string $address Proxy address, e.g. 'tcp://localhost:1080' - * @param int $timeout Connection timeout (seconds) - * @param array $contextOptions Stream context options - * @param string $username Proxy user name - * @param string $password Proxy password - * - * @throws HTTP_Request2_LogicException - * @throws HTTP_Request2_ConnectionException - * @throws HTTP_Request2_MessageException - */ - public function __construct( - $address, $timeout = 10, array $contextOptions = array(), - $username = null, $password = null - ) { - parent::__construct($address, $timeout, $contextOptions); - - if (strlen($username)) { - $request = pack('C4', 5, 2, 0, 2); - } else { - $request = pack('C3', 5, 1, 0); - } - $this->write($request); - $response = unpack('Cversion/Cmethod', $this->read(3)); - if (5 != $response'version') { - throw new HTTP_Request2_MessageException( - 'Invalid version received from SOCKS5 proxy: ' . $response'version', - HTTP_Request2_Exception::MALFORMED_RESPONSE - ); - } - switch ($response'method') { - case 2: - $this->performAuthentication($username, $password); - case 0: - break; - default: - throw new HTTP_Request2_ConnectionException( - "Connection rejected by proxy due to unsupported auth method" - ); - } - } - - /** - * Performs username/password authentication for SOCKS5 - * - * @param string $username Proxy user name - * @param string $password Proxy password - * - * @throws HTTP_Request2_ConnectionException - * @throws HTTP_Request2_MessageException - * @link http://tools.ietf.org/html/rfc1929 - */ - protected function performAuthentication($username, $password) - { - $request = pack('C2', 1, strlen($username)) . $username - . pack('C', strlen($password)) . $password; - - $this->write($request); - $response = unpack('Cvn/Cstatus', $this->read(3)); - if (1 != $response'vn' || 0 != $response'status') { - throw new HTTP_Request2_ConnectionException( - 'Connection rejected by proxy due to invalid username and/or password' - ); - } - } - - /** - * Connects to a remote host via proxy - * - * @param string $remoteHost Remote host - * @param int $remotePort Remote port - * - * @throws HTTP_Request2_ConnectionException - * @throws HTTP_Request2_MessageException - */ - public function connect($remoteHost, $remotePort) - { - $request = pack('C5', 0x05, 0x01, 0x00, 0x03, strlen($remoteHost)) - . $remoteHost . pack('n', $remotePort); - - $this->write($request); - $response = unpack('Cversion/Creply/Creserved', $this->read(1024)); - if (5 != $response'version' || 0 != $response'reserved') { - throw new HTTP_Request2_MessageException( - 'Invalid response received from SOCKS5 proxy', - HTTP_Request2_Exception::MALFORMED_RESPONSE - ); - } elseif (0 != $response'reply') { - throw new HTTP_Request2_ConnectionException( - "Unable to connect to {$remoteHost}:{$remotePort} through SOCKS5 proxy", - 0, $response'reply' - ); - } - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/HTTP/Request2/SocketWrapper.php
Deleted
@@ -1,320 +0,0 @@ -<?php -/** - * Socket wrapper class used by Socket Adapter - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Exception classes for HTTP_Request2 package */ -require_once 'HTTP/Request2/Exception.php'; - -/** - * Socket wrapper class used by Socket Adapter - * - * Needed to properly handle connection errors, global timeout support and - * similar things. Loosely based on Net_Socket used by older HTTP_Request. - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @version Release: 2.3.0 - * @link http://pear.php.net/package/HTTP_Request2 - * @link http://pear.php.net/bugs/bug.php?id=19332 - * @link http://tools.ietf.org/html/rfc1928 - */ -class HTTP_Request2_SocketWrapper -{ - /** - * PHP warning messages raised during stream_socket_client() call - * @var array - */ - protected $connectionWarnings = array(); - - /** - * Connected socket - * @var resource - */ - protected $socket; - - /** - * Sum of start time and global timeout, exception will be thrown if request continues past this time - * @var integer - */ - protected $deadline; - - /** - * Global timeout value, mostly for exception messages - * @var integer - */ - protected $timeout; - - /** - * Class constructor, tries to establish connection - * - * @param string $address Address for stream_socket_client() call, - * e.g. 'tcp://localhost:80' - * @param int $timeout Connection timeout (seconds) - * @param array $contextOptions Context options - * - * @throws HTTP_Request2_LogicException - * @throws HTTP_Request2_ConnectionException - */ - public function __construct($address, $timeout, array $contextOptions = array()) - { - if (!empty($contextOptions) - && !isset($contextOptions'socket') && !isset($contextOptions'ssl') - ) { - // Backwards compatibility with 2.1.0 and 2.1.1 releases - $contextOptions = array('ssl' => $contextOptions); - } - if (isset($contextOptions'ssl')) { - $contextOptions'ssl' += array( - // Using "Intermediate compatibility" cipher bundle from - // https://wiki.mozilla.org/Security/Server_Side_TLS - 'ciphers' => 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:' - . 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:' - . 'DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:' - . 'ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:' - . 'ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:' - . 'ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:' - . 'ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:' - . 'DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:' - . 'DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:' - . 'ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:' - . 'AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:' - . 'AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:' - . '!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA' - ); - if (version_compare(phpversion(), '5.4.13', '>=')) { - $contextOptions'ssl''disable_compression' = true; - if (version_compare(phpversion(), '5.6', '>=')) { - $contextOptions'ssl''crypto_method' = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT - | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; - } - } - } - $context = stream_context_create(); - foreach ($contextOptions as $wrapper => $options) { - foreach ($options as $name => $value) { - if (!stream_context_set_option($context, $wrapper, $name, $value)) { - throw new HTTP_Request2_LogicException( - "Error setting '{$wrapper}' wrapper context option '{$name}'" - ); - } - } - } - set_error_handler(array($this, 'connectionWarningsHandler')); - $this->socket = stream_socket_client( - $address, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $context - ); - restore_error_handler(); - // if we fail to bind to a specified local address (see request #19515), - // connection still succeeds, albeit with a warning. Throw an Exception - // with the warning text in this case as that connection is unlikely - // to be what user wants and as Curl throws an error in similar case. - if ($this->connectionWarnings) { - if ($this->socket) { - fclose($this->socket); - } - $error = $errstr ? $errstr : implode("\n", $this->connectionWarnings); - throw new HTTP_Request2_ConnectionException( - "Unable to connect to {$address}. Error: {$error}", 0, $errno - ); - } - } - - /** - * Destructor, disconnects socket - */ - public function __destruct() - { - fclose($this->socket); - } - - /** - * Wrapper around fread(), handles global request timeout - * - * @param int $length Reads up to this number of bytes - * - * @return string Data read from socket - * @throws HTTP_Request2_MessageException In case of timeout - */ - public function read($length) - { - if ($this->deadline) { - stream_set_timeout($this->socket, max($this->deadline - time(), 1)); - } - $data = fread($this->socket, $length); - $this->checkTimeout(); - return $data; - } - - /** - * Reads until either the end of the socket or a newline, whichever comes first - * - * Strips the trailing newline from the returned data, handles global - * request timeout. Method idea borrowed from Net_Socket PEAR package. - * - * @param int $bufferSize buffer size to use for reading - * @param int $localTimeout timeout value to use just for this call - * (used when waiting for "100 Continue" response) - * - * @return string Available data up to the newline (not including newline) - * @throws HTTP_Request2_MessageException In case of timeout - */ - public function readLine($bufferSize, $localTimeout = null) - { - $line = ''; - while (!feof($this->socket)) { - if (null !== $localTimeout) { - stream_set_timeout($this->socket, $localTimeout); - } elseif ($this->deadline) { - stream_set_timeout($this->socket, max($this->deadline - time(), 1)); - } - - $line .= @fgets($this->socket, $bufferSize); - - if (null === $localTimeout) { - $this->checkTimeout(); - - } else { - $info = stream_get_meta_data($this->socket); - // reset socket timeout if we don't have request timeout specified, - // prevents further calls failing with a bogus Exception - if (!$this->deadline) { - $default = (int)@ini_get('default_socket_timeout'); - stream_set_timeout($this->socket, $default > 0 ? $default : PHP_INT_MAX); - } - if ($info'timed_out') { - throw new HTTP_Request2_MessageException( - "readLine() call timed out", HTTP_Request2_Exception::TIMEOUT - ); - } - } - if (substr($line, -1) == "\n") { - return rtrim($line, "\r\n"); - } - } - return $line; - } - - /** - * Wrapper around fwrite(), handles global request timeout - * - * @param string $data String to be written - * - * @return int - * @throws HTTP_Request2_MessageException - */ - public function write($data) - { - if ($this->deadline) { - stream_set_timeout($this->socket, max($this->deadline - time(), 1)); - } - $written = fwrite($this->socket, $data); - $this->checkTimeout(); - // http://www.php.net/manual/en/function.fwrite.php#96951 - if ($written < strlen($data)) { - throw new HTTP_Request2_MessageException('Error writing request'); - } - return $written; - } - - /** - * Tests for end-of-file on a socket - * - * @return bool - */ - public function eof() - { - return feof($this->socket); - } - - /** - * Sets request deadline - * - * @param int $deadline Exception will be thrown if request continues - * past this time - * @param int $timeout Original request timeout value, to use in - * Exception message - */ - public function setDeadline($deadline, $timeout) - { - $this->deadline = $deadline; - $this->timeout = $timeout; - } - - /** - * Turns on encryption on a socket - * - * @throws HTTP_Request2_ConnectionException - */ - public function enableCrypto() - { - if (version_compare(phpversion(), '5.6', '<')) { - $cryptoMethod = STREAM_CRYPTO_METHOD_TLS_CLIENT; - } else { - $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT - | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; - } - - if (!stream_socket_enable_crypto($this->socket, true, $cryptoMethod)) { - throw new HTTP_Request2_ConnectionException( - 'Failed to enable secure connection when connecting through proxy' - ); - } - } - - /** - * Throws an Exception if stream timed out - * - * @throws HTTP_Request2_MessageException - */ - protected function checkTimeout() - { - $info = stream_get_meta_data($this->socket); - if ($info'timed_out' || $this->deadline && time() > $this->deadline) { - $reason = $this->deadline - ? "after {$this->timeout} second(s)" - : 'due to default_socket_timeout php.ini setting'; - throw new HTTP_Request2_MessageException( - "Request timed out {$reason}", HTTP_Request2_Exception::TIMEOUT - ); - } - } - - /** - * Error handler to use during stream_socket_client() call - * - * One stream_socket_client() call may produce *multiple* PHP warnings - * (especially OpenSSL-related), we keep them in an array to later use for - * the message of HTTP_Request2_ConnectionException - * - * @param int $errno error level - * @param string $errstr error message - * - * @return bool - */ - protected function connectionWarningsHandler($errno, $errstr) - { - if ($errno & E_WARNING) { - array_unshift($this->connectionWarnings, $errstr); - } - return true; - } -} -?>
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/data/generate-list.php
Deleted
@@ -1,103 +0,0 @@ -<?php -/** - * Helper file for downloading Public Suffix List and converting it to PHP array - * - * You can run this script to update PSL to the current version instead of - * waiting for a new release of HTTP_Request2. - * - * NB: peer validation is DISABLED when downloading. If you want to enable it, - * change ssl_verify_peer to true and provide CA file (see below) - */ - -/** URL to download Public Suffix List from */ -define('LIST_URL', 'https://publicsuffix.org/list/public_suffix_list.dat'); -/** Name of PHP file to write */ -define('OUTPUT_FILE', dirname(__FILE__) . '/public-suffix-list.php'); - -require_once 'HTTP/Request2.php'; - -function buildSubdomain(&$node, $tldParts) -{ - $part = trim(array_pop($tldParts)); - - if (!array_key_exists($part, $node)) { - $node$part = array(); - } - - if (0 < count($tldParts)) { - buildSubdomain($node$part, $tldParts); - } -} - -function writeNode($fp, $valueTree, $key = null, $indent = 0) -{ - if (is_null($key)) { - fwrite($fp, "return "); - - } else { - fwrite($fp, str_repeat(' ', $indent) . "'$key' => "); - } - - if (0 == ($count = count($valueTree))) { - fwrite($fp, 'true'); - } else { - fwrite($fp, "array(\n"); - for ($keys = array_keys($valueTree), $i = 0; $i < $count; $i++) { - writeNode($fp, $valueTree$keys$i, $keys$i, $indent + 1); - if ($i + 1 != $count) { - fwrite($fp, ",\n"); - } else { - fwrite($fp, "\n"); - } - } - fwrite($fp, str_repeat(' ', $indent) . ")"); - } -} - - -try { - $request = new HTTP_Request2(LIST_URL, HTTP_Request2::METHOD_GET, array( - // Provide path to your CA file and change 'ssl_verify_peer' to true to enable peer validation - // 'ssl_cafile' => '... path to your Certificate Authority file ...', - 'ssl_verify_peer' => false - )); - $response = $request->send(); - if (200 != $response->getStatus()) { - throw new Exception("List download URL returned status: " . - $response->getStatus() . ' ' . $response->getReasonPhrase()); - } - $list = $response->getBody(); - if (false === strpos($list, '// ===BEGIN ICANN DOMAINS===')) { - throw new Exception("List download URL does not contain expected phrase"); - } - if (!($fp = @fopen(OUTPUT_FILE, 'wt'))) { - throw new Exception("Unable to open " . OUTPUT_FILE); - } - -} catch (Exception $e) { - die($e->getMessage()); -} - -$tldTree = array(); -$license = true; - -fwrite($fp, "<?php\n"); - -foreach (array_filter(array_map('trim', explode("\n", $list))) as $line) { - if ('//' != substr($line, 0, 2)) { - buildSubdomain($tldTree, explode('.', $line)); - - } elseif ($license) { - if (0 === strpos($line, "// ===BEGIN ICANN DOMAINS===")) { - fwrite($fp, "\n"); - $license = false; - } else { - fwrite($fp, $line . "\n"); - } - } -} - -writeNode($fp, $tldTree); -fwrite($fp, ";\n?>"); -fclose($fp); -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/data/public-suffix-list.php
Deleted
@@ -1,8333 +0,0 @@ -<?php -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -return array( - 'ac' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'net' => true, - 'mil' => true, - 'org' => true - ), - 'ad' => array( - 'nom' => true - ), - 'ae' => array( - 'co' => true, - 'net' => true, - 'org' => true, - 'sch' => true, - 'ac' => true, - 'gov' => true, - 'mil' => true, - 'blogspot' => true - ), - 'aero' => array( - 'accident-investigation' => true, - 'accident-prevention' => true, - 'aerobatic' => true, - 'aeroclub' => true, - 'aerodrome' => true, - 'agents' => true, - 'aircraft' => true, - 'airline' => true, - 'airport' => true, - 'air-surveillance' => true, - 'airtraffic' => true, - 'air-traffic-control' => true, - 'ambulance' => true, - 'amusement' => true, - 'association' => true, - 'author' => true, - 'ballooning' => true, - 'broker' => true, - 'caa' => true, - 'cargo' => true, - 'catering' => true, - 'certification' => true, - 'championship' => true, - 'charter' => true, - 'civilaviation' => true, - 'club' => true, - 'conference' => true, - 'consultant' => true, - 'consulting' => true, - 'control' => true, - 'council' => true, - 'crew' => true, - 'design' => true, - 'dgca' => true, - 'educator' => true, - 'emergency' => true, - 'engine' => true, - 'engineer' => true, - 'entertainment' => true, - 'equipment' => true, - 'exchange' => true, - 'express' => true, - 'federation' => true, - 'flight' => true, - 'freight' => true, - 'fuel' => true, - 'gliding' => true, - 'government' => true, - 'groundhandling' => true, - 'group' => true, - 'hanggliding' => true, - 'homebuilt' => true, - 'insurance' => true, - 'journal' => true, - 'journalist' => true, - 'leasing' => true, - 'logistics' => true, - 'magazine' => true, - 'maintenance' => true, - 'media' => true, - 'microlight' => true, - 'modelling' => true, - 'navigation' => true, - 'parachuting' => true, - 'paragliding' => true, - 'passenger-association' => true, - 'pilot' => true, - 'press' => true, - 'production' => true, - 'recreation' => true, - 'repbody' => true, - 'res' => true, - 'research' => true, - 'rotorcraft' => true, - 'safety' => true, - 'scientist' => true, - 'services' => true, - 'show' => true, - 'skydiving' => true, - 'software' => true, - 'student' => true, - 'trader' => true, - 'trading' => true, - 'trainer' => true, - 'union' => true, - 'workinggroup' => true, - 'works' => true - ), - 'af' => array( - 'gov' => true, - 'com' => true, - 'org' => true, - 'net' => true, - 'edu' => true - ), - 'ag' => array( - 'com' => true, - 'org' => true, - 'net' => true, - 'co' => true, - 'nom' => true - ), - 'ai' => array( - 'off' => true, - 'com' => true, - 'net' => true, - 'org' => true - ), - 'al' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'mil' => true, - 'net' => true, - 'org' => true, - 'blogspot' => true - ), - 'am' => array( - 'blogspot' => true - ), - 'ao' => array( - 'ed' => true, - 'gv' => true, - 'og' => true, - 'co' => true, - 'pb' => true, - 'it' => true - ), - 'aq' => true, - 'ar' => array( - 'com' => array( - 'blogspot' => true - ), - 'edu' => true, - 'gob' => true, - 'gov' => true, - 'int' => true, - 'mil' => true, - 'net' => true, - 'org' => true, - 'tur' => true - ), - 'arpa' => array( - 'e164' => true, - 'in-addr' => true, - 'ip6' => true, - 'iris' => true, - 'uri' => true, - 'urn' => true - ), - 'as' => array( - 'gov' => true - ), - 'asia' => true, - 'at' => array( - 'ac' => true, - 'co' => array( - 'blogspot' => true - ), - 'gv' => true, - 'or' => true, - 'biz' => true, - 'info' => true, - 'priv' => true - ), - 'au' => array( - 'com' => array( - 'blogspot' => true - ), - 'net' => true, - 'org' => true, - 'edu' => array( - 'act' => true, - 'nsw' => true, - 'nt' => true, - 'qld' => true, - 'sa' => true, - 'tas' => true, - 'vic' => true, - 'wa' => true - ), - 'gov' => array( - 'qld' => true, - 'sa' => true, - 'tas' => true, - 'vic' => true, - 'wa' => true - ), - 'asn' => true, - 'id' => true, - 'info' => true, - 'conf' => true, - 'oz' => true, - 'act' => true, - 'nsw' => true, - 'nt' => true, - 'qld' => true, - 'sa' => true, - 'tas' => true, - 'vic' => true, - 'wa' => true - ), - 'aw' => array( - 'com' => true - ), - 'ax' => true, - 'az' => array( - 'com' => true, - 'net' => true, - 'int' => true, - 'gov' => true, - 'org' => true, - 'edu' => true, - 'info' => true, - 'pp' => true, - 'mil' => true, - 'name' => true, - 'pro' => true, - 'biz' => true - ), - 'ba' => array( - 'org' => true, - 'net' => true, - 'edu' => true, - 'gov' => true, - 'mil' => true, - 'unsa' => true, - 'unbi' => true, - 'co' => true, - 'com' => true, - 'rs' => true, - 'blogspot' => true - ), - 'bb' => array( - 'biz' => true, - 'co' => true, - 'com' => true, - 'edu' => true, - 'gov' => true, - 'info' => true, - 'net' => true, - 'org' => true, - 'store' => true, - 'tv' => true - ), - 'bd' => array( - '*' => true - ), - 'be' => array( - 'ac' => true, - 'blogspot' => true - ), - 'bf' => array( - 'gov' => true - ), - 'bg' => array( - 'a' => true, - 'b' => true, - 'c' => true, - 'd' => true, - 'e' => true, - 'f' => true, - 'g' => true, - 'h' => true, - 'i' => true, - 'j' => true, - 'k' => true, - 'l' => true, - 'm' => true, - 'n' => true, - 'o' => true, - 'p' => true, - 'q' => true, - 'r' => true, - 's' => true, - 't' => true, - 'u' => true, - 'v' => true, - 'w' => true, - 'x' => true, - 'y' => true, - 'z' => true, - '0' => true, - '1' => true, - '2' => true, - '3' => true, - '4' => true, - '5' => true, - '6' => true, - '7' => true, - '8' => true, - '9' => true, - 'blogspot' => true - ), - 'bh' => array( - 'com' => true, - 'edu' => true, - 'net' => true, - 'org' => true, - 'gov' => true - ), - 'bi' => array( - 'co' => true, - 'com' => true, - 'edu' => true, - 'or' => true, - 'org' => true - ), - 'biz' => array( - 'dyndns' => true, - 'for-better' => true, - 'for-more' => true, - 'for-some' => true, - 'for-the' => true, - 'selfip' => true, - 'webhop' => true, - 'dscloud' => true - ), - 'bj' => array( - 'asso' => true, - 'barreau' => true, - 'gouv' => true, - 'blogspot' => true - ), - 'bm' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'net' => true, - 'org' => true - ), - 'bn' => array( - '*' => true - ), - 'bo' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'gob' => true, - 'int' => true, - 'org' => true, - 'net' => true, - 'mil' => true, - 'tv' => true - ), - 'br' => array( - 'adm' => true, - 'adv' => true, - 'agr' => true, - 'am' => true, - 'arq' => true, - 'art' => true, - 'ato' => true, - 'b' => true, - 'bio' => true, - 'blog' => true, - 'bmd' => true, - 'cim' => true, - 'cng' => true, - 'cnt' => true, - 'com' => array( - 'blogspot' => true - ), - 'coop' => true, - 'ecn' => true, - 'eco' => true, - 'edu' => true, - 'emp' => true, - 'eng' => true, - 'esp' => true, - 'etc' => true, - 'eti' => true, - 'far' => true, - 'flog' => true, - 'fm' => true, - 'fnd' => true, - 'fot' => true, - 'fst' => true, - 'g12' => true, - 'ggf' => true, - 'gov' => true, - 'imb' => true, - 'ind' => true, - 'inf' => true, - 'jor' => true, - 'jus' => true, - 'leg' => true, - 'lel' => true, - 'mat' => true, - 'med' => true, - 'mil' => true, - 'mp' => true, - 'mus' => true, - 'net' => true, - 'nom' => array( - '*' => true - ), - 'not' => true, - 'ntr' => true, - 'odo' => true, - 'org' => true, - 'ppg' => true, - 'pro' => true, - 'psc' => true, - 'psi' => true, - 'qsl' => true, - 'radio' => true, - 'rec' => true, - 'slg' => true, - 'srv' => true, - 'taxi' => true, - 'teo' => true, - 'tmp' => true, - 'trd' => true, - 'tur' => true, - 'tv' => true, - 'vet' => true, - 'vlog' => true, - 'wiki' => true, - 'zlg' => true - ), - 'bs' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'edu' => true, - 'gov' => true - ), - 'bt' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'net' => true, - 'org' => true - ), - 'bv' => true, - 'bw' => array( - 'co' => true, - 'org' => true - ), - 'by' => array( - 'gov' => true, - 'mil' => true, - 'com' => array( - 'blogspot' => true - ), - 'of' => true - ), - 'bz' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'edu' => true, - 'gov' => true, - 'za' => true - ), - 'ca' => array( - 'ab' => true, - 'bc' => true, - 'mb' => true, - 'nb' => true, - 'nf' => true, - 'nl' => true, - 'ns' => true, - 'nt' => true, - 'nu' => true, - 'on' => true, - 'pe' => true, - 'qc' => true, - 'sk' => true, - 'yk' => true, - 'gc' => true, - 'co' => true, - 'blogspot' => true - ), - 'cat' => true, - 'cc' => array( - 'ftpaccess' => true, - 'game-server' => true, - 'myphotos' => true, - 'scrapping' => true - ), - 'cd' => array( - 'gov' => true - ), - 'cf' => array( - 'blogspot' => true - ), - 'cg' => true, - 'ch' => array( - 'blogspot' => true - ), - 'ci' => array( - 'org' => true, - 'or' => true, - 'com' => true, - 'co' => true, - 'edu' => true, - 'ed' => true, - 'ac' => true, - 'net' => true, - 'go' => true, - 'asso' => true, - 'aéroport' => true, - 'int' => true, - 'presse' => true, - 'md' => true, - 'gouv' => true - ), - 'ck' => array( - '*' => true, - '!www' => true - ), - 'cl' => array( - 'gov' => true, - 'gob' => true, - 'co' => true, - 'mil' => true, - 'blogspot' => true - ), - 'cm' => array( - 'co' => true, - 'com' => true, - 'gov' => true, - 'net' => true - ), - 'cn' => array( - 'ac' => true, - 'com' => array( - 'amazonaws' => array( - 'cn-north-1' => array( - 's3' => true - ) - ) - ), - 'edu' => true, - 'gov' => true, - 'net' => true, - 'org' => true, - 'mil' => true, - '公司' => true, - '网络' => true, - '網絡' => true, - 'ah' => true, - 'bj' => true, - 'cq' => true, - 'fj' => true, - 'gd' => true, - 'gs' => true, - 'gz' => true, - 'gx' => true, - 'ha' => true, - 'hb' => true, - 'he' => true, - 'hi' => true, - 'hl' => true, - 'hn' => true, - 'jl' => true, - 'js' => true, - 'jx' => true, - 'ln' => true, - 'nm' => true, - 'nx' => true, - 'qh' => true, - 'sc' => true, - 'sd' => true, - 'sh' => true, - 'sn' => true, - 'sx' => true, - 'tj' => true, - 'xj' => true, - 'xz' => true, - 'yn' => true, - 'zj' => true, - 'hk' => true, - 'mo' => true, - 'tw' => true, - 'amazonaws' => array( - 'compute' => array( - 'cn-north-1' => true - ) - ) - ), - 'co' => array( - 'arts' => true, - 'com' => array( - 'blogspot' => true - ), - 'edu' => true, - 'firm' => true, - 'gov' => true, - 'info' => true, - 'int' => true, - 'mil' => true, - 'net' => true, - 'nom' => true, - 'org' => true, - 'rec' => true, - 'web' => true - ), - 'com' => array( - 'amazonaws' => array( - 'compute' => array( - 'ap-northeast-1' => true, - 'ap-northeast-2' => true, - 'ap-southeast-1' => true, - 'ap-southeast-2' => true, - 'eu-central-1' => true, - 'eu-west-1' => true, - 'sa-east-1' => true, - 'us-gov-west-1' => true, - 'us-west-1' => true, - 'us-west-2' => true - ), - 'compute-1' => array( - 'z-1' => true, - 'z-2' => true - ), - 'us-east-1' => true, - 'elb' => true, - 's3' => true, - 's3-ap-northeast-1' => true, - 's3-ap-northeast-2' => true, - 's3-ap-southeast-1' => true, - 's3-ap-southeast-2' => true, - 's3-eu-central-1' => true, - 's3-eu-west-1' => true, - 's3-external-1' => true, - 's3-external-2' => true, - 's3-fips-us-gov-west-1' => true, - 's3-sa-east-1' => true, - 's3-us-gov-west-1' => true, - 's3-us-west-1' => true, - 's3-us-west-2' => true, - 'ap-northeast-2' => array( - 's3' => true - ), - 'eu-central-1' => array( - 's3' => true - ) - ), - 'elasticbeanstalk' => true, - 'betainabox' => true, - 'ar' => true, - 'br' => true, - 'cn' => true, - 'de' => true, - 'eu' => true, - 'gb' => true, - 'hu' => true, - 'jpn' => true, - 'kr' => true, - 'mex' => true, - 'no' => true, - 'qc' => true, - 'ru' => true, - 'sa' => true, - 'se' => true, - 'uk' => true, - 'us' => true, - 'uy' => true, - 'za' => true, - 'africa' => true, - 'xenapponazure' => true, - 'gr' => true, - 'co' => true, - 'cloudcontrolled' => true, - 'cloudcontrolapp' => true, - 'dreamhosters' => true, - 'mydrobo' => true, - 'dyndns-at-home' => true, - 'dyndns-at-work' => true, - 'dyndns-blog' => true, - 'dyndns-free' => true, - 'dyndns-home' => true, - 'dyndns-ip' => true, - 'dyndns-mail' => true, - 'dyndns-office' => true, - 'dyndns-pics' => true, - 'dyndns-remote' => true, - 'dyndns-server' => true, - 'dyndns-web' => true, - 'dyndns-wiki' => true, - 'dyndns-work' => true, - 'blogdns' => true, - 'cechire' => true, - 'dnsalias' => true, - 'dnsdojo' => true, - 'doesntexist' => true, - 'dontexist' => true, - 'doomdns' => true, - 'dyn-o-saur' => true, - 'dynalias' => true, - 'est-a-la-maison' => true, - 'est-a-la-masion' => true, - 'est-le-patron' => true, - 'est-mon-blogueur' => true, - 'from-ak' => true, - 'from-al' => true, - 'from-ar' => true, - 'from-ca' => true, - 'from-ct' => true, - 'from-dc' => true, - 'from-de' => true, - 'from-fl' => true, - 'from-ga' => true, - 'from-hi' => true, - 'from-ia' => true, - 'from-id' => true, - 'from-il' => true, - 'from-in' => true, - 'from-ks' => true, - 'from-ky' => true, - 'from-ma' => true, - 'from-md' => true, - 'from-mi' => true, - 'from-mn' => true, - 'from-mo' => true, - 'from-ms' => true, - 'from-mt' => true, - 'from-nc' => true, - 'from-nd' => true, - 'from-ne' => true, - 'from-nh' => true, - 'from-nj' => true, - 'from-nm' => true, - 'from-nv' => true, - 'from-oh' => true, - 'from-ok' => true, - 'from-or' => true, - 'from-pa' => true, - 'from-pr' => true, - 'from-ri' => true, - 'from-sc' => true, - 'from-sd' => true, - 'from-tn' => true, - 'from-tx' => true, - 'from-ut' => true, - 'from-va' => true, - 'from-vt' => true, - 'from-wa' => true, - 'from-wi' => true, - 'from-wv' => true, - 'from-wy' => true, - 'getmyip' => true, - 'gotdns' => true, - 'hobby-site' => true, - 'homelinux' => true, - 'homeunix' => true, - 'iamallama' => true, - 'is-a-anarchist' => true, - 'is-a-blogger' => true, - 'is-a-bookkeeper' => true, - 'is-a-bulls-fan' => true, - 'is-a-caterer' => true, - 'is-a-chef' => true, - 'is-a-conservative' => true, - 'is-a-cpa' => true, - 'is-a-cubicle-slave' => true, - 'is-a-democrat' => true, - 'is-a-designer' => true, - 'is-a-doctor' => true, - 'is-a-financialadvisor' => true, - 'is-a-geek' => true, - 'is-a-green' => true, - 'is-a-guru' => true, - 'is-a-hard-worker' => true, - 'is-a-hunter' => true, - 'is-a-landscaper' => true, - 'is-a-lawyer' => true, - 'is-a-liberal' => true, - 'is-a-libertarian' => true, - 'is-a-llama' => true, - 'is-a-musician' => true, - 'is-a-nascarfan' => true, - 'is-a-nurse' => true, - 'is-a-painter' => true, - 'is-a-personaltrainer' => true, - 'is-a-photographer' => true, - 'is-a-player' => true, - 'is-a-republican' => true, - 'is-a-rockstar' => true, - 'is-a-socialist' => true, - 'is-a-student' => true, - 'is-a-teacher' => true, - 'is-a-techie' => true, - 'is-a-therapist' => true, - 'is-an-accountant' => true, - 'is-an-actor' => true, - 'is-an-actress' => true, - 'is-an-anarchist' => true, - 'is-an-artist' => true, - 'is-an-engineer' => true, - 'is-an-entertainer' => true, - 'is-certified' => true, - 'is-gone' => true, - 'is-into-anime' => true, - 'is-into-cars' => true, - 'is-into-cartoons' => true, - 'is-into-games' => true, - 'is-leet' => true, - 'is-not-certified' => true, - 'is-slick' => true, - 'is-uberleet' => true, - 'is-with-theband' => true, - 'isa-geek' => true, - 'isa-hockeynut' => true, - 'issmarterthanyou' => true, - 'likes-pie' => true, - 'likescandy' => true, - 'neat-url' => true, - 'saves-the-whales' => true, - 'selfip' => true, - 'sells-for-less' => true, - 'sells-for-u' => true, - 'servebbs' => true, - 'simple-url' => true, - 'space-to-rent' => true, - 'teaches-yoga' => true, - 'writesthisblog' => true, - 'firebaseapp' => true, - 'flynnhub' => true, - 'githubusercontent' => true, - 'ro' => true, - 'appspot' => true, - 'blogspot' => true, - 'codespot' => true, - 'googleapis' => true, - 'googlecode' => true, - 'pagespeedmobilizer' => true, - 'withgoogle' => true, - 'withyoutube' => true, - 'herokuapp' => true, - 'herokussl' => true, - '4u' => true, - 'nfshost' => true, - 'operaunite' => true, - 'outsystemscloud' => true, - 'pagefrontapp' => true, - 'gotpantheon' => true, - 'prgmr' => array( - 'xen' => true - ), - 'qa2' => true, - 'rackmaze' => true, - 'rhcloud' => true, - 'sinaapp' => true, - 'vipsinaapp' => true, - '1kapp' => true, - 'dsmynas' => true, - 'familyds' => true, - 'hk' => true, - 'yolasite' => true - ), - 'coop' => true, - 'cr' => array( - 'ac' => true, - 'co' => true, - 'ed' => true, - 'fi' => true, - 'go' => true, - 'or' => true, - 'sa' => true - ), - 'cu' => array( - 'com' => true, - 'edu' => true, - 'org' => true, - 'net' => true, - 'gov' => true, - 'inf' => true - ), - 'cv' => array( - 'blogspot' => true - ), - 'cw' => array( - 'com' => true, - 'edu' => true, - 'net' => true, - 'org' => true - ), - 'cx' => array( - 'gov' => true, - 'ath' => true - ), - 'cy' => array( - 'ac' => true, - 'biz' => true, - 'com' => array( - 'blogspot' => true - ), - 'ekloges' => true, - 'gov' => true, - 'ltd' => true, - 'name' => true, - 'net' => true, - 'org' => true, - 'parliament' => true, - 'press' => true, - 'pro' => true, - 'tm' => true - ), - 'cz' => array( - 'co' => true, - 'blogspot' => true - ), - 'de' => array( - 'com' => true, - 'fuettertdasnetz' => true, - 'isteingeek' => true, - 'istmein' => true, - 'lebtimnetz' => true, - 'leitungsen' => true, - 'traeumtgerade' => true, - 'blogspot' => true - ), - 'dj' => true, - 'dk' => array( - 'blogspot' => true - ), - 'dm' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'edu' => true, - 'gov' => true - ), - 'do' => array( - 'art' => true, - 'com' => true, - 'edu' => true, - 'gob' => true, - 'gov' => true, - 'mil' => true, - 'net' => true, - 'org' => true, - 'sld' => true, - 'web' => true - ), - 'dz' => array( - 'com' => true, - 'org' => true, - 'net' => true, - 'gov' => true, - 'edu' => true, - 'asso' => true, - 'pol' => true, - 'art' => true - ), - 'ec' => array( - 'com' => true, - 'info' => true, - 'net' => true, - 'fin' => true, - 'k12' => true, - 'med' => true, - 'pro' => true, - 'org' => true, - 'edu' => true, - 'gov' => true, - 'gob' => true, - 'mil' => true - ), - 'edu' => true, - 'ee' => array( - 'edu' => true, - 'gov' => true, - 'riik' => true, - 'lib' => true, - 'med' => true, - 'com' => array( - 'blogspot' => true - ), - 'pri' => true, - 'aip' => true, - 'org' => true, - 'fie' => true - ), - 'eg' => array( - 'com' => array( - 'blogspot' => true - ), - 'edu' => true, - 'eun' => true, - 'gov' => true, - 'mil' => true, - 'name' => true, - 'net' => true, - 'org' => true, - 'sci' => true - ), - 'er' => array( - '*' => true - ), - 'es' => array( - 'com' => array( - 'blogspot' => true - ), - 'nom' => true, - 'org' => true, - 'gob' => true, - 'edu' => true - ), - 'et' => array( - 'com' => true, - 'gov' => true, - 'org' => true, - 'edu' => true, - 'biz' => true, - 'name' => true, - 'info' => true, - 'net' => true - ), - 'eu' => true, - 'fi' => array( - 'aland' => true, - 'blogspot' => true, - 'iki' => true - ), - 'fj' => array( - '*' => true - ), - 'fk' => array( - '*' => true - ), - 'fm' => true, - 'fo' => true, - 'fr' => array( - 'com' => true, - 'asso' => true, - 'nom' => true, - 'prd' => true, - 'presse' => true, - 'tm' => true, - 'aeroport' => true, - 'assedic' => true, - 'avocat' => true, - 'avoues' => true, - 'cci' => true, - 'chambagri' => true, - 'chirurgiens-dentistes' => true, - 'experts-comptables' => true, - 'geometre-expert' => true, - 'gouv' => true, - 'greta' => true, - 'huissier-justice' => true, - 'medecin' => true, - 'notaires' => true, - 'pharmacien' => true, - 'port' => true, - 'veterinaire' => true, - 'blogspot' => true - ), - 'ga' => true, - 'gb' => true, - 'gd' => true, - 'ge' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'org' => true, - 'mil' => true, - 'net' => true, - 'pvt' => true - ), - 'gf' => true, - 'gg' => array( - 'co' => true, - 'net' => true, - 'org' => true - ), - 'gh' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'org' => true, - 'mil' => true - ), - 'gi' => array( - 'com' => true, - 'ltd' => true, - 'gov' => true, - 'mod' => true, - 'edu' => true, - 'org' => true - ), - 'gl' => array( - 'co' => true, - 'com' => true, - 'edu' => true, - 'net' => true, - 'org' => true - ), - 'gm' => true, - 'gn' => array( - 'ac' => true, - 'com' => true, - 'edu' => true, - 'gov' => true, - 'org' => true, - 'net' => true - ), - 'gov' => true, - 'gp' => array( - 'com' => true, - 'net' => true, - 'mobi' => true, - 'edu' => true, - 'org' => true, - 'asso' => true - ), - 'gq' => true, - 'gr' => array( - 'com' => true, - 'edu' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'blogspot' => true - ), - 'gs' => true, - 'gt' => array( - 'com' => true, - 'edu' => true, - 'gob' => true, - 'ind' => true, - 'mil' => true, - 'net' => true, - 'org' => true - ), - 'gu' => array( - '*' => true - ), - 'gw' => true, - 'gy' => array( - 'co' => true, - 'com' => true, - 'edu' => true, - 'gov' => true, - 'net' => true, - 'org' => true - ), - 'hk' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'idv' => true, - 'net' => true, - 'org' => true, - '公司' => true, - '教育' => true, - '敎育' => true, - '政府' => true, - '個人' => true, - '个人' => true, - '箇人' => true, - '網络' => true, - '网络' => true, - '组織' => true, - '網絡' => true, - '网絡' => true, - '组织' => true, - '組織' => true, - '組织' => true, - 'blogspot' => true, - 'ltd' => true, - 'inc' => true - ), - 'hm' => true, - 'hn' => array( - 'com' => true, - 'edu' => true, - 'org' => true, - 'net' => true, - 'mil' => true, - 'gob' => true - ), - 'hr' => array( - 'iz' => true, - 'from' => true, - 'name' => true, - 'com' => true, - 'blogspot' => true - ), - 'ht' => array( - 'com' => true, - 'shop' => true, - 'firm' => true, - 'info' => true, - 'adult' => true, - 'net' => true, - 'pro' => true, - 'org' => true, - 'med' => true, - 'art' => true, - 'coop' => true, - 'pol' => true, - 'asso' => true, - 'edu' => true, - 'rel' => true, - 'gouv' => true, - 'perso' => true - ), - 'hu' => array( - 'co' => true, - 'info' => true, - 'org' => true, - 'priv' => true, - 'sport' => true, - 'tm' => true, - '2000' => true, - 'agrar' => true, - 'bolt' => true, - 'casino' => true, - 'city' => true, - 'erotica' => true, - 'erotika' => true, - 'film' => true, - 'forum' => true, - 'games' => true, - 'hotel' => true, - 'ingatlan' => true, - 'jogasz' => true, - 'konyvelo' => true, - 'lakas' => true, - 'media' => true, - 'news' => true, - 'reklam' => true, - 'sex' => true, - 'shop' => true, - 'suli' => true, - 'szex' => true, - 'tozsde' => true, - 'utazas' => true, - 'video' => true, - 'blogspot' => true - ), - 'id' => array( - 'ac' => true, - 'biz' => true, - 'co' => array( - 'blogspot' => true - ), - 'desa' => true, - 'go' => true, - 'mil' => true, - 'my' => true, - 'net' => true, - 'or' => true, - 'sch' => true, - 'web' => true - ), - 'ie' => array( - 'gov' => true, - 'blogspot' => true - ), - 'il' => array( - 'ac' => true, - 'co' => array( - 'blogspot' => true - ), - 'gov' => true, - 'idf' => true, - 'k12' => true, - 'muni' => true, - 'net' => true, - 'org' => true - ), - 'im' => array( - 'ac' => true, - 'co' => array( - 'ltd' => true, - 'plc' => true - ), - 'com' => true, - 'net' => true, - 'org' => true, - 'tt' => true, - 'tv' => true - ), - 'in' => array( - 'co' => true, - 'firm' => true, - 'net' => true, - 'org' => true, - 'gen' => true, - 'ind' => true, - 'nic' => true, - 'ac' => true, - 'edu' => true, - 'res' => true, - 'gov' => true, - 'mil' => true, - 'blogspot' => true - ), - 'info' => array( - 'dyndns' => true, - 'barrel-of-knowledge' => true, - 'barrell-of-knowledge' => true, - 'for-our' => true, - 'groks-the' => true, - 'groks-this' => true, - 'here-for-more' => true, - 'knowsitall' => true, - 'selfip' => true, - 'webhop' => true - ), - 'int' => array( - 'eu' => true - ), - 'io' => array( - 'com' => true, - 'github' => true, - 'ngrok' => true, - 'nid' => true, - 'pantheon' => true, - 'sandcats' => true - ), - 'iq' => array( - 'gov' => true, - 'edu' => true, - 'mil' => true, - 'com' => true, - 'org' => true, - 'net' => true - ), - 'ir' => array( - 'ac' => true, - 'co' => true, - 'gov' => true, - 'id' => true, - 'net' => true, - 'org' => true, - 'sch' => true, - 'ایران' => true, - 'ايران' => true - ), - 'is' => array( - 'net' => true, - 'com' => true, - 'edu' => true, - 'gov' => true, - 'org' => true, - 'int' => true, - 'cupcake' => true, - 'blogspot' => true - ), - 'it' => array( - 'gov' => true, - 'edu' => true, - 'abr' => true, - 'abruzzo' => true, - 'aosta-valley' => true, - 'aostavalley' => true, - 'bas' => true, - 'basilicata' => true, - 'cal' => true, - 'calabria' => true, - 'cam' => true, - 'campania' => true, - 'emilia-romagna' => true, - 'emiliaromagna' => true, - 'emr' => true, - 'friuli-v-giulia' => true, - 'friuli-ve-giulia' => true, - 'friuli-vegiulia' => true, - 'friuli-venezia-giulia' => true, - 'friuli-veneziagiulia' => true, - 'friuli-vgiulia' => true, - 'friuliv-giulia' => true, - 'friulive-giulia' => true, - 'friulivegiulia' => true, - 'friulivenezia-giulia' => true, - 'friuliveneziagiulia' => true, - 'friulivgiulia' => true, - 'fvg' => true, - 'laz' => true, - 'lazio' => true, - 'lig' => true, - 'liguria' => true, - 'lom' => true, - 'lombardia' => true, - 'lombardy' => true, - 'lucania' => true, - 'mar' => true, - 'marche' => true, - 'mol' => true, - 'molise' => true, - 'piedmont' => true, - 'piemonte' => true, - 'pmn' => true, - 'pug' => true, - 'puglia' => true, - 'sar' => true, - 'sardegna' => true, - 'sardinia' => true, - 'sic' => true, - 'sicilia' => true, - 'sicily' => true, - 'taa' => true, - 'tos' => true, - 'toscana' => true, - 'trentino-a-adige' => true, - 'trentino-aadige' => true, - 'trentino-alto-adige' => true, - 'trentino-altoadige' => true, - 'trentino-s-tirol' => true, - 'trentino-stirol' => true, - 'trentino-sud-tirol' => true, - 'trentino-sudtirol' => true, - 'trentino-sued-tirol' => true, - 'trentino-suedtirol' => true, - 'trentinoa-adige' => true, - 'trentinoaadige' => true, - 'trentinoalto-adige' => true, - 'trentinoaltoadige' => true, - 'trentinos-tirol' => true, - 'trentinostirol' => true, - 'trentinosud-tirol' => true, - 'trentinosudtirol' => true, - 'trentinosued-tirol' => true, - 'trentinosuedtirol' => true, - 'tuscany' => true, - 'umb' => true, - 'umbria' => true, - 'val-d-aosta' => true, - 'val-daosta' => true, - 'vald-aosta' => true, - 'valdaosta' => true, - 'valle-aosta' => true, - 'valle-d-aosta' => true, - 'valle-daosta' => true, - 'valleaosta' => true, - 'valled-aosta' => true, - 'valledaosta' => true, - 'vallee-aoste' => true, - 'valleeaoste' => true, - 'vao' => true, - 'vda' => true, - 'ven' => true, - 'veneto' => true, - 'ag' => true, - 'agrigento' => true, - 'al' => true, - 'alessandria' => true, - 'alto-adige' => true, - 'altoadige' => true, - 'an' => true, - 'ancona' => true, - 'andria-barletta-trani' => true, - 'andria-trani-barletta' => true, - 'andriabarlettatrani' => true, - 'andriatranibarletta' => true, - 'ao' => true, - 'aosta' => true, - 'aoste' => true, - 'ap' => true, - 'aq' => true, - 'aquila' => true, - 'ar' => true, - 'arezzo' => true, - 'ascoli-piceno' => true, - 'ascolipiceno' => true, - 'asti' => true, - 'at' => true, - 'av' => true, - 'avellino' => true, - 'ba' => true, - 'balsan' => true, - 'bari' => true, - 'barletta-trani-andria' => true, - 'barlettatraniandria' => true, - 'belluno' => true, - 'benevento' => true, - 'bergamo' => true, - 'bg' => true, - 'bi' => true, - 'biella' => true, - 'bl' => true, - 'bn' => true, - 'bo' => true, - 'bologna' => true, - 'bolzano' => true, - 'bozen' => true, - 'br' => true, - 'brescia' => true, - 'brindisi' => true, - 'bs' => true, - 'bt' => true, - 'bz' => true, - 'ca' => true, - 'cagliari' => true, - 'caltanissetta' => true, - 'campidano-medio' => true, - 'campidanomedio' => true, - 'campobasso' => true, - 'carbonia-iglesias' => true, - 'carboniaiglesias' => true, - 'carrara-massa' => true, - 'carraramassa' => true, - 'caserta' => true, - 'catania' => true, - 'catanzaro' => true, - 'cb' => true, - 'ce' => true, - 'cesena-forli' => true, - 'cesenaforli' => true, - 'ch' => true, - 'chieti' => true, - 'ci' => true, - 'cl' => true, - 'cn' => true, - 'co' => true, - 'como' => true, - 'cosenza' => true, - 'cr' => true, - 'cremona' => true, - 'crotone' => true, - 'cs' => true, - 'ct' => true, - 'cuneo' => true, - 'cz' => true, - 'dell-ogliastra' => true, - 'dellogliastra' => true, - 'en' => true, - 'enna' => true, - 'fc' => true, - 'fe' => true, - 'fermo' => true, - 'ferrara' => true, - 'fg' => true, - 'fi' => true, - 'firenze' => true, - 'florence' => true, - 'fm' => true, - 'foggia' => true, - 'forli-cesena' => true, - 'forlicesena' => true, - 'fr' => true, - 'frosinone' => true, - 'ge' => true, - 'genoa' => true, - 'genova' => true, - 'go' => true, - 'gorizia' => true, - 'gr' => true, - 'grosseto' => true, - 'iglesias-carbonia' => true, - 'iglesiascarbonia' => true, - 'im' => true, - 'imperia' => true, - 'is' => true, - 'isernia' => true, - 'kr' => true, - 'la-spezia' => true, - 'laquila' => true, - 'laspezia' => true, - 'latina' => true, - 'lc' => true, - 'le' => true, - 'lecce' => true, - 'lecco' => true, - 'li' => true, - 'livorno' => true, - 'lo' => true, - 'lodi' => true, - 'lt' => true, - 'lu' => true, - 'lucca' => true, - 'macerata' => true, - 'mantova' => true, - 'massa-carrara' => true, - 'massacarrara' => true, - 'matera' => true, - 'mb' => true, - 'mc' => true, - 'me' => true, - 'medio-campidano' => true, - 'mediocampidano' => true, - 'messina' => true, - 'mi' => true, - 'milan' => true, - 'milano' => true, - 'mn' => true, - 'mo' => true, - 'modena' => true, - 'monza-brianza' => true, - 'monza-e-della-brianza' => true, - 'monza' => true, - 'monzabrianza' => true, - 'monzaebrianza' => true, - 'monzaedellabrianza' => true, - 'ms' => true, - 'mt' => true, - 'na' => true, - 'naples' => true, - 'napoli' => true, - 'no' => true, - 'novara' => true, - 'nu' => true, - 'nuoro' => true, - 'og' => true, - 'ogliastra' => true, - 'olbia-tempio' => true, - 'olbiatempio' => true, - 'or' => true, - 'oristano' => true, - 'ot' => true, - 'pa' => true, - 'padova' => true, - 'padua' => true, - 'palermo' => true, - 'parma' => true, - 'pavia' => true, - 'pc' => true, - 'pd' => true, - 'pe' => true, - 'perugia' => true, - 'pesaro-urbino' => true, - 'pesarourbino' => true, - 'pescara' => true, - 'pg' => true, - 'pi' => true, - 'piacenza' => true, - 'pisa' => true, - 'pistoia' => true, - 'pn' => true, - 'po' => true, - 'pordenone' => true, - 'potenza' => true, - 'pr' => true, - 'prato' => true, - 'pt' => true, - 'pu' => true, - 'pv' => true, - 'pz' => true, - 'ra' => true, - 'ragusa' => true, - 'ravenna' => true, - 'rc' => true, - 're' => true, - 'reggio-calabria' => true, - 'reggio-emilia' => true, - 'reggiocalabria' => true, - 'reggioemilia' => true, - 'rg' => true, - 'ri' => true, - 'rieti' => true, - 'rimini' => true, - 'rm' => true, - 'rn' => true, - 'ro' => true, - 'roma' => true, - 'rome' => true, - 'rovigo' => true, - 'sa' => true, - 'salerno' => true, - 'sassari' => true, - 'savona' => true, - 'si' => true, - 'siena' => true, - 'siracusa' => true, - 'so' => true, - 'sondrio' => true, - 'sp' => true, - 'sr' => true, - 'ss' => true, - 'suedtirol' => true, - 'sv' => true, - 'ta' => true, - 'taranto' => true, - 'te' => true, - 'tempio-olbia' => true, - 'tempioolbia' => true, - 'teramo' => true, - 'terni' => true, - 'tn' => true, - 'to' => true, - 'torino' => true, - 'tp' => true, - 'tr' => true, - 'trani-andria-barletta' => true, - 'trani-barletta-andria' => true, - 'traniandriabarletta' => true, - 'tranibarlettaandria' => true, - 'trapani' => true, - 'trentino' => true, - 'trento' => true, - 'treviso' => true, - 'trieste' => true, - 'ts' => true, - 'turin' => true, - 'tv' => true, - 'ud' => true, - 'udine' => true, - 'urbino-pesaro' => true, - 'urbinopesaro' => true, - 'va' => true, - 'varese' => true, - 'vb' => true, - 'vc' => true, - 've' => true, - 'venezia' => true, - 'venice' => true, - 'verbania' => true, - 'vercelli' => true, - 'verona' => true, - 'vi' => true, - 'vibo-valentia' => true, - 'vibovalentia' => true, - 'vicenza' => true, - 'viterbo' => true, - 'vr' => true, - 'vs' => true, - 'vt' => true, - 'vv' => true, - 'blogspot' => true - ), - 'je' => array( - 'co' => true, - 'net' => true, - 'org' => true - ), - 'jm' => array( - '*' => true - ), - 'jo' => array( - 'com' => true, - 'org' => true, - 'net' => true, - 'edu' => true, - 'sch' => true, - 'gov' => true, - 'mil' => true, - 'name' => true - ), - 'jobs' => true, - 'jp' => array( - 'ac' => true, - 'ad' => true, - 'co' => true, - 'ed' => true, - 'go' => true, - 'gr' => true, - 'lg' => true, - 'ne' => true, - 'or' => true, - 'aichi' => array( - 'aisai' => true, - 'ama' => true, - 'anjo' => true, - 'asuke' => true, - 'chiryu' => true, - 'chita' => true, - 'fuso' => true, - 'gamagori' => true, - 'handa' => true, - 'hazu' => true, - 'hekinan' => true, - 'higashiura' => true, - 'ichinomiya' => true, - 'inazawa' => true, - 'inuyama' => true, - 'isshiki' => true, - 'iwakura' => true, - 'kanie' => true, - 'kariya' => true, - 'kasugai' => true, - 'kira' => true, - 'kiyosu' => true, - 'komaki' => true, - 'konan' => true, - 'kota' => true, - 'mihama' => true, - 'miyoshi' => true, - 'nishio' => true, - 'nisshin' => true, - 'obu' => true, - 'oguchi' => true, - 'oharu' => true, - 'okazaki' => true, - 'owariasahi' => true, - 'seto' => true, - 'shikatsu' => true, - 'shinshiro' => true, - 'shitara' => true, - 'tahara' => true, - 'takahama' => true, - 'tobishima' => true, - 'toei' => true, - 'togo' => true, - 'tokai' => true, - 'tokoname' => true, - 'toyoake' => true, - 'toyohashi' => true, - 'toyokawa' => true, - 'toyone' => true, - 'toyota' => true, - 'tsushima' => true, - 'yatomi' => true - ), - 'akita' => array( - 'akita' => true, - 'daisen' => true, - 'fujisato' => true, - 'gojome' => true, - 'hachirogata' => true, - 'happou' => true, - 'higashinaruse' => true, - 'honjo' => true, - 'honjyo' => true, - 'ikawa' => true, - 'kamikoani' => true, - 'kamioka' => true, - 'katagami' => true, - 'kazuno' => true, - 'kitaakita' => true, - 'kosaka' => true, - 'kyowa' => true, - 'misato' => true, - 'mitane' => true, - 'moriyoshi' => true, - 'nikaho' => true, - 'noshiro' => true, - 'odate' => true, - 'oga' => true, - 'ogata' => true, - 'semboku' => true, - 'yokote' => true, - 'yurihonjo' => true - ), - 'aomori' => array( - 'aomori' => true, - 'gonohe' => true, - 'hachinohe' => true, - 'hashikami' => true, - 'hiranai' => true, - 'hirosaki' => true, - 'itayanagi' => true, - 'kuroishi' => true, - 'misawa' => true, - 'mutsu' => true, - 'nakadomari' => true, - 'noheji' => true, - 'oirase' => true, - 'owani' => true, - 'rokunohe' => true, - 'sannohe' => true, - 'shichinohe' => true, - 'shingo' => true, - 'takko' => true, - 'towada' => true, - 'tsugaru' => true, - 'tsuruta' => true - ), - 'chiba' => array( - 'abiko' => true, - 'asahi' => true, - 'chonan' => true, - 'chosei' => true, - 'choshi' => true, - 'chuo' => true, - 'funabashi' => true, - 'futtsu' => true, - 'hanamigawa' => true, - 'ichihara' => true, - 'ichikawa' => true, - 'ichinomiya' => true, - 'inzai' => true, - 'isumi' => true, - 'kamagaya' => true, - 'kamogawa' => true, - 'kashiwa' => true, - 'katori' => true, - 'katsuura' => true, - 'kimitsu' => true, - 'kisarazu' => true, - 'kozaki' => true, - 'kujukuri' => true, - 'kyonan' => true, - 'matsudo' => true, - 'midori' => true, - 'mihama' => true, - 'minamiboso' => true, - 'mobara' => true, - 'mutsuzawa' => true, - 'nagara' => true, - 'nagareyama' => true, - 'narashino' => true, - 'narita' => true, - 'noda' => true, - 'oamishirasato' => true, - 'omigawa' => true, - 'onjuku' => true, - 'otaki' => true, - 'sakae' => true, - 'sakura' => true, - 'shimofusa' => true, - 'shirako' => true, - 'shiroi' => true, - 'shisui' => true, - 'sodegaura' => true, - 'sosa' => true, - 'tako' => true, - 'tateyama' => true, - 'togane' => true, - 'tohnosho' => true, - 'tomisato' => true, - 'urayasu' => true, - 'yachimata' => true, - 'yachiyo' => true, - 'yokaichiba' => true, - 'yokoshibahikari' => true, - 'yotsukaido' => true - ), - 'ehime' => array( - 'ainan' => true, - 'honai' => true, - 'ikata' => true, - 'imabari' => true, - 'iyo' => true, - 'kamijima' => true, - 'kihoku' => true, - 'kumakogen' => true, - 'masaki' => true, - 'matsuno' => true, - 'matsuyama' => true, - 'namikata' => true, - 'niihama' => true, - 'ozu' => true, - 'saijo' => true, - 'seiyo' => true, - 'shikokuchuo' => true, - 'tobe' => true, - 'toon' => true, - 'uchiko' => true, - 'uwajima' => true, - 'yawatahama' => true - ), - 'fukui' => array( - 'echizen' => true, - 'eiheiji' => true, - 'fukui' => true, - 'ikeda' => true, - 'katsuyama' => true, - 'mihama' => true, - 'minamiechizen' => true, - 'obama' => true, - 'ohi' => true, - 'ono' => true, - 'sabae' => true, - 'sakai' => true, - 'takahama' => true, - 'tsuruga' => true, - 'wakasa' => true - ), - 'fukuoka' => array( - 'ashiya' => true, - 'buzen' => true, - 'chikugo' => true, - 'chikuho' => true, - 'chikujo' => true, - 'chikushino' => true, - 'chikuzen' => true, - 'chuo' => true, - 'dazaifu' => true, - 'fukuchi' => true, - 'hakata' => true, - 'higashi' => true, - 'hirokawa' => true, - 'hisayama' => true, - 'iizuka' => true, - 'inatsuki' => true, - 'kaho' => true, - 'kasuga' => true, - 'kasuya' => true, - 'kawara' => true, - 'keisen' => true, - 'koga' => true, - 'kurate' => true, - 'kurogi' => true, - 'kurume' => true, - 'minami' => true, - 'miyako' => true, - 'miyama' => true, - 'miyawaka' => true, - 'mizumaki' => true, - 'munakata' => true, - 'nakagawa' => true, - 'nakama' => true, - 'nishi' => true, - 'nogata' => true, - 'ogori' => true, - 'okagaki' => true, - 'okawa' => true, - 'oki' => true, - 'omuta' => true, - 'onga' => true, - 'onojo' => true, - 'oto' => true, - 'saigawa' => true, - 'sasaguri' => true, - 'shingu' => true, - 'shinyoshitomi' => true, - 'shonai' => true, - 'soeda' => true, - 'sue' => true, - 'tachiarai' => true, - 'tagawa' => true, - 'takata' => true, - 'toho' => true, - 'toyotsu' => true, - 'tsuiki' => true, - 'ukiha' => true, - 'umi' => true, - 'usui' => true, - 'yamada' => true, - 'yame' => true, - 'yanagawa' => true, - 'yukuhashi' => true - ), - 'fukushima' => array( - 'aizubange' => true, - 'aizumisato' => true, - 'aizuwakamatsu' => true, - 'asakawa' => true, - 'bandai' => true, - 'date' => true, - 'fukushima' => true, - 'furudono' => true, - 'futaba' => true, - 'hanawa' => true, - 'higashi' => true, - 'hirata' => true, - 'hirono' => true, - 'iitate' => true, - 'inawashiro' => true, - 'ishikawa' => true, - 'iwaki' => true, - 'izumizaki' => true, - 'kagamiishi' => true, - 'kaneyama' => true, - 'kawamata' => true, - 'kitakata' => true, - 'kitashiobara' => true, - 'koori' => true, - 'koriyama' => true, - 'kunimi' => true, - 'miharu' => true, - 'mishima' => true, - 'namie' => true, - 'nango' => true, - 'nishiaizu' => true, - 'nishigo' => true, - 'okuma' => true, - 'omotego' => true, - 'ono' => true, - 'otama' => true, - 'samegawa' => true, - 'shimogo' => true, - 'shirakawa' => true, - 'showa' => true, - 'soma' => true, - 'sukagawa' => true, - 'taishin' => true, - 'tamakawa' => true, - 'tanagura' => true, - 'tenei' => true, - 'yabuki' => true, - 'yamato' => true, - 'yamatsuri' => true, - 'yanaizu' => true, - 'yugawa' => true - ), - 'gifu' => array( - 'anpachi' => true, - 'ena' => true, - 'gifu' => true, - 'ginan' => true, - 'godo' => true, - 'gujo' => true, - 'hashima' => true, - 'hichiso' => true, - 'hida' => true, - 'higashishirakawa' => true, - 'ibigawa' => true, - 'ikeda' => true, - 'kakamigahara' => true, - 'kani' => true, - 'kasahara' => true, - 'kasamatsu' => true, - 'kawaue' => true, - 'kitagata' => true, - 'mino' => true, - 'minokamo' => true, - 'mitake' => true, - 'mizunami' => true, - 'motosu' => true, - 'nakatsugawa' => true, - 'ogaki' => true, - 'sakahogi' => true, - 'seki' => true, - 'sekigahara' => true, - 'shirakawa' => true, - 'tajimi' => true, - 'takayama' => true, - 'tarui' => true, - 'toki' => true, - 'tomika' => true, - 'wanouchi' => true, - 'yamagata' => true, - 'yaotsu' => true, - 'yoro' => true - ), - 'gunma' => array( - 'annaka' => true, - 'chiyoda' => true, - 'fujioka' => true, - 'higashiagatsuma' => true, - 'isesaki' => true, - 'itakura' => true, - 'kanna' => true, - 'kanra' => true, - 'katashina' => true, - 'kawaba' => true, - 'kiryu' => true, - 'kusatsu' => true, - 'maebashi' => true, - 'meiwa' => true, - 'midori' => true, - 'minakami' => true, - 'naganohara' => true, - 'nakanojo' => true, - 'nanmoku' => true, - 'numata' => true, - 'oizumi' => true, - 'ora' => true, - 'ota' => true, - 'shibukawa' => true, - 'shimonita' => true, - 'shinto' => true, - 'showa' => true, - 'takasaki' => true, - 'takayama' => true, - 'tamamura' => true, - 'tatebayashi' => true, - 'tomioka' => true, - 'tsukiyono' => true, - 'tsumagoi' => true, - 'ueno' => true, - 'yoshioka' => true - ), - 'hiroshima' => array( - 'asaminami' => true, - 'daiwa' => true, - 'etajima' => true, - 'fuchu' => true, - 'fukuyama' => true, - 'hatsukaichi' => true, - 'higashihiroshima' => true, - 'hongo' => true, - 'jinsekikogen' => true, - 'kaita' => true, - 'kui' => true, - 'kumano' => true, - 'kure' => true, - 'mihara' => true, - 'miyoshi' => true, - 'naka' => true, - 'onomichi' => true, - 'osakikamijima' => true, - 'otake' => true, - 'saka' => true, - 'sera' => true, - 'seranishi' => true, - 'shinichi' => true, - 'shobara' => true, - 'takehara' => true - ), - 'hokkaido' => array( - 'abashiri' => true, - 'abira' => true, - 'aibetsu' => true, - 'akabira' => true, - 'akkeshi' => true, - 'asahikawa' => true, - 'ashibetsu' => true, - 'ashoro' => true, - 'assabu' => true, - 'atsuma' => true, - 'bibai' => true, - 'biei' => true, - 'bifuka' => true, - 'bihoro' => true, - 'biratori' => true, - 'chippubetsu' => true, - 'chitose' => true, - 'date' => true, - 'ebetsu' => true, - 'embetsu' => true, - 'eniwa' => true, - 'erimo' => true, - 'esan' => true, - 'esashi' => true, - 'fukagawa' => true, - 'fukushima' => true, - 'furano' => true, - 'furubira' => true, - 'haboro' => true, - 'hakodate' => true, - 'hamatonbetsu' => true, - 'hidaka' => true, - 'higashikagura' => true, - 'higashikawa' => true, - 'hiroo' => true, - 'hokuryu' => true, - 'hokuto' => true, - 'honbetsu' => true, - 'horokanai' => true, - 'horonobe' => true, - 'ikeda' => true, - 'imakane' => true, - 'ishikari' => true, - 'iwamizawa' => true, - 'iwanai' => true, - 'kamifurano' => true, - 'kamikawa' => true, - 'kamishihoro' => true, - 'kamisunagawa' => true, - 'kamoenai' => true, - 'kayabe' => true, - 'kembuchi' => true, - 'kikonai' => true, - 'kimobetsu' => true, - 'kitahiroshima' => true, - 'kitami' => true, - 'kiyosato' => true, - 'koshimizu' => true, - 'kunneppu' => true, - 'kuriyama' => true, - 'kuromatsunai' => true, - 'kushiro' => true, - 'kutchan' => true, - 'kyowa' => true, - 'mashike' => true, - 'matsumae' => true, - 'mikasa' => true, - 'minamifurano' => true, - 'mombetsu' => true, - 'moseushi' => true, - 'mukawa' => true, - 'muroran' => true, - 'naie' => true, - 'nakagawa' => true, - 'nakasatsunai' => true, - 'nakatombetsu' => true, - 'nanae' => true, - 'nanporo' => true, - 'nayoro' => true, - 'nemuro' => true, - 'niikappu' => true, - 'niki' => true, - 'nishiokoppe' => true, - 'noboribetsu' => true, - 'numata' => true, - 'obihiro' => true, - 'obira' => true, - 'oketo' => true, - 'okoppe' => true, - 'otaru' => true, - 'otobe' => true, - 'otofuke' => true, - 'otoineppu' => true, - 'oumu' => true, - 'ozora' => true, - 'pippu' => true, - 'rankoshi' => true, - 'rebun' => true, - 'rikubetsu' => true, - 'rishiri' => true, - 'rishirifuji' => true, - 'saroma' => true, - 'sarufutsu' => true, - 'shakotan' => true, - 'shari' => true, - 'shibecha' => true, - 'shibetsu' => true, - 'shikabe' => true, - 'shikaoi' => true, - 'shimamaki' => true, - 'shimizu' => true, - 'shimokawa' => true, - 'shinshinotsu' => true, - 'shintoku' => true, - 'shiranuka' => true, - 'shiraoi' => true, - 'shiriuchi' => true, - 'sobetsu' => true, - 'sunagawa' => true, - 'taiki' => true, - 'takasu' => true, - 'takikawa' => true, - 'takinoue' => true, - 'teshikaga' => true, - 'tobetsu' => true, - 'tohma' => true, - 'tomakomai' => true, - 'tomari' => true, - 'toya' => true, - 'toyako' => true, - 'toyotomi' => true, - 'toyoura' => true, - 'tsubetsu' => true, - 'tsukigata' => true, - 'urakawa' => true, - 'urausu' => true, - 'uryu' => true, - 'utashinai' => true, - 'wakkanai' => true, - 'wassamu' => true, - 'yakumo' => true, - 'yoichi' => true - ), - 'hyogo' => array( - 'aioi' => true, - 'akashi' => true, - 'ako' => true, - 'amagasaki' => true, - 'aogaki' => true, - 'asago' => true, - 'ashiya' => true, - 'awaji' => true, - 'fukusaki' => true, - 'goshiki' => true, - 'harima' => true, - 'himeji' => true, - 'ichikawa' => true, - 'inagawa' => true, - 'itami' => true, - 'kakogawa' => true, - 'kamigori' => true, - 'kamikawa' => true, - 'kasai' => true, - 'kasuga' => true, - 'kawanishi' => true, - 'miki' => true, - 'minamiawaji' => true, - 'nishinomiya' => true, - 'nishiwaki' => true, - 'ono' => true, - 'sanda' => true, - 'sannan' => true, - 'sasayama' => true, - 'sayo' => true, - 'shingu' => true, - 'shinonsen' => true, - 'shiso' => true, - 'sumoto' => true, - 'taishi' => true, - 'taka' => true, - 'takarazuka' => true, - 'takasago' => true, - 'takino' => true, - 'tamba' => true, - 'tatsuno' => true, - 'toyooka' => true, - 'yabu' => true, - 'yashiro' => true, - 'yoka' => true, - 'yokawa' => true - ), - 'ibaraki' => array( - 'ami' => true, - 'asahi' => true, - 'bando' => true, - 'chikusei' => true, - 'daigo' => true, - 'fujishiro' => true, - 'hitachi' => true, - 'hitachinaka' => true, - 'hitachiomiya' => true, - 'hitachiota' => true, - 'ibaraki' => true, - 'ina' => true, - 'inashiki' => true, - 'itako' => true, - 'iwama' => true, - 'joso' => true, - 'kamisu' => true, - 'kasama' => true, - 'kashima' => true, - 'kasumigaura' => true, - 'koga' => true, - 'miho' => true, - 'mito' => true, - 'moriya' => true, - 'naka' => true, - 'namegata' => true, - 'oarai' => true, - 'ogawa' => true, - 'omitama' => true, - 'ryugasaki' => true, - 'sakai' => true, - 'sakuragawa' => true, - 'shimodate' => true, - 'shimotsuma' => true, - 'shirosato' => true, - 'sowa' => true, - 'suifu' => true, - 'takahagi' => true, - 'tamatsukuri' => true, - 'tokai' => true, - 'tomobe' => true, - 'tone' => true, - 'toride' => true, - 'tsuchiura' => true, - 'tsukuba' => true, - 'uchihara' => true, - 'ushiku' => true, - 'yachiyo' => true, - 'yamagata' => true, - 'yawara' => true, - 'yuki' => true - ), - 'ishikawa' => array( - 'anamizu' => true, - 'hakui' => true, - 'hakusan' => true, - 'kaga' => true, - 'kahoku' => true, - 'kanazawa' => true, - 'kawakita' => true, - 'komatsu' => true, - 'nakanoto' => true, - 'nanao' => true, - 'nomi' => true, - 'nonoichi' => true, - 'noto' => true, - 'shika' => true, - 'suzu' => true, - 'tsubata' => true, - 'tsurugi' => true, - 'uchinada' => true, - 'wajima' => true - ), - 'iwate' => array( - 'fudai' => true, - 'fujisawa' => true, - 'hanamaki' => true, - 'hiraizumi' => true, - 'hirono' => true, - 'ichinohe' => true, - 'ichinoseki' => true, - 'iwaizumi' => true, - 'iwate' => true, - 'joboji' => true, - 'kamaishi' => true, - 'kanegasaki' => true, - 'karumai' => true, - 'kawai' => true, - 'kitakami' => true, - 'kuji' => true, - 'kunohe' => true, - 'kuzumaki' => true, - 'miyako' => true, - 'mizusawa' => true, - 'morioka' => true, - 'ninohe' => true, - 'noda' => true, - 'ofunato' => true, - 'oshu' => true, - 'otsuchi' => true, - 'rikuzentakata' => true, - 'shiwa' => true, - 'shizukuishi' => true, - 'sumita' => true, - 'tanohata' => true, - 'tono' => true, - 'yahaba' => true, - 'yamada' => true - ), - 'kagawa' => array( - 'ayagawa' => true, - 'higashikagawa' => true, - 'kanonji' => true, - 'kotohira' => true, - 'manno' => true, - 'marugame' => true, - 'mitoyo' => true, - 'naoshima' => true, - 'sanuki' => true, - 'tadotsu' => true, - 'takamatsu' => true, - 'tonosho' => true, - 'uchinomi' => true, - 'utazu' => true, - 'zentsuji' => true - ), - 'kagoshima' => array( - 'akune' => true, - 'amami' => true, - 'hioki' => true, - 'isa' => true, - 'isen' => true, - 'izumi' => true, - 'kagoshima' => true, - 'kanoya' => true, - 'kawanabe' => true, - 'kinko' => true, - 'kouyama' => true, - 'makurazaki' => true, - 'matsumoto' => true, - 'minamitane' => true, - 'nakatane' => true, - 'nishinoomote' => true, - 'satsumasendai' => true, - 'soo' => true, - 'tarumizu' => true, - 'yusui' => true - ), - 'kanagawa' => array( - 'aikawa' => true, - 'atsugi' => true, - 'ayase' => true, - 'chigasaki' => true, - 'ebina' => true, - 'fujisawa' => true, - 'hadano' => true, - 'hakone' => true, - 'hiratsuka' => true, - 'isehara' => true, - 'kaisei' => true, - 'kamakura' => true, - 'kiyokawa' => true, - 'matsuda' => true, - 'minamiashigara' => true, - 'miura' => true, - 'nakai' => true, - 'ninomiya' => true, - 'odawara' => true, - 'oi' => true, - 'oiso' => true, - 'sagamihara' => true, - 'samukawa' => true, - 'tsukui' => true, - 'yamakita' => true, - 'yamato' => true, - 'yokosuka' => true, - 'yugawara' => true, - 'zama' => true, - 'zushi' => true - ), - 'kochi' => array( - 'aki' => true, - 'geisei' => true, - 'hidaka' => true, - 'higashitsuno' => true, - 'ino' => true, - 'kagami' => true, - 'kami' => true, - 'kitagawa' => true, - 'kochi' => true, - 'mihara' => true, - 'motoyama' => true, - 'muroto' => true, - 'nahari' => true, - 'nakamura' => true, - 'nankoku' => true, - 'nishitosa' => true, - 'niyodogawa' => true, - 'ochi' => true, - 'okawa' => true, - 'otoyo' => true, - 'otsuki' => true, - 'sakawa' => true, - 'sukumo' => true, - 'susaki' => true, - 'tosa' => true, - 'tosashimizu' => true, - 'toyo' => true, - 'tsuno' => true, - 'umaji' => true, - 'yasuda' => true, - 'yusuhara' => true - ), - 'kumamoto' => array( - 'amakusa' => true, - 'arao' => true, - 'aso' => true, - 'choyo' => true, - 'gyokuto' => true, - 'hitoyoshi' => true, - 'kamiamakusa' => true, - 'kashima' => true, - 'kikuchi' => true, - 'kosa' => true, - 'kumamoto' => true, - 'mashiki' => true, - 'mifune' => true, - 'minamata' => true, - 'minamioguni' => true, - 'nagasu' => true, - 'nishihara' => true, - 'oguni' => true, - 'ozu' => true, - 'sumoto' => true, - 'takamori' => true, - 'uki' => true, - 'uto' => true, - 'yamaga' => true, - 'yamato' => true, - 'yatsushiro' => true - ), - 'kyoto' => array( - 'ayabe' => true, - 'fukuchiyama' => true, - 'higashiyama' => true, - 'ide' => true, - 'ine' => true, - 'joyo' => true, - 'kameoka' => true, - 'kamo' => true, - 'kita' => true, - 'kizu' => true, - 'kumiyama' => true, - 'kyotamba' => true, - 'kyotanabe' => true, - 'kyotango' => true, - 'maizuru' => true, - 'minami' => true, - 'minamiyamashiro' => true, - 'miyazu' => true, - 'muko' => true, - 'nagaokakyo' => true, - 'nakagyo' => true, - 'nantan' => true, - 'oyamazaki' => true, - 'sakyo' => true, - 'seika' => true, - 'tanabe' => true, - 'uji' => true, - 'ujitawara' => true, - 'wazuka' => true, - 'yamashina' => true, - 'yawata' => true - ), - 'mie' => array( - 'asahi' => true, - 'inabe' => true, - 'ise' => true, - 'kameyama' => true, - 'kawagoe' => true, - 'kiho' => true, - 'kisosaki' => true, - 'kiwa' => true, - 'komono' => true, - 'kumano' => true, - 'kuwana' => true, - 'matsusaka' => true, - 'meiwa' => true, - 'mihama' => true, - 'minamiise' => true, - 'misugi' => true, - 'miyama' => true, - 'nabari' => true, - 'shima' => true, - 'suzuka' => true, - 'tado' => true, - 'taiki' => true, - 'taki' => true, - 'tamaki' => true, - 'toba' => true, - 'tsu' => true, - 'udono' => true, - 'ureshino' => true, - 'watarai' => true, - 'yokkaichi' => true - ), - 'miyagi' => array( - 'furukawa' => true, - 'higashimatsushima' => true, - 'ishinomaki' => true, - 'iwanuma' => true, - 'kakuda' => true, - 'kami' => true, - 'kawasaki' => true, - 'kesennuma' => true, - 'marumori' => true, - 'matsushima' => true, - 'minamisanriku' => true, - 'misato' => true, - 'murata' => true, - 'natori' => true, - 'ogawara' => true, - 'ohira' => true, - 'onagawa' => true, - 'osaki' => true, - 'rifu' => true, - 'semine' => true, - 'shibata' => true, - 'shichikashuku' => true, - 'shikama' => true, - 'shiogama' => true, - 'shiroishi' => true, - 'tagajo' => true, - 'taiwa' => true, - 'tome' => true, - 'tomiya' => true, - 'wakuya' => true, - 'watari' => true, - 'yamamoto' => true, - 'zao' => true - ), - 'miyazaki' => array( - 'aya' => true, - 'ebino' => true, - 'gokase' => true, - 'hyuga' => true, - 'kadogawa' => true, - 'kawaminami' => true, - 'kijo' => true, - 'kitagawa' => true, - 'kitakata' => true, - 'kitaura' => true, - 'kobayashi' => true, - 'kunitomi' => true, - 'kushima' => true, - 'mimata' => true, - 'miyakonojo' => true, - 'miyazaki' => true, - 'morotsuka' => true, - 'nichinan' => true, - 'nishimera' => true, - 'nobeoka' => true, - 'saito' => true, - 'shiiba' => true, - 'shintomi' => true, - 'takaharu' => true, - 'takanabe' => true, - 'takazaki' => true, - 'tsuno' => true - ), - 'nagano' => array( - 'achi' => true, - 'agematsu' => true, - 'anan' => true, - 'aoki' => true, - 'asahi' => true, - 'azumino' => true, - 'chikuhoku' => true, - 'chikuma' => true, - 'chino' => true, - 'fujimi' => true, - 'hakuba' => true, - 'hara' => true, - 'hiraya' => true, - 'iida' => true, - 'iijima' => true, - 'iiyama' => true, - 'iizuna' => true, - 'ikeda' => true, - 'ikusaka' => true, - 'ina' => true, - 'karuizawa' => true, - 'kawakami' => true, - 'kiso' => true, - 'kisofukushima' => true, - 'kitaaiki' => true, - 'komagane' => true, - 'komoro' => true, - 'matsukawa' => true, - 'matsumoto' => true, - 'miasa' => true, - 'minamiaiki' => true, - 'minamimaki' => true, - 'minamiminowa' => true, - 'minowa' => true, - 'miyada' => true, - 'miyota' => true, - 'mochizuki' => true, - 'nagano' => true, - 'nagawa' => true, - 'nagiso' => true, - 'nakagawa' => true, - 'nakano' => true, - 'nozawaonsen' => true, - 'obuse' => true, - 'ogawa' => true, - 'okaya' => true, - 'omachi' => true, - 'omi' => true, - 'ookuwa' => true, - 'ooshika' => true, - 'otaki' => true, - 'otari' => true, - 'sakae' => true, - 'sakaki' => true, - 'saku' => true, - 'sakuho' => true, - 'shimosuwa' => true, - 'shinanomachi' => true, - 'shiojiri' => true, - 'suwa' => true, - 'suzaka' => true, - 'takagi' => true, - 'takamori' => true, - 'takayama' => true, - 'tateshina' => true, - 'tatsuno' => true, - 'togakushi' => true, - 'togura' => true, - 'tomi' => true, - 'ueda' => true, - 'wada' => true, - 'yamagata' => true, - 'yamanouchi' => true, - 'yasaka' => true, - 'yasuoka' => true - ), - 'nagasaki' => array( - 'chijiwa' => true, - 'futsu' => true, - 'goto' => true, - 'hasami' => true, - 'hirado' => true, - 'iki' => true, - 'isahaya' => true, - 'kawatana' => true, - 'kuchinotsu' => true, - 'matsuura' => true, - 'nagasaki' => true, - 'obama' => true, - 'omura' => true, - 'oseto' => true, - 'saikai' => true, - 'sasebo' => true, - 'seihi' => true, - 'shimabara' => true, - 'shinkamigoto' => true, - 'togitsu' => true, - 'tsushima' => true, - 'unzen' => true - ), - 'nara' => array( - 'ando' => true, - 'gose' => true, - 'heguri' => true, - 'higashiyoshino' => true, - 'ikaruga' => true, - 'ikoma' => true, - 'kamikitayama' => true, - 'kanmaki' => true, - 'kashiba' => true, - 'kashihara' => true, - 'katsuragi' => true, - 'kawai' => true, - 'kawakami' => true, - 'kawanishi' => true, - 'koryo' => true, - 'kurotaki' => true, - 'mitsue' => true, - 'miyake' => true, - 'nara' => true, - 'nosegawa' => true, - 'oji' => true, - 'ouda' => true, - 'oyodo' => true, - 'sakurai' => true, - 'sango' => true, - 'shimoichi' => true, - 'shimokitayama' => true, - 'shinjo' => true, - 'soni' => true, - 'takatori' => true, - 'tawaramoto' => true, - 'tenkawa' => true, - 'tenri' => true, - 'uda' => true, - 'yamatokoriyama' => true, - 'yamatotakada' => true, - 'yamazoe' => true, - 'yoshino' => true - ), - 'niigata' => array( - 'aga' => true, - 'agano' => true, - 'gosen' => true, - 'itoigawa' => true, - 'izumozaki' => true, - 'joetsu' => true, - 'kamo' => true, - 'kariwa' => true, - 'kashiwazaki' => true, - 'minamiuonuma' => true, - 'mitsuke' => true, - 'muika' => true, - 'murakami' => true, - 'myoko' => true, - 'nagaoka' => true, - 'niigata' => true, - 'ojiya' => true, - 'omi' => true, - 'sado' => true, - 'sanjo' => true, - 'seiro' => true, - 'seirou' => true, - 'sekikawa' => true, - 'shibata' => true, - 'tagami' => true, - 'tainai' => true, - 'tochio' => true, - 'tokamachi' => true, - 'tsubame' => true, - 'tsunan' => true, - 'uonuma' => true, - 'yahiko' => true, - 'yoita' => true, - 'yuzawa' => true - ), - 'oita' => array( - 'beppu' => true, - 'bungoono' => true, - 'bungotakada' => true, - 'hasama' => true, - 'hiji' => true, - 'himeshima' => true, - 'hita' => true, - 'kamitsue' => true, - 'kokonoe' => true, - 'kuju' => true, - 'kunisaki' => true, - 'kusu' => true, - 'oita' => true, - 'saiki' => true, - 'taketa' => true, - 'tsukumi' => true, - 'usa' => true, - 'usuki' => true, - 'yufu' => true - ), - 'okayama' => array( - 'akaiwa' => true, - 'asakuchi' => true, - 'bizen' => true, - 'hayashima' => true, - 'ibara' => true, - 'kagamino' => true, - 'kasaoka' => true, - 'kibichuo' => true, - 'kumenan' => true, - 'kurashiki' => true, - 'maniwa' => true, - 'misaki' => true, - 'nagi' => true, - 'niimi' => true, - 'nishiawakura' => true, - 'okayama' => true, - 'satosho' => true, - 'setouchi' => true, - 'shinjo' => true, - 'shoo' => true, - 'soja' => true, - 'takahashi' => true, - 'tamano' => true, - 'tsuyama' => true, - 'wake' => true, - 'yakage' => true - ), - 'okinawa' => array( - 'aguni' => true, - 'ginowan' => true, - 'ginoza' => true, - 'gushikami' => true, - 'haebaru' => true, - 'higashi' => true, - 'hirara' => true, - 'iheya' => true, - 'ishigaki' => true, - 'ishikawa' => true, - 'itoman' => true, - 'izena' => true, - 'kadena' => true, - 'kin' => true, - 'kitadaito' => true, - 'kitanakagusuku' => true, - 'kumejima' => true, - 'kunigami' => true, - 'minamidaito' => true, - 'motobu' => true, - 'nago' => true, - 'naha' => true, - 'nakagusuku' => true, - 'nakijin' => true, - 'nanjo' => true, - 'nishihara' => true, - 'ogimi' => true, - 'okinawa' => true, - 'onna' => true, - 'shimoji' => true, - 'taketomi' => true, - 'tarama' => true, - 'tokashiki' => true, - 'tomigusuku' => true, - 'tonaki' => true, - 'urasoe' => true, - 'uruma' => true, - 'yaese' => true, - 'yomitan' => true, - 'yonabaru' => true, - 'yonaguni' => true, - 'zamami' => true - ), - 'osaka' => array( - 'abeno' => true, - 'chihayaakasaka' => true, - 'chuo' => true, - 'daito' => true, - 'fujiidera' => true, - 'habikino' => true, - 'hannan' => true, - 'higashiosaka' => true, - 'higashisumiyoshi' => true, - 'higashiyodogawa' => true, - 'hirakata' => true, - 'ibaraki' => true, - 'ikeda' => true, - 'izumi' => true, - 'izumiotsu' => true, - 'izumisano' => true, - 'kadoma' => true, - 'kaizuka' => true, - 'kanan' => true, - 'kashiwara' => true, - 'katano' => true, - 'kawachinagano' => true, - 'kishiwada' => true, - 'kita' => true, - 'kumatori' => true, - 'matsubara' => true, - 'minato' => true, - 'minoh' => true, - 'misaki' => true, - 'moriguchi' => true, - 'neyagawa' => true, - 'nishi' => true, - 'nose' => true, - 'osakasayama' => true, - 'sakai' => true, - 'sayama' => true, - 'sennan' => true, - 'settsu' => true, - 'shijonawate' => true, - 'shimamoto' => true, - 'suita' => true, - 'tadaoka' => true, - 'taishi' => true, - 'tajiri' => true, - 'takaishi' => true, - 'takatsuki' => true, - 'tondabayashi' => true, - 'toyonaka' => true, - 'toyono' => true, - 'yao' => true - ), - 'saga' => array( - 'ariake' => true, - 'arita' => true, - 'fukudomi' => true, - 'genkai' => true, - 'hamatama' => true, - 'hizen' => true, - 'imari' => true, - 'kamimine' => true, - 'kanzaki' => true, - 'karatsu' => true, - 'kashima' => true, - 'kitagata' => true, - 'kitahata' => true, - 'kiyama' => true, - 'kouhoku' => true, - 'kyuragi' => true, - 'nishiarita' => true, - 'ogi' => true, - 'omachi' => true, - 'ouchi' => true, - 'saga' => true, - 'shiroishi' => true, - 'taku' => true, - 'tara' => true, - 'tosu' => true, - 'yoshinogari' => true - ), - 'saitama' => array( - 'arakawa' => true, - 'asaka' => true, - 'chichibu' => true, - 'fujimi' => true, - 'fujimino' => true, - 'fukaya' => true, - 'hanno' => true, - 'hanyu' => true, - 'hasuda' => true, - 'hatogaya' => true, - 'hatoyama' => true, - 'hidaka' => true, - 'higashichichibu' => true, - 'higashimatsuyama' => true, - 'honjo' => true, - 'ina' => true, - 'iruma' => true, - 'iwatsuki' => true, - 'kamiizumi' => true, - 'kamikawa' => true, - 'kamisato' => true, - 'kasukabe' => true, - 'kawagoe' => true, - 'kawaguchi' => true, - 'kawajima' => true, - 'kazo' => true, - 'kitamoto' => true, - 'koshigaya' => true, - 'kounosu' => true, - 'kuki' => true, - 'kumagaya' => true, - 'matsubushi' => true, - 'minano' => true, - 'misato' => true, - 'miyashiro' => true, - 'miyoshi' => true, - 'moroyama' => true, - 'nagatoro' => true, - 'namegawa' => true, - 'niiza' => true, - 'ogano' => true, - 'ogawa' => true, - 'ogose' => true, - 'okegawa' => true, - 'omiya' => true, - 'otaki' => true, - 'ranzan' => true, - 'ryokami' => true, - 'saitama' => true, - 'sakado' => true, - 'satte' => true, - 'sayama' => true, - 'shiki' => true, - 'shiraoka' => true, - 'soka' => true, - 'sugito' => true, - 'toda' => true, - 'tokigawa' => true, - 'tokorozawa' => true, - 'tsurugashima' => true, - 'urawa' => true, - 'warabi' => true, - 'yashio' => true, - 'yokoze' => true, - 'yono' => true, - 'yorii' => true, - 'yoshida' => true, - 'yoshikawa' => true, - 'yoshimi' => true - ), - 'shiga' => array( - 'aisho' => true, - 'gamo' => true, - 'higashiomi' => true, - 'hikone' => true, - 'koka' => true, - 'konan' => true, - 'kosei' => true, - 'koto' => true, - 'kusatsu' => true, - 'maibara' => true, - 'moriyama' => true, - 'nagahama' => true, - 'nishiazai' => true, - 'notogawa' => true, - 'omihachiman' => true, - 'otsu' => true, - 'ritto' => true, - 'ryuoh' => true, - 'takashima' => true, - 'takatsuki' => true, - 'torahime' => true, - 'toyosato' => true, - 'yasu' => true - ), - 'shimane' => array( - 'akagi' => true, - 'ama' => true, - 'gotsu' => true, - 'hamada' => true, - 'higashiizumo' => true, - 'hikawa' => true, - 'hikimi' => true, - 'izumo' => true, - 'kakinoki' => true, - 'masuda' => true, - 'matsue' => true, - 'misato' => true, - 'nishinoshima' => true, - 'ohda' => true, - 'okinoshima' => true, - 'okuizumo' => true, - 'shimane' => true, - 'tamayu' => true, - 'tsuwano' => true, - 'unnan' => true, - 'yakumo' => true, - 'yasugi' => true, - 'yatsuka' => true - ), - 'shizuoka' => array( - 'arai' => true, - 'atami' => true, - 'fuji' => true, - 'fujieda' => true, - 'fujikawa' => true, - 'fujinomiya' => true, - 'fukuroi' => true, - 'gotemba' => true, - 'haibara' => true, - 'hamamatsu' => true, - 'higashiizu' => true, - 'ito' => true, - 'iwata' => true, - 'izu' => true, - 'izunokuni' => true, - 'kakegawa' => true, - 'kannami' => true, - 'kawanehon' => true, - 'kawazu' => true, - 'kikugawa' => true, - 'kosai' => true, - 'makinohara' => true, - 'matsuzaki' => true, - 'minamiizu' => true, - 'mishima' => true, - 'morimachi' => true, - 'nishiizu' => true, - 'numazu' => true, - 'omaezaki' => true, - 'shimada' => true, - 'shimizu' => true, - 'shimoda' => true, - 'shizuoka' => true, - 'susono' => true, - 'yaizu' => true, - 'yoshida' => true - ), - 'tochigi' => array( - 'ashikaga' => true, - 'bato' => true, - 'haga' => true, - 'ichikai' => true, - 'iwafune' => true, - 'kaminokawa' => true, - 'kanuma' => true, - 'karasuyama' => true, - 'kuroiso' => true, - 'mashiko' => true, - 'mibu' => true, - 'moka' => true, - 'motegi' => true, - 'nasu' => true, - 'nasushiobara' => true, - 'nikko' => true, - 'nishikata' => true, - 'nogi' => true, - 'ohira' => true, - 'ohtawara' => true, - 'oyama' => true, - 'sakura' => true, - 'sano' => true, - 'shimotsuke' => true, - 'shioya' => true, - 'takanezawa' => true, - 'tochigi' => true, - 'tsuga' => true, - 'ujiie' => true, - 'utsunomiya' => true, - 'yaita' => true - ), - 'tokushima' => array( - 'aizumi' => true, - 'anan' => true, - 'ichiba' => true, - 'itano' => true, - 'kainan' => true, - 'komatsushima' => true, - 'matsushige' => true, - 'mima' => true, - 'minami' => true, - 'miyoshi' => true, - 'mugi' => true, - 'nakagawa' => true, - 'naruto' => true, - 'sanagochi' => true, - 'shishikui' => true, - 'tokushima' => true, - 'wajiki' => true - ), - 'tokyo' => array( - 'adachi' => true, - 'akiruno' => true, - 'akishima' => true, - 'aogashima' => true, - 'arakawa' => true, - 'bunkyo' => true, - 'chiyoda' => true, - 'chofu' => true, - 'chuo' => true, - 'edogawa' => true, - 'fuchu' => true, - 'fussa' => true, - 'hachijo' => true, - 'hachioji' => true, - 'hamura' => true, - 'higashikurume' => true, - 'higashimurayama' => true, - 'higashiyamato' => true, - 'hino' => true, - 'hinode' => true, - 'hinohara' => true, - 'inagi' => true, - 'itabashi' => true, - 'katsushika' => true, - 'kita' => true, - 'kiyose' => true, - 'kodaira' => true, - 'koganei' => true, - 'kokubunji' => true, - 'komae' => true, - 'koto' => true, - 'kouzushima' => true, - 'kunitachi' => true, - 'machida' => true, - 'meguro' => true, - 'minato' => true, - 'mitaka' => true, - 'mizuho' => true, - 'musashimurayama' => true, - 'musashino' => true, - 'nakano' => true, - 'nerima' => true, - 'ogasawara' => true, - 'okutama' => true, - 'ome' => true, - 'oshima' => true, - 'ota' => true, - 'setagaya' => true, - 'shibuya' => true, - 'shinagawa' => true, - 'shinjuku' => true, - 'suginami' => true, - 'sumida' => true, - 'tachikawa' => true, - 'taito' => true, - 'tama' => true, - 'toshima' => true - ), - 'tottori' => array( - 'chizu' => true, - 'hino' => true, - 'kawahara' => true, - 'koge' => true, - 'kotoura' => true, - 'misasa' => true, - 'nanbu' => true, - 'nichinan' => true, - 'sakaiminato' => true, - 'tottori' => true, - 'wakasa' => true, - 'yazu' => true, - 'yonago' => true - ), - 'toyama' => array( - 'asahi' => true, - 'fuchu' => true, - 'fukumitsu' => true, - 'funahashi' => true, - 'himi' => true, - 'imizu' => true, - 'inami' => true, - 'johana' => true, - 'kamiichi' => true, - 'kurobe' => true, - 'nakaniikawa' => true, - 'namerikawa' => true, - 'nanto' => true, - 'nyuzen' => true, - 'oyabe' => true, - 'taira' => true, - 'takaoka' => true, - 'tateyama' => true, - 'toga' => true, - 'tonami' => true, - 'toyama' => true, - 'unazuki' => true, - 'uozu' => true, - 'yamada' => true - ), - 'wakayama' => array( - 'arida' => true, - 'aridagawa' => true, - 'gobo' => true, - 'hashimoto' => true, - 'hidaka' => true, - 'hirogawa' => true, - 'inami' => true, - 'iwade' => true, - 'kainan' => true, - 'kamitonda' => true, - 'katsuragi' => true, - 'kimino' => true, - 'kinokawa' => true, - 'kitayama' => true, - 'koya' => true, - 'koza' => true, - 'kozagawa' => true, - 'kudoyama' => true, - 'kushimoto' => true, - 'mihama' => true, - 'misato' => true, - 'nachikatsuura' => true, - 'shingu' => true, - 'shirahama' => true, - 'taiji' => true, - 'tanabe' => true, - 'wakayama' => true, - 'yuasa' => true, - 'yura' => true - ), - 'yamagata' => array( - 'asahi' => true, - 'funagata' => true, - 'higashine' => true, - 'iide' => true, - 'kahoku' => true, - 'kaminoyama' => true, - 'kaneyama' => true, - 'kawanishi' => true, - 'mamurogawa' => true, - 'mikawa' => true, - 'murayama' => true, - 'nagai' => true, - 'nakayama' => true, - 'nanyo' => true, - 'nishikawa' => true, - 'obanazawa' => true, - 'oe' => true, - 'oguni' => true, - 'ohkura' => true, - 'oishida' => true, - 'sagae' => true, - 'sakata' => true, - 'sakegawa' => true, - 'shinjo' => true, - 'shirataka' => true, - 'shonai' => true, - 'takahata' => true, - 'tendo' => true, - 'tozawa' => true, - 'tsuruoka' => true, - 'yamagata' => true, - 'yamanobe' => true, - 'yonezawa' => true, - 'yuza' => true - ), - 'yamaguchi' => array( - 'abu' => true, - 'hagi' => true, - 'hikari' => true, - 'hofu' => true, - 'iwakuni' => true, - 'kudamatsu' => true, - 'mitou' => true, - 'nagato' => true, - 'oshima' => true, - 'shimonoseki' => true, - 'shunan' => true, - 'tabuse' => true, - 'tokuyama' => true, - 'toyota' => true, - 'ube' => true, - 'yuu' => true - ), - 'yamanashi' => array( - 'chuo' => true, - 'doshi' => true, - 'fuefuki' => true, - 'fujikawa' => true, - 'fujikawaguchiko' => true, - 'fujiyoshida' => true, - 'hayakawa' => true, - 'hokuto' => true, - 'ichikawamisato' => true, - 'kai' => true, - 'kofu' => true, - 'koshu' => true, - 'kosuge' => true, - 'minami-alps' => true, - 'minobu' => true, - 'nakamichi' => true, - 'nanbu' => true, - 'narusawa' => true, - 'nirasaki' => true, - 'nishikatsura' => true, - 'oshino' => true, - 'otsuki' => true, - 'showa' => true, - 'tabayama' => true, - 'tsuru' => true, - 'uenohara' => true, - 'yamanakako' => true, - 'yamanashi' => true - ), - '栃木' => true, - '愛知' => true, - '愛媛' => true, - '兵庫' => true, - '熊本' => true, - '茨城' => true, - '北海道' => true, - '千葉' => true, - '和歌山' => true, - '長崎' => true, - '長野' => true, - '新潟' => true, - '青森' => true, - '静岡' => true, - '東京' => true, - '石川' => true, - '埼玉' => true, - '三重' => true, - '京都' => true, - '佐賀' => true, - '大分' => true, - '大阪' => true, - '奈良' => true, - '宮城' => true, - '宮崎' => true, - '富山' => true, - '山口' => true, - '山形' => true, - '山梨' => true, - '岩手' => true, - '岐阜' => true, - '岡山' => true, - '島根' => true, - '広島' => true, - '徳島' => true, - '沖縄' => true, - '滋賀' => true, - '神奈川' => true, - '福井' => true, - '福岡' => true, - '福島' => true, - '秋田' => true, - '群馬' => true, - '香川' => true, - '高知' => true, - '鳥取' => true, - '鹿児島' => true, - 'kawasaki' => array( - '*' => true, - '!city' => true - ), - 'kitakyushu' => array( - '*' => true, - '!city' => true - ), - 'kobe' => array( - '*' => true, - '!city' => true - ), - 'nagoya' => array( - '*' => true, - '!city' => true - ), - 'sapporo' => array( - '*' => true, - '!city' => true - ), - 'sendai' => array( - '*' => true, - '!city' => true - ), - 'yokohama' => array( - '*' => true, - '!city' => true - ), - 'blogspot' => true - ), - 'ke' => array( - '*' => true, - 'co' => array( - 'blogspot' => true - ) - ), - 'kg' => array( - 'org' => true, - 'net' => true, - 'com' => true, - 'edu' => true, - 'gov' => true, - 'mil' => true - ), - 'kh' => array( - '*' => true - ), - 'ki' => array( - 'edu' => true, - 'biz' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'info' => true, - 'com' => true - ), - 'km' => array( - 'org' => true, - 'nom' => true, - 'gov' => true, - 'prd' => true, - 'tm' => true, - 'edu' => true, - 'mil' => true, - 'ass' => true, - 'com' => true, - 'coop' => true, - 'asso' => true, - 'presse' => true, - 'medecin' => true, - 'notaires' => true, - 'pharmaciens' => true, - 'veterinaire' => true, - 'gouv' => true - ), - 'kn' => array( - 'net' => true, - 'org' => true, - 'edu' => true, - 'gov' => true - ), - 'kp' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'org' => true, - 'rep' => true, - 'tra' => true - ), - 'kr' => array( - 'ac' => true, - 'co' => true, - 'es' => true, - 'go' => true, - 'hs' => true, - 'kg' => true, - 'mil' => true, - 'ms' => true, - 'ne' => true, - 'or' => true, - 'pe' => true, - 're' => true, - 'sc' => true, - 'busan' => true, - 'chungbuk' => true, - 'chungnam' => true, - 'daegu' => true, - 'daejeon' => true, - 'gangwon' => true, - 'gwangju' => true, - 'gyeongbuk' => true, - 'gyeonggi' => true, - 'gyeongnam' => true, - 'incheon' => true, - 'jeju' => true, - 'jeonbuk' => true, - 'jeonnam' => true, - 'seoul' => true, - 'ulsan' => true, - 'blogspot' => true - ), - 'kw' => array( - '*' => true - ), - 'ky' => array( - 'edu' => true, - 'gov' => true, - 'com' => true, - 'org' => true, - 'net' => true - ), - 'kz' => array( - 'org' => true, - 'edu' => true, - 'net' => true, - 'gov' => true, - 'mil' => true, - 'com' => true - ), - 'la' => array( - 'int' => true, - 'net' => true, - 'info' => true, - 'edu' => true, - 'gov' => true, - 'per' => true, - 'com' => true, - 'org' => true, - 'c' => true - ), - 'lb' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'net' => true, - 'org' => true - ), - 'lc' => array( - 'com' => true, - 'net' => true, - 'co' => true, - 'org' => true, - 'edu' => true, - 'gov' => true - ), - 'li' => array( - 'blogspot' => true - ), - 'lk' => array( - 'gov' => true, - 'sch' => true, - 'net' => true, - 'int' => true, - 'com' => true, - 'org' => true, - 'edu' => true, - 'ngo' => true, - 'soc' => true, - 'web' => true, - 'ltd' => true, - 'assn' => true, - 'grp' => true, - 'hotel' => true, - 'ac' => true - ), - 'lr' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'org' => true, - 'net' => true - ), - 'ls' => array( - 'co' => true, - 'org' => true - ), - 'lt' => array( - 'gov' => true, - 'blogspot' => true - ), - 'lu' => array( - 'blogspot' => true - ), - 'lv' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'org' => true, - 'mil' => true, - 'id' => true, - 'net' => true, - 'asn' => true, - 'conf' => true - ), - 'ly' => array( - 'com' => true, - 'net' => true, - 'gov' => true, - 'plc' => true, - 'edu' => true, - 'sch' => true, - 'med' => true, - 'org' => true, - 'id' => true - ), - 'ma' => array( - 'co' => true, - 'net' => true, - 'gov' => true, - 'org' => true, - 'ac' => true, - 'press' => true - ), - 'mc' => array( - 'tm' => true, - 'asso' => true - ), - 'md' => array( - 'blogspot' => true - ), - 'me' => array( - 'co' => true, - 'net' => true, - 'org' => true, - 'edu' => true, - 'ac' => true, - 'gov' => true, - 'its' => true, - 'priv' => true, - 'diskstation' => true, - 'dscloud' => true, - 'i234' => true, - 'myds' => true, - 'synology' => true - ), - 'mg' => array( - 'org' => true, - 'nom' => true, - 'gov' => true, - 'prd' => true, - 'tm' => true, - 'edu' => true, - 'mil' => true, - 'com' => true, - 'co' => true - ), - 'mh' => true, - 'mil' => true, - 'mk' => array( - 'com' => true, - 'org' => true, - 'net' => true, - 'edu' => true, - 'gov' => true, - 'inf' => true, - 'name' => true, - 'blogspot' => true - ), - 'ml' => array( - 'com' => true, - 'edu' => true, - 'gouv' => true, - 'gov' => true, - 'net' => true, - 'org' => true, - 'presse' => true - ), - 'mm' => array( - '*' => true - ), - 'mn' => array( - 'gov' => true, - 'edu' => true, - 'org' => true, - 'nyc' => true - ), - 'mo' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'edu' => true, - 'gov' => true - ), - 'mobi' => array( - 'dscloud' => true - ), - 'mp' => true, - 'mq' => true, - 'mr' => array( - 'gov' => true, - 'blogspot' => true - ), - 'ms' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'net' => true, - 'org' => true - ), - 'mt' => array( - 'com' => array( - 'blogspot' => true - ), - 'edu' => true, - 'net' => true, - 'org' => true - ), - 'mu' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'ac' => true, - 'co' => true, - 'or' => true - ), - 'museum' => array( - 'academy' => true, - 'agriculture' => true, - 'air' => true, - 'airguard' => true, - 'alabama' => true, - 'alaska' => true, - 'amber' => true, - 'ambulance' => true, - 'american' => true, - 'americana' => true, - 'americanantiques' => true, - 'americanart' => true, - 'amsterdam' => true, - 'and' => true, - 'annefrank' => true, - 'anthro' => true, - 'anthropology' => true, - 'antiques' => true, - 'aquarium' => true, - 'arboretum' => true, - 'archaeological' => true, - 'archaeology' => true, - 'architecture' => true, - 'art' => true, - 'artanddesign' => true, - 'artcenter' => true, - 'artdeco' => true, - 'arteducation' => true, - 'artgallery' => true, - 'arts' => true, - 'artsandcrafts' => true, - 'asmatart' => true, - 'assassination' => true, - 'assisi' => true, - 'association' => true, - 'astronomy' => true, - 'atlanta' => true, - 'austin' => true, - 'australia' => true, - 'automotive' => true, - 'aviation' => true, - 'axis' => true, - 'badajoz' => true, - 'baghdad' => true, - 'bahn' => true, - 'bale' => true, - 'baltimore' => true, - 'barcelona' => true, - 'baseball' => true, - 'basel' => true, - 'baths' => true, - 'bauern' => true, - 'beauxarts' => true, - 'beeldengeluid' => true, - 'bellevue' => true, - 'bergbau' => true, - 'berkeley' => true, - 'berlin' => true, - 'bern' => true, - 'bible' => true, - 'bilbao' => true, - 'bill' => true, - 'birdart' => true, - 'birthplace' => true, - 'bonn' => true, - 'boston' => true, - 'botanical' => true, - 'botanicalgarden' => true, - 'botanicgarden' => true, - 'botany' => true, - 'brandywinevalley' => true, - 'brasil' => true, - 'bristol' => true, - 'british' => true, - 'britishcolumbia' => true, - 'broadcast' => true, - 'brunel' => true, - 'brussel' => true, - 'brussels' => true, - 'bruxelles' => true, - 'building' => true, - 'burghof' => true, - 'bus' => true, - 'bushey' => true, - 'cadaques' => true, - 'california' => true, - 'cambridge' => true, - 'can' => true, - 'canada' => true, - 'capebreton' => true, - 'carrier' => true, - 'cartoonart' => true, - 'casadelamoneda' => true, - 'castle' => true, - 'castres' => true, - 'celtic' => true, - 'center' => true, - 'chattanooga' => true, - 'cheltenham' => true, - 'chesapeakebay' => true, - 'chicago' => true, - 'children' => true, - 'childrens' => true, - 'childrensgarden' => true, - 'chiropractic' => true, - 'chocolate' => true, - 'christiansburg' => true, - 'cincinnati' => true, - 'cinema' => true, - 'circus' => true, - 'civilisation' => true, - 'civilization' => true, - 'civilwar' => true, - 'clinton' => true, - 'clock' => true, - 'coal' => true, - 'coastaldefence' => true, - 'cody' => true, - 'coldwar' => true, - 'collection' => true, - 'colonialwilliamsburg' => true, - 'coloradoplateau' => true, - 'columbia' => true, - 'columbus' => true, - 'communication' => true, - 'communications' => true, - 'community' => true, - 'computer' => true, - 'computerhistory' => true, - 'comunicações' => true, - 'contemporary' => true, - 'contemporaryart' => true, - 'convent' => true, - 'copenhagen' => true, - 'corporation' => true, - 'correios-e-telecomunicações' => true, - 'corvette' => true, - 'costume' => true, - 'countryestate' => true, - 'county' => true, - 'crafts' => true, - 'cranbrook' => true, - 'creation' => true, - 'cultural' => true, - 'culturalcenter' => true, - 'culture' => true, - 'cyber' => true, - 'cymru' => true, - 'dali' => true, - 'dallas' => true, - 'database' => true, - 'ddr' => true, - 'decorativearts' => true, - 'delaware' => true, - 'delmenhorst' => true, - 'denmark' => true, - 'depot' => true, - 'design' => true, - 'detroit' => true, - 'dinosaur' => true, - 'discovery' => true, - 'dolls' => true, - 'donostia' => true, - 'durham' => true, - 'eastafrica' => true, - 'eastcoast' => true, - 'education' => true, - 'educational' => true, - 'egyptian' => true, - 'eisenbahn' => true, - 'elburg' => true, - 'elvendrell' => true, - 'embroidery' => true, - 'encyclopedic' => true, - 'england' => true, - 'entomology' => true, - 'environment' => true, - 'environmentalconservation' => true, - 'epilepsy' => true, - 'essex' => true, - 'estate' => true, - 'ethnology' => true, - 'exeter' => true, - 'exhibition' => true, - 'family' => true, - 'farm' => true, - 'farmequipment' => true, - 'farmers' => true, - 'farmstead' => true, - 'field' => true, - 'figueres' => true, - 'filatelia' => true, - 'film' => true, - 'fineart' => true, - 'finearts' => true, - 'finland' => true, - 'flanders' => true, - 'florida' => true, - 'force' => true, - 'fortmissoula' => true, - 'fortworth' => true, - 'foundation' => true, - 'francaise' => true, - 'frankfurt' => true, - 'franziskaner' => true, - 'freemasonry' => true, - 'freiburg' => true, - 'fribourg' => true, - 'frog' => true, - 'fundacio' => true, - 'furniture' => true, - 'gallery' => true, - 'garden' => true, - 'gateway' => true, - 'geelvinck' => true, - 'gemological' => true, - 'geology' => true, - 'georgia' => true, - 'giessen' => true, - 'glas' => true, - 'glass' => true, - 'gorge' => true, - 'grandrapids' => true, - 'graz' => true, - 'guernsey' => true, - 'halloffame' => true, - 'hamburg' => true, - 'handson' => true, - 'harvestcelebration' => true, - 'hawaii' => true, - 'health' => true, - 'heimatunduhren' => true, - 'hellas' => true, - 'helsinki' => true, - 'hembygdsforbund' => true, - 'heritage' => true, - 'histoire' => true, - 'historical' => true, - 'historicalsociety' => true, - 'historichouses' => true, - 'historisch' => true, - 'historisches' => true, - 'history' => true, - 'historyofscience' => true, - 'horology' => true, - 'house' => true, - 'humanities' => true, - 'illustration' => true, - 'imageandsound' => true, - 'indian' => true, - 'indiana' => true, - 'indianapolis' => true, - 'indianmarket' => true, - 'intelligence' => true, - 'interactive' => true, - 'iraq' => true, - 'iron' => true, - 'isleofman' => true, - 'jamison' => true, - 'jefferson' => true, - 'jerusalem' => true, - 'jewelry' => true, - 'jewish' => true, - 'jewishart' => true, - 'jfk' => true, - 'journalism' => true, - 'judaica' => true, - 'judygarland' => true, - 'juedisches' => true, - 'juif' => true, - 'karate' => true, - 'karikatur' => true, - 'kids' => true, - 'koebenhavn' => true, - 'koeln' => true, - 'kunst' => true, - 'kunstsammlung' => true, - 'kunstunddesign' => true, - 'labor' => true, - 'labour' => true, - 'lajolla' => true, - 'lancashire' => true, - 'landes' => true, - 'lans' => true, - 'läns' => true, - 'larsson' => true, - 'lewismiller' => true, - 'lincoln' => true, - 'linz' => true, - 'living' => true, - 'livinghistory' => true, - 'localhistory' => true, - 'london' => true, - 'losangeles' => true, - 'louvre' => true, - 'loyalist' => true, - 'lucerne' => true, - 'luxembourg' => true, - 'luzern' => true, - 'mad' => true, - 'madrid' => true, - 'mallorca' => true, - 'manchester' => true, - 'mansion' => true, - 'mansions' => true, - 'manx' => true, - 'marburg' => true, - 'maritime' => true, - 'maritimo' => true, - 'maryland' => true, - 'marylhurst' => true, - 'media' => true, - 'medical' => true, - 'medizinhistorisches' => true, - 'meeres' => true, - 'memorial' => true, - 'mesaverde' => true, - 'michigan' => true, - 'midatlantic' => true, - 'military' => true, - 'mill' => true, - 'miners' => true, - 'mining' => true, - 'minnesota' => true, - 'missile' => true, - 'missoula' => true, - 'modern' => true, - 'moma' => true, - 'money' => true, - 'monmouth' => true, - 'monticello' => true, - 'montreal' => true, - 'moscow' => true, - 'motorcycle' => true, - 'muenchen' => true, - 'muenster' => true, - 'mulhouse' => true, - 'muncie' => true, - 'museet' => true, - 'museumcenter' => true, - 'museumvereniging' => true, - 'music' => true, - 'national' => true, - 'nationalfirearms' => true, - 'nationalheritage' => true, - 'nativeamerican' => true, - 'naturalhistory' => true, - 'naturalhistorymuseum' => true, - 'naturalsciences' => true, - 'nature' => true, - 'naturhistorisches' => true, - 'natuurwetenschappen' => true, - 'naumburg' => true, - 'naval' => true, - 'nebraska' => true, - 'neues' => true, - 'newhampshire' => true, - 'newjersey' => true, - 'newmexico' => true, - 'newport' => true, - 'newspaper' => true, - 'newyork' => true, - 'niepce' => true, - 'norfolk' => true, - 'north' => true, - 'nrw' => true, - 'nuernberg' => true, - 'nuremberg' => true, - 'nyc' => true, - 'nyny' => true, - 'oceanographic' => true, - 'oceanographique' => true, - 'omaha' => true, - 'online' => true, - 'ontario' => true, - 'openair' => true, - 'oregon' => true, - 'oregontrail' => true, - 'otago' => true, - 'oxford' => true, - 'pacific' => true, - 'paderborn' => true, - 'palace' => true, - 'paleo' => true, - 'palmsprings' => true, - 'panama' => true, - 'paris' => true, - 'pasadena' => true, - 'pharmacy' => true, - 'philadelphia' => true, - 'philadelphiaarea' => true, - 'philately' => true, - 'phoenix' => true, - 'photography' => true, - 'pilots' => true, - 'pittsburgh' => true, - 'planetarium' => true, - 'plantation' => true, - 'plants' => true, - 'plaza' => true, - 'portal' => true, - 'portland' => true, - 'portlligat' => true, - 'posts-and-telecommunications' => true, - 'preservation' => true, - 'presidio' => true, - 'press' => true, - 'project' => true, - 'public' => true, - 'pubol' => true, - 'quebec' => true, - 'railroad' => true, - 'railway' => true, - 'research' => true, - 'resistance' => true, - 'riodejaneiro' => true, - 'rochester' => true, - 'rockart' => true, - 'roma' => true, - 'russia' => true, - 'saintlouis' => true, - 'salem' => true, - 'salvadordali' => true, - 'salzburg' => true, - 'sandiego' => true, - 'sanfrancisco' => true, - 'santabarbara' => true, - 'santacruz' => true, - 'santafe' => true, - 'saskatchewan' => true, - 'satx' => true, - 'savannahga' => true, - 'schlesisches' => true, - 'schoenbrunn' => true, - 'schokoladen' => true, - 'school' => true, - 'schweiz' => true, - 'science' => true, - 'scienceandhistory' => true, - 'scienceandindustry' => true, - 'sciencecenter' => true, - 'sciencecenters' => true, - 'science-fiction' => true, - 'sciencehistory' => true, - 'sciences' => true, - 'sciencesnaturelles' => true, - 'scotland' => true, - 'seaport' => true, - 'settlement' => true, - 'settlers' => true, - 'shell' => true, - 'sherbrooke' => true, - 'sibenik' => true, - 'silk' => true, - 'ski' => true, - 'skole' => true, - 'society' => true, - 'sologne' => true, - 'soundandvision' => true, - 'southcarolina' => true, - 'southwest' => true, - 'space' => true, - 'spy' => true, - 'square' => true, - 'stadt' => true, - 'stalbans' => true, - 'starnberg' => true, - 'state' => true, - 'stateofdelaware' => true, - 'station' => true, - 'steam' => true, - 'steiermark' => true, - 'stjohn' => true, - 'stockholm' => true, - 'stpetersburg' => true, - 'stuttgart' => true, - 'suisse' => true, - 'surgeonshall' => true, - 'surrey' => true, - 'svizzera' => true, - 'sweden' => true, - 'sydney' => true, - 'tank' => true, - 'tcm' => true, - 'technology' => true, - 'telekommunikation' => true, - 'television' => true, - 'texas' => true, - 'textile' => true, - 'theater' => true, - 'time' => true, - 'timekeeping' => true, - 'topology' => true, - 'torino' => true, - 'touch' => true, - 'town' => true, - 'transport' => true, - 'tree' => true, - 'trolley' => true, - 'trust' => true, - 'trustee' => true, - 'uhren' => true, - 'ulm' => true, - 'undersea' => true, - 'university' => true, - 'usa' => true, - 'usantiques' => true, - 'usarts' => true, - 'uscountryestate' => true, - 'usculture' => true, - 'usdecorativearts' => true, - 'usgarden' => true, - 'ushistory' => true, - 'ushuaia' => true, - 'uslivinghistory' => true, - 'utah' => true, - 'uvic' => true, - 'valley' => true, - 'vantaa' => true, - 'versailles' => true, - 'viking' => true, - 'village' => true, - 'virginia' => true, - 'virtual' => true, - 'virtuel' => true, - 'vlaanderen' => true, - 'volkenkunde' => true, - 'wales' => true, - 'wallonie' => true, - 'war' => true, - 'washingtondc' => true, - 'watchandclock' => true, - 'watch-and-clock' => true, - 'western' => true, - 'westfalen' => true, - 'whaling' => true, - 'wildlife' => true, - 'williamsburg' => true, - 'windmill' => true, - 'workshop' => true, - 'york' => true, - 'yorkshire' => true, - 'yosemite' => true, - 'youth' => true, - 'zoological' => true, - 'zoology' => true, - 'ירושלים' => true, - 'иком' => true - ), - 'mv' => array( - 'aero' => true, - 'biz' => true, - 'com' => true, - 'coop' => true, - 'edu' => true, - 'gov' => true, - 'info' => true, - 'int' => true, - 'mil' => true, - 'museum' => true, - 'name' => true, - 'net' => true, - 'org' => true, - 'pro' => true - ), - 'mw' => array( - 'ac' => true, - 'biz' => true, - 'co' => true, - 'com' => true, - 'coop' => true, - 'edu' => true, - 'gov' => true, - 'int' => true, - 'museum' => true, - 'net' => true, - 'org' => true - ), - 'mx' => array( - 'com' => true, - 'org' => true, - 'gob' => true, - 'edu' => true, - 'net' => true, - 'blogspot' => true - ), - 'my' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'edu' => true, - 'mil' => true, - 'name' => true, - 'blogspot' => true - ), - 'mz' => array( - '*' => true, - '!teledata' => true - ), - 'na' => array( - 'info' => true, - 'pro' => true, - 'name' => true, - 'school' => true, - 'or' => true, - 'dr' => true, - 'us' => true, - 'mx' => true, - 'ca' => true, - 'in' => true, - 'cc' => true, - 'tv' => true, - 'ws' => true, - 'mobi' => true, - 'co' => true, - 'com' => true, - 'org' => true - ), - 'name' => array( - 'her' => array( - 'forgot' => true - ), - 'his' => array( - 'forgot' => true - ) - ), - 'nc' => array( - 'asso' => true - ), - 'ne' => true, - 'net' => array( - 'cloudfront' => true, - 'gb' => true, - 'hu' => true, - 'jp' => true, - 'se' => true, - 'uk' => true, - 'in' => true, - 'cdn77-ssl' => true, - 'cdn77' => array( - 'r' => true - ), - 'at-band-camp' => true, - 'blogdns' => true, - 'broke-it' => true, - 'buyshouses' => true, - 'dnsalias' => true, - 'dnsdojo' => true, - 'does-it' => true, - 'dontexist' => true, - 'dynalias' => true, - 'dynathome' => true, - 'endofinternet' => true, - 'from-az' => true, - 'from-co' => true, - 'from-la' => true, - 'from-ny' => true, - 'gets-it' => true, - 'ham-radio-op' => true, - 'homeftp' => true, - 'homeip' => true, - 'homelinux' => true, - 'homeunix' => true, - 'in-the-band' => true, - 'is-a-chef' => true, - 'is-a-geek' => true, - 'isa-geek' => true, - 'kicks-ass' => true, - 'office-on-the' => true, - 'podzone' => true, - 'scrapper-site' => true, - 'selfip' => true, - 'sells-it' => true, - 'servebbs' => true, - 'serveftp' => true, - 'thruhere' => true, - 'webhop' => true, - 'fastly' => array( - 'ssl' => array( - 'a' => true, - 'b' => true, - 'global' => true - ), - 'prod' => array( - 'a' => true, - 'global' => true - ) - ), - 'cloudfunctions' => true, - 'azurewebsites' => true, - 'azure-mobile' => true, - 'cloudapp' => true, - 'rackmaze' => true, - 'dsmynas' => true, - 'familyds' => true, - 'za' => true - ), - 'nf' => array( - 'com' => true, - 'net' => true, - 'per' => true, - 'rec' => true, - 'web' => true, - 'arts' => true, - 'firm' => true, - 'info' => true, - 'other' => true, - 'store' => true - ), - 'ng' => array( - 'com' => array( - 'blogspot' => true - ), - 'edu' => true, - 'gov' => true, - 'i' => true, - 'mil' => true, - 'mobi' => true, - 'name' => true, - 'net' => true, - 'org' => true, - 'sch' => true - ), - 'ni' => array( - 'com' => true, - 'gob' => true, - 'edu' => true, - 'org' => true, - 'nom' => true, - 'net' => true, - 'mil' => true, - 'co' => true, - 'biz' => true, - 'web' => true, - 'int' => true, - 'ac' => true, - 'in' => true, - 'info' => true - ), - 'nl' => array( - 'bv' => true, - 'co' => true, - 'blogspot' => true - ), - 'no' => array( - 'fhs' => true, - 'vgs' => true, - 'fylkesbibl' => true, - 'folkebibl' => true, - 'museum' => true, - 'idrett' => true, - 'priv' => true, - 'mil' => true, - 'stat' => true, - 'dep' => true, - 'kommune' => true, - 'herad' => true, - 'aa' => array( - 'gs' => true - ), - 'ah' => array( - 'gs' => true - ), - 'bu' => array( - 'gs' => true - ), - 'fm' => array( - 'gs' => true - ), - 'hl' => array( - 'gs' => true - ), - 'hm' => array( - 'gs' => true - ), - 'jan-mayen' => array( - 'gs' => true - ), - 'mr' => array( - 'gs' => true - ), - 'nl' => array( - 'gs' => true - ), - 'nt' => array( - 'gs' => true - ), - 'of' => array( - 'gs' => true - ), - 'ol' => array( - 'gs' => true - ), - 'oslo' => array( - 'gs' => true - ), - 'rl' => array( - 'gs' => true - ), - 'sf' => array( - 'gs' => true - ), - 'st' => array( - 'gs' => true - ), - 'svalbard' => array( - 'gs' => true - ), - 'tm' => array( - 'gs' => true - ), - 'tr' => array( - 'gs' => true - ), - 'va' => array( - 'gs' => true - ), - 'vf' => array( - 'gs' => true - ), - 'akrehamn' => true, - 'åkrehamn' => true, - 'algard' => true, - 'ålgård' => true, - 'arna' => true, - 'brumunddal' => true, - 'bryne' => true, - 'bronnoysund' => true, - 'brønnøysund' => true, - 'drobak' => true, - 'drøbak' => true, - 'egersund' => true, - 'fetsund' => true, - 'floro' => true, - 'florø' => true, - 'fredrikstad' => true, - 'hokksund' => true, - 'honefoss' => true, - 'hønefoss' => true, - 'jessheim' => true, - 'jorpeland' => true, - 'jørpeland' => true, - 'kirkenes' => true, - 'kopervik' => true, - 'krokstadelva' => true, - 'langevag' => true, - 'langevåg' => true, - 'leirvik' => true, - 'mjondalen' => true, - 'mjøndalen' => true, - 'mo-i-rana' => true, - 'mosjoen' => true, - 'mosjøen' => true, - 'nesoddtangen' => true, - 'orkanger' => true, - 'osoyro' => true, - 'osøyro' => true, - 'raholt' => true, - 'råholt' => true, - 'sandnessjoen' => true, - 'sandnessjøen' => true, - 'skedsmokorset' => true, - 'slattum' => true, - 'spjelkavik' => true, - 'stathelle' => true, - 'stavern' => true, - 'stjordalshalsen' => true, - 'stjørdalshalsen' => true, - 'tananger' => true, - 'tranby' => true, - 'vossevangen' => true, - 'afjord' => true, - 'åfjord' => true, - 'agdenes' => true, - 'al' => true, - 'ål' => true, - 'alesund' => true, - 'ålesund' => true, - 'alstahaug' => true, - 'alta' => true, - 'áltá' => true, - 'alaheadju' => true, - 'álaheadju' => true, - 'alvdal' => true, - 'amli' => true, - 'åmli' => true, - 'amot' => true, - 'åmot' => true, - 'andebu' => true, - 'andoy' => true, - 'andøy' => true, - 'andasuolo' => true, - 'ardal' => true, - 'årdal' => true, - 'aremark' => true, - 'arendal' => true, - 'ås' => true, - 'aseral' => true, - 'åseral' => true, - 'asker' => true, - 'askim' => true, - 'askvoll' => true, - 'askoy' => true, - 'askøy' => true, - 'asnes' => true, - 'åsnes' => true, - 'audnedaln' => true, - 'aukra' => true, - 'aure' => true, - 'aurland' => true, - 'aurskog-holand' => true, - 'aurskog-høland' => true, - 'austevoll' => true, - 'austrheim' => true, - 'averoy' => true, - 'averøy' => true, - 'balestrand' => true, - 'ballangen' => true, - 'balat' => true, - 'bálát' => true, - 'balsfjord' => true, - 'bahccavuotna' => true, - 'báhccavuotna' => true, - 'bamble' => true, - 'bardu' => true, - 'beardu' => true, - 'beiarn' => true, - 'bajddar' => true, - 'bájddar' => true, - 'baidar' => true, - 'báidár' => true, - 'berg' => true, - 'bergen' => true, - 'berlevag' => true, - 'berlevåg' => true, - 'bearalvahki' => true, - 'bearalváhki' => true, - 'bindal' => true, - 'birkenes' => true, - 'bjarkoy' => true, - 'bjarkøy' => true, - 'bjerkreim' => true, - 'bjugn' => true, - 'bodo' => true, - 'bodø' => true, - 'badaddja' => true, - 'bådåddjå' => true, - 'budejju' => true, - 'bokn' => true, - 'bremanger' => true, - 'bronnoy' => true, - 'brønnøy' => true, - 'bygland' => true, - 'bykle' => true, - 'barum' => true, - 'bærum' => true, - 'telemark' => array( - 'bo' => true, - 'bø' => true - ), - 'nordland' => array( - 'bo' => true, - 'bø' => true, - 'heroy' => true, - 'herøy' => true - ), - 'bievat' => true, - 'bievát' => true, - 'bomlo' => true, - 'bømlo' => true, - 'batsfjord' => true, - 'båtsfjord' => true, - 'bahcavuotna' => true, - 'báhcavuotna' => true, - 'dovre' => true, - 'drammen' => true, - 'drangedal' => true, - 'dyroy' => true, - 'dyrøy' => true, - 'donna' => true, - 'dønna' => true, - 'eid' => true, - 'eidfjord' => true, - 'eidsberg' => true, - 'eidskog' => true, - 'eidsvoll' => true, - 'eigersund' => true, - 'elverum' => true, - 'enebakk' => true, - 'engerdal' => true, - 'etne' => true, - 'etnedal' => true, - 'evenes' => true, - 'evenassi' => true, - 'evenášši' => true, - 'evje-og-hornnes' => true, - 'farsund' => true, - 'fauske' => true, - 'fuossko' => true, - 'fuoisku' => true, - 'fedje' => true, - 'fet' => true, - 'finnoy' => true, - 'finnøy' => true, - 'fitjar' => true, - 'fjaler' => true, - 'fjell' => true, - 'flakstad' => true, - 'flatanger' => true, - 'flekkefjord' => true, - 'flesberg' => true, - 'flora' => true, - 'fla' => true, - 'flå' => true, - 'folldal' => true, - 'forsand' => true, - 'fosnes' => true, - 'frei' => true, - 'frogn' => true, - 'froland' => true, - 'frosta' => true, - 'frana' => true, - 'fræna' => true, - 'froya' => true, - 'frøya' => true, - 'fusa' => true, - 'fyresdal' => true, - 'forde' => true, - 'førde' => true, - 'gamvik' => true, - 'gangaviika' => true, - 'gáŋgaviika' => true, - 'gaular' => true, - 'gausdal' => true, - 'gildeskal' => true, - 'gildeskål' => true, - 'giske' => true, - 'gjemnes' => true, - 'gjerdrum' => true, - 'gjerstad' => true, - 'gjesdal' => true, - 'gjovik' => true, - 'gjøvik' => true, - 'gloppen' => true, - 'gol' => true, - 'gran' => true, - 'grane' => true, - 'granvin' => true, - 'gratangen' => true, - 'grimstad' => true, - 'grong' => true, - 'kraanghke' => true, - 'kråanghke' => true, - 'grue' => true, - 'gulen' => true, - 'hadsel' => true, - 'halden' => true, - 'halsa' => true, - 'hamar' => true, - 'hamaroy' => true, - 'habmer' => true, - 'hábmer' => true, - 'hapmir' => true, - 'hápmir' => true, - 'hammerfest' => true, - 'hammarfeasta' => true, - 'hámmárfeasta' => true, - 'haram' => true, - 'hareid' => true, - 'harstad' => true, - 'hasvik' => true, - 'aknoluokta' => true, - 'ákŋoluokta' => true, - 'hattfjelldal' => true, - 'aarborte' => true, - 'haugesund' => true, - 'hemne' => true, - 'hemnes' => true, - 'hemsedal' => true, - 'more-og-romsdal' => array( - 'heroy' => true, - 'sande' => true - ), - 'møre-og-romsdal' => array( - 'herøy' => true, - 'sande' => true - ), - 'hitra' => true, - 'hjartdal' => true, - 'hjelmeland' => true, - 'hobol' => true, - 'hobøl' => true, - 'hof' => true, - 'hol' => true, - 'hole' => true, - 'holmestrand' => true, - 'holtalen' => true, - 'holtålen' => true, - 'hornindal' => true, - 'horten' => true, - 'hurdal' => true, - 'hurum' => true, - 'hvaler' => true, - 'hyllestad' => true, - 'hagebostad' => true, - 'hægebostad' => true, - 'hoyanger' => true, - 'høyanger' => true, - 'hoylandet' => true, - 'høylandet' => true, - 'ha' => true, - 'hå' => true, - 'ibestad' => true, - 'inderoy' => true, - 'inderøy' => true, - 'iveland' => true, - 'jevnaker' => true, - 'jondal' => true, - 'jolster' => true, - 'jølster' => true, - 'karasjok' => true, - 'karasjohka' => true, - 'kárášjohka' => true, - 'karlsoy' => true, - 'galsa' => true, - 'gálsá' => true, - 'karmoy' => true, - 'karmøy' => true, - 'kautokeino' => true, - 'guovdageaidnu' => true, - 'klepp' => true, - 'klabu' => true, - 'klæbu' => true, - 'kongsberg' => true, - 'kongsvinger' => true, - 'kragero' => true, - 'kragerø' => true, - 'kristiansand' => true, - 'kristiansund' => true, - 'krodsherad' => true, - 'krødsherad' => true, - 'kvalsund' => true, - 'rahkkeravju' => true, - 'ráhkkerávju' => true, - 'kvam' => true, - 'kvinesdal' => true, - 'kvinnherad' => true, - 'kviteseid' => true, - 'kvitsoy' => true, - 'kvitsøy' => true, - 'kvafjord' => true, - 'kvæfjord' => true, - 'giehtavuoatna' => true, - 'kvanangen' => true, - 'kvænangen' => true, - 'navuotna' => true, - 'návuotna' => true, - 'kafjord' => true, - 'kåfjord' => true, - 'gaivuotna' => true, - 'gáivuotna' => true, - 'larvik' => true, - 'lavangen' => true, - 'lavagis' => true, - 'loabat' => true, - 'loabát' => true, - 'lebesby' => true, - 'davvesiida' => true, - 'leikanger' => true, - 'leirfjord' => true, - 'leka' => true, - 'leksvik' => true, - 'lenvik' => true, - 'leangaviika' => true, - 'leaŋgaviika' => true, - 'lesja' => true, - 'levanger' => true, - 'lier' => true, - 'lierne' => true, - 'lillehammer' => true, - 'lillesand' => true, - 'lindesnes' => true, - 'lindas' => true, - 'lindås' => true, - 'lom' => true, - 'loppa' => true, - 'lahppi' => true, - 'láhppi' => true, - 'lund' => true, - 'lunner' => true, - 'luroy' => true, - 'lurøy' => true, - 'luster' => true, - 'lyngdal' => true, - 'lyngen' => true, - 'ivgu' => true, - 'lardal' => true, - 'lerdal' => true, - 'lærdal' => true, - 'lodingen' => true, - 'lødingen' => true, - 'lorenskog' => true, - 'lørenskog' => true, - 'loten' => true, - 'løten' => true, - 'malvik' => true, - 'masoy' => true, - 'måsøy' => true, - 'muosat' => true, - 'muosát' => true, - 'mandal' => true, - 'marker' => true, - 'marnardal' => true, - 'masfjorden' => true, - 'meland' => true, - 'meldal' => true, - 'melhus' => true, - 'meloy' => true, - 'meløy' => true, - 'meraker' => true, - 'meråker' => true, - 'moareke' => true, - 'moåreke' => true, - 'midsund' => true, - 'midtre-gauldal' => true, - 'modalen' => true, - 'modum' => true, - 'molde' => true, - 'moskenes' => true, - 'moss' => true, - 'mosvik' => true, - 'malselv' => true, - 'målselv' => true, - 'malatvuopmi' => true, - 'málatvuopmi' => true, - 'namdalseid' => true, - 'aejrie' => true, - 'namsos' => true, - 'namsskogan' => true, - 'naamesjevuemie' => true, - 'nååmesjevuemie' => true, - 'laakesvuemie' => true, - 'nannestad' => true, - 'narvik' => true, - 'narviika' => true, - 'naustdal' => true, - 'nedre-eiker' => true, - 'akershus' => array( - 'nes' => true - ), - 'buskerud' => array( - 'nes' => true - ), - 'nesna' => true, - 'nesodden' => true, - 'nesseby' => true, - 'unjarga' => true, - 'unjárga' => true, - 'nesset' => true, - 'nissedal' => true, - 'nittedal' => true, - 'nord-aurdal' => true, - 'nord-fron' => true, - 'nord-odal' => true, - 'norddal' => true, - 'nordkapp' => true, - 'davvenjarga' => true, - 'davvenjárga' => true, - 'nordre-land' => true, - 'nordreisa' => true, - 'raisa' => true, - 'ráisa' => true, - 'nore-og-uvdal' => true, - 'notodden' => true, - 'naroy' => true, - 'nærøy' => true, - 'notteroy' => true, - 'nøtterøy' => true, - 'odda' => true, - 'oksnes' => true, - 'øksnes' => true, - 'oppdal' => true, - 'oppegard' => true, - 'oppegård' => true, - 'orkdal' => true, - 'orland' => true, - 'ørland' => true, - 'orskog' => true, - 'ørskog' => true, - 'orsta' => true, - 'ørsta' => true, - 'hedmark' => array( - 'os' => true, - 'valer' => true, - 'våler' => true - ), - 'hordaland' => array( - 'os' => true - ), - 'osen' => true, - 'osteroy' => true, - 'osterøy' => true, - 'ostre-toten' => true, - 'østre-toten' => true, - 'overhalla' => true, - 'ovre-eiker' => true, - 'øvre-eiker' => true, - 'oyer' => true, - 'øyer' => true, - 'oygarden' => true, - 'øygarden' => true, - 'oystre-slidre' => true, - 'øystre-slidre' => true, - 'porsanger' => true, - 'porsangu' => true, - 'porsáŋgu' => true, - 'porsgrunn' => true, - 'radoy' => true, - 'radøy' => true, - 'rakkestad' => true, - 'rana' => true, - 'ruovat' => true, - 'randaberg' => true, - 'rauma' => true, - 'rendalen' => true, - 'rennebu' => true, - 'rennesoy' => true, - 'rennesøy' => true, - 'rindal' => true, - 'ringebu' => true, - 'ringerike' => true, - 'ringsaker' => true, - 'rissa' => true, - 'risor' => true, - 'risør' => true, - 'roan' => true, - 'rollag' => true, - 'rygge' => true, - 'ralingen' => true, - 'rælingen' => true, - 'rodoy' => true, - 'rødøy' => true, - 'romskog' => true, - 'rømskog' => true, - 'roros' => true, - 'røros' => true, - 'rost' => true, - 'røst' => true, - 'royken' => true, - 'røyken' => true, - 'royrvik' => true, - 'røyrvik' => true, - 'rade' => true, - 'råde' => true, - 'salangen' => true, - 'siellak' => true, - 'saltdal' => true, - 'salat' => true, - 'sálát' => true, - 'sálat' => true, - 'samnanger' => true, - 'vestfold' => array( - 'sande' => true - ), - 'sandefjord' => true, - 'sandnes' => true, - 'sandoy' => true, - 'sandøy' => true, - 'sarpsborg' => true, - 'sauda' => true, - 'sauherad' => true, - 'sel' => true, - 'selbu' => true, - 'selje' => true, - 'seljord' => true, - 'sigdal' => true, - 'siljan' => true, - 'sirdal' => true, - 'skaun' => true, - 'skedsmo' => true, - 'ski' => true, - 'skien' => true, - 'skiptvet' => true, - 'skjervoy' => true, - 'skjervøy' => true, - 'skierva' => true, - 'skiervá' => true, - 'skjak' => true, - 'skjåk' => true, - 'skodje' => true, - 'skanland' => true, - 'skånland' => true, - 'skanit' => true, - 'skánit' => true, - 'smola' => true, - 'smøla' => true, - 'snillfjord' => true, - 'snasa' => true, - 'snåsa' => true, - 'snoasa' => true, - 'snaase' => true, - 'snåase' => true, - 'sogndal' => true, - 'sokndal' => true, - 'sola' => true, - 'solund' => true, - 'songdalen' => true, - 'sortland' => true, - 'spydeberg' => true, - 'stange' => true, - 'stavanger' => true, - 'steigen' => true, - 'steinkjer' => true, - 'stjordal' => true, - 'stjørdal' => true, - 'stokke' => true, - 'stor-elvdal' => true, - 'stord' => true, - 'stordal' => true, - 'storfjord' => true, - 'omasvuotna' => true, - 'strand' => true, - 'stranda' => true, - 'stryn' => true, - 'sula' => true, - 'suldal' => true, - 'sund' => true, - 'sunndal' => true, - 'surnadal' => true, - 'sveio' => true, - 'svelvik' => true, - 'sykkylven' => true, - 'sogne' => true, - 'søgne' => true, - 'somna' => true, - 'sømna' => true, - 'sondre-land' => true, - 'søndre-land' => true, - 'sor-aurdal' => true, - 'sør-aurdal' => true, - 'sor-fron' => true, - 'sør-fron' => true, - 'sor-odal' => true, - 'sør-odal' => true, - 'sor-varanger' => true, - 'sør-varanger' => true, - 'matta-varjjat' => true, - 'mátta-várjjat' => true, - 'sorfold' => true, - 'sørfold' => true, - 'sorreisa' => true, - 'sørreisa' => true, - 'sorum' => true, - 'sørum' => true, - 'tana' => true, - 'deatnu' => true, - 'time' => true, - 'tingvoll' => true, - 'tinn' => true, - 'tjeldsund' => true, - 'dielddanuorri' => true, - 'tjome' => true, - 'tjøme' => true, - 'tokke' => true, - 'tolga' => true, - 'torsken' => true, - 'tranoy' => true, - 'tranøy' => true, - 'tromso' => true, - 'tromsø' => true, - 'tromsa' => true, - 'romsa' => true, - 'trondheim' => true, - 'troandin' => true, - 'trysil' => true, - 'trana' => true, - 'træna' => true, - 'trogstad' => true, - 'trøgstad' => true, - 'tvedestrand' => true, - 'tydal' => true, - 'tynset' => true, - 'tysfjord' => true, - 'divtasvuodna' => true, - 'divttasvuotna' => true, - 'tysnes' => true, - 'tysvar' => true, - 'tysvær' => true, - 'tonsberg' => true, - 'tønsberg' => true, - 'ullensaker' => true, - 'ullensvang' => true, - 'ulvik' => true, - 'utsira' => true, - 'vadso' => true, - 'vadsø' => true, - 'cahcesuolo' => true, - 'čáhcesuolo' => true, - 'vaksdal' => true, - 'valle' => true, - 'vang' => true, - 'vanylven' => true, - 'vardo' => true, - 'vardø' => true, - 'varggat' => true, - 'várggát' => true, - 'vefsn' => true, - 'vaapste' => true, - 'vega' => true, - 'vegarshei' => true, - 'vegårshei' => true, - 'vennesla' => true, - 'verdal' => true, - 'verran' => true, - 'vestby' => true, - 'vestnes' => true, - 'vestre-slidre' => true, - 'vestre-toten' => true, - 'vestvagoy' => true, - 'vestvågøy' => true, - 'vevelstad' => true, - 'vik' => true, - 'vikna' => true, - 'vindafjord' => true, - 'volda' => true, - 'voss' => true, - 'varoy' => true, - 'værøy' => true, - 'vagan' => true, - 'vågan' => true, - 'voagat' => true, - 'vagsoy' => true, - 'vågsøy' => true, - 'vaga' => true, - 'vågå' => true, - 'ostfold' => array( - 'valer' => true - ), - 'østfold' => array( - 'våler' => true - ), - 'co' => true, - 'blogspot' => true - ), - 'np' => array( - '*' => true - ), - 'nr' => array( - 'biz' => true, - 'info' => true, - 'gov' => true, - 'edu' => true, - 'org' => true, - 'net' => true, - 'com' => true - ), - 'nu' => array( - 'merseine' => true, - 'mine' => true, - 'shacknet' => true - ), - 'nz' => array( - 'ac' => true, - 'co' => array( - 'blogspot' => true - ), - 'cri' => true, - 'geek' => true, - 'gen' => true, - 'govt' => true, - 'health' => true, - 'iwi' => true, - 'kiwi' => true, - 'maori' => true, - 'mil' => true, - 'māori' => true, - 'net' => true, - 'org' => true, - 'parliament' => true, - 'school' => true - ), - 'om' => array( - 'co' => true, - 'com' => true, - 'edu' => true, - 'gov' => true, - 'med' => true, - 'museum' => true, - 'net' => true, - 'org' => true, - 'pro' => true - ), - 'org' => array( - 'ae' => true, - 'us' => true, - 'cdn77' => array( - 'c' => true, - 'rsc' => true - ), - 'cdn77-secure' => array( - 'origin' => array( - 'ssl' => true - ) - ), - 'duckdns' => true, - 'dyndns' => array( - 'go' => true, - 'home' => true - ), - 'blogdns' => true, - 'blogsite' => true, - 'boldlygoingnowhere' => true, - 'dnsalias' => true, - 'dnsdojo' => true, - 'doesntexist' => true, - 'dontexist' => true, - 'doomdns' => true, - 'dvrdns' => true, - 'dynalias' => true, - 'endofinternet' => true, - 'endoftheinternet' => true, - 'from-me' => true, - 'game-host' => true, - 'gotdns' => true, - 'hobby-site' => true, - 'homedns' => true, - 'homeftp' => true, - 'homelinux' => true, - 'homeunix' => true, - 'is-a-bruinsfan' => true, - 'is-a-candidate' => true, - 'is-a-celticsfan' => true, - 'is-a-chef' => true, - 'is-a-geek' => true, - 'is-a-knight' => true, - 'is-a-linux-user' => true, - 'is-a-patsfan' => true, - 'is-a-soxfan' => true, - 'is-found' => true, - 'is-lost' => true, - 'is-saved' => true, - 'is-very-bad' => true, - 'is-very-evil' => true, - 'is-very-good' => true, - 'is-very-nice' => true, - 'is-very-sweet' => true, - 'isa-geek' => true, - 'kicks-ass' => true, - 'misconfused' => true, - 'podzone' => true, - 'readmyblog' => true, - 'selfip' => true, - 'sellsyourhome' => true, - 'servebbs' => true, - 'serveftp' => true, - 'servegame' => true, - 'stuff-4-sale' => true, - 'webhop' => true, - 'eu' => array( - 'al' => true, - 'asso' => true, - 'at' => true, - 'au' => true, - 'be' => true, - 'bg' => true, - 'ca' => true, - 'cd' => true, - 'ch' => true, - 'cn' => true, - 'cy' => true, - 'cz' => true, - 'de' => true, - 'dk' => true, - 'edu' => true, - 'ee' => true, - 'es' => true, - 'fi' => true, - 'fr' => true, - 'gr' => true, - 'hr' => true, - 'hu' => true, - 'ie' => true, - 'il' => true, - 'in' => true, - 'int' => true, - 'is' => true, - 'it' => true, - 'jp' => true, - 'kr' => true, - 'lt' => true, - 'lu' => true, - 'lv' => true, - 'mc' => true, - 'me' => true, - 'mk' => true, - 'mt' => true, - 'my' => true, - 'net' => true, - 'ng' => true, - 'nl' => true, - 'no' => true, - 'nz' => true, - 'paris' => true, - 'pl' => true, - 'pt' => true, - 'q-a' => true, - 'ro' => true, - 'ru' => true, - 'se' => true, - 'si' => true, - 'sk' => true, - 'tr' => true, - 'uk' => true, - 'us' => true - ), - 'bmoattachments' => true, - 'dsmynas' => true, - 'familyds' => true, - 'hk' => true, - 'za' => true - ), - 'pa' => array( - 'ac' => true, - 'gob' => true, - 'com' => true, - 'org' => true, - 'sld' => true, - 'edu' => true, - 'net' => true, - 'ing' => true, - 'abo' => true, - 'med' => true, - 'nom' => true - ), - 'pe' => array( - 'edu' => true, - 'gob' => true, - 'nom' => true, - 'mil' => true, - 'org' => true, - 'com' => true, - 'net' => true, - 'blogspot' => true - ), - 'pf' => array( - 'com' => true, - 'org' => true, - 'edu' => true - ), - 'pg' => array( - '*' => true - ), - 'ph' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'edu' => true, - 'ngo' => true, - 'mil' => true, - 'i' => true - ), - 'pk' => array( - 'com' => true, - 'net' => true, - 'edu' => true, - 'org' => true, - 'fam' => true, - 'biz' => true, - 'web' => true, - 'gov' => true, - 'gob' => true, - 'gok' => true, - 'gon' => true, - 'gop' => true, - 'gos' => true, - 'info' => true - ), - 'pl' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'aid' => true, - 'agro' => true, - 'atm' => true, - 'auto' => true, - 'biz' => true, - 'edu' => true, - 'gmina' => true, - 'gsm' => true, - 'info' => true, - 'mail' => true, - 'miasta' => true, - 'media' => true, - 'mil' => true, - 'nieruchomosci' => true, - 'nom' => true, - 'pc' => true, - 'powiat' => true, - 'priv' => true, - 'realestate' => true, - 'rel' => true, - 'sex' => true, - 'shop' => true, - 'sklep' => true, - 'sos' => true, - 'szkola' => true, - 'targi' => true, - 'tm' => true, - 'tourism' => true, - 'travel' => true, - 'turystyka' => true, - 'gov' => array( - 'ap' => true, - 'ic' => true, - 'is' => true, - 'us' => true, - 'kmpsp' => true, - 'kppsp' => true, - 'kwpsp' => true, - 'psp' => true, - 'wskr' => true, - 'kwp' => true, - 'mw' => true, - 'ug' => true, - 'um' => true, - 'umig' => true, - 'ugim' => true, - 'upow' => true, - 'uw' => true, - 'starostwo' => true, - 'pa' => true, - 'po' => true, - 'psse' => true, - 'pup' => true, - 'rzgw' => true, - 'sa' => true, - 'so' => true, - 'sr' => true, - 'wsa' => true, - 'sko' => true, - 'uzs' => true, - 'wiih' => true, - 'winb' => true, - 'pinb' => true, - 'wios' => true, - 'witd' => true, - 'wzmiuw' => true, - 'piw' => true, - 'wiw' => true, - 'griw' => true, - 'wif' => true, - 'oum' => true, - 'sdn' => true, - 'zp' => true, - 'uppo' => true, - 'mup' => true, - 'wuoz' => true, - 'konsulat' => true, - 'oirm' => true - ), - 'augustow' => true, - 'babia-gora' => true, - 'bedzin' => true, - 'beskidy' => true, - 'bialowieza' => true, - 'bialystok' => true, - 'bielawa' => true, - 'bieszczady' => true, - 'boleslawiec' => true, - 'bydgoszcz' => true, - 'bytom' => true, - 'cieszyn' => true, - 'czeladz' => true, - 'czest' => true, - 'dlugoleka' => true, - 'elblag' => true, - 'elk' => true, - 'glogow' => true, - 'gniezno' => true, - 'gorlice' => true, - 'grajewo' => true, - 'ilawa' => true, - 'jaworzno' => true, - 'jelenia-gora' => true, - 'jgora' => true, - 'kalisz' => true, - 'kazimierz-dolny' => true, - 'karpacz' => true, - 'kartuzy' => true, - 'kaszuby' => true, - 'katowice' => true, - 'kepno' => true, - 'ketrzyn' => true, - 'klodzko' => true, - 'kobierzyce' => true, - 'kolobrzeg' => true, - 'konin' => true, - 'konskowola' => true, - 'kutno' => true, - 'lapy' => true, - 'lebork' => true, - 'legnica' => true, - 'lezajsk' => true, - 'limanowa' => true, - 'lomza' => true, - 'lowicz' => true, - 'lubin' => true, - 'lukow' => true, - 'malbork' => true, - 'malopolska' => true, - 'mazowsze' => true, - 'mazury' => true, - 'mielec' => true, - 'mielno' => true, - 'mragowo' => true, - 'naklo' => true, - 'nowaruda' => true, - 'nysa' => true, - 'olawa' => true, - 'olecko' => true, - 'olkusz' => true, - 'olsztyn' => true, - 'opoczno' => true, - 'opole' => true, - 'ostroda' => true, - 'ostroleka' => true, - 'ostrowiec' => true, - 'ostrowwlkp' => true, - 'pila' => true, - 'pisz' => true, - 'podhale' => true, - 'podlasie' => true, - 'polkowice' => true, - 'pomorze' => true, - 'pomorskie' => true, - 'prochowice' => true, - 'pruszkow' => true, - 'przeworsk' => true, - 'pulawy' => true, - 'radom' => true, - 'rawa-maz' => true, - 'rybnik' => true, - 'rzeszow' => true, - 'sanok' => true, - 'sejny' => true, - 'slask' => true, - 'slupsk' => true, - 'sosnowiec' => true, - 'stalowa-wola' => true, - 'skoczow' => true, - 'starachowice' => true, - 'stargard' => true, - 'suwalki' => true, - 'swidnica' => true, - 'swiebodzin' => true, - 'swinoujscie' => true, - 'szczecin' => true, - 'szczytno' => true, - 'tarnobrzeg' => true, - 'tgory' => true, - 'turek' => true, - 'tychy' => true, - 'ustka' => true, - 'walbrzych' => true, - 'warmia' => true, - 'warszawa' => true, - 'waw' => true, - 'wegrow' => true, - 'wielun' => true, - 'wlocl' => true, - 'wloclawek' => true, - 'wodzislaw' => true, - 'wolomin' => true, - 'wroclaw' => true, - 'zachpomor' => true, - 'zagan' => true, - 'zarow' => true, - 'zgora' => true, - 'zgorzelec' => true, - 'co' => true, - 'art' => true, - 'gliwice' => true, - 'krakow' => true, - 'poznan' => true, - 'wroc' => true, - 'zakopane' => true, - 'gda' => true, - 'gdansk' => true, - 'gdynia' => true, - 'med' => true, - 'sopot' => true - ), - 'pm' => true, - 'pn' => array( - 'gov' => true, - 'co' => true, - 'org' => true, - 'edu' => true, - 'net' => true - ), - 'post' => true, - 'pr' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'edu' => true, - 'isla' => true, - 'pro' => true, - 'biz' => true, - 'info' => true, - 'name' => true, - 'est' => true, - 'prof' => true, - 'ac' => true - ), - 'pro' => array( - 'aaa' => true, - 'aca' => true, - 'acct' => true, - 'avocat' => true, - 'bar' => true, - 'cpa' => true, - 'eng' => true, - 'jur' => true, - 'law' => true, - 'med' => true, - 'recht' => true - ), - 'ps' => array( - 'edu' => true, - 'gov' => true, - 'sec' => true, - 'plo' => true, - 'com' => true, - 'org' => true, - 'net' => true - ), - 'pt' => array( - 'net' => true, - 'gov' => true, - 'org' => true, - 'edu' => true, - 'int' => true, - 'publ' => true, - 'com' => true, - 'nome' => true, - 'blogspot' => true - ), - 'pw' => array( - 'co' => true, - 'ne' => true, - 'or' => true, - 'ed' => true, - 'go' => true, - 'belau' => true - ), - 'py' => array( - 'com' => true, - 'coop' => true, - 'edu' => true, - 'gov' => true, - 'mil' => true, - 'net' => true, - 'org' => true - ), - 'qa' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'mil' => true, - 'name' => true, - 'net' => true, - 'org' => true, - 'sch' => true, - 'blogspot' => true - ), - 're' => array( - 'asso' => true, - 'com' => true, - 'nom' => true, - 'blogspot' => true - ), - 'ro' => array( - 'arts' => true, - 'com' => true, - 'firm' => true, - 'info' => true, - 'nom' => true, - 'nt' => true, - 'org' => true, - 'rec' => true, - 'store' => true, - 'tm' => true, - 'www' => true, - 'blogspot' => true - ), - 'rs' => array( - 'ac' => true, - 'co' => true, - 'edu' => true, - 'gov' => true, - 'in' => true, - 'org' => true, - 'blogspot' => true - ), - 'ru' => array( - 'ac' => true, - 'com' => true, - 'edu' => true, - 'int' => true, - 'net' => true, - 'org' => true, - 'pp' => true, - 'adygeya' => true, - 'altai' => true, - 'amur' => true, - 'arkhangelsk' => true, - 'astrakhan' => true, - 'bashkiria' => true, - 'belgorod' => true, - 'bir' => true, - 'bryansk' => true, - 'buryatia' => true, - 'cbg' => true, - 'chel' => true, - 'chelyabinsk' => true, - 'chita' => true, - 'chukotka' => true, - 'chuvashia' => true, - 'dagestan' => true, - 'dudinka' => true, - 'e-burg' => true, - 'grozny' => true, - 'irkutsk' => true, - 'ivanovo' => true, - 'izhevsk' => true, - 'jar' => true, - 'joshkar-ola' => true, - 'kalmykia' => true, - 'kaluga' => true, - 'kamchatka' => true, - 'karelia' => true, - 'kazan' => true, - 'kchr' => true, - 'kemerovo' => true, - 'khabarovsk' => true, - 'khakassia' => true, - 'khv' => true, - 'kirov' => true, - 'koenig' => true, - 'komi' => true, - 'kostroma' => true, - 'krasnoyarsk' => true, - 'kuban' => true, - 'kurgan' => true, - 'kursk' => true, - 'lipetsk' => true, - 'magadan' => true, - 'mari' => true, - 'mari-el' => true, - 'marine' => true, - 'mordovia' => true, - 'msk' => true, - 'murmansk' => true, - 'nalchik' => true, - 'nnov' => true, - 'nov' => true, - 'novosibirsk' => true, - 'nsk' => true, - 'omsk' => true, - 'orenburg' => true, - 'oryol' => true, - 'palana' => true, - 'penza' => true, - 'perm' => true, - 'ptz' => true, - 'rnd' => true, - 'ryazan' => true, - 'sakhalin' => true, - 'samara' => true, - 'saratov' => true, - 'simbirsk' => true, - 'smolensk' => true, - 'spb' => true, - 'stavropol' => true, - 'stv' => true, - 'surgut' => true, - 'tambov' => true, - 'tatarstan' => true, - 'tom' => true, - 'tomsk' => true, - 'tsaritsyn' => true, - 'tsk' => true, - 'tula' => true, - 'tuva' => true, - 'tver' => true, - 'tyumen' => true, - 'udm' => true, - 'udmurtia' => true, - 'ulan-ude' => true, - 'vladikavkaz' => true, - 'vladimir' => true, - 'vladivostok' => true, - 'volgograd' => true, - 'vologda' => true, - 'voronezh' => true, - 'vrn' => true, - 'vyatka' => true, - 'yakutia' => true, - 'yamal' => true, - 'yaroslavl' => true, - 'yekaterinburg' => true, - 'yuzhno-sakhalinsk' => true, - 'amursk' => true, - 'baikal' => true, - 'cmw' => true, - 'fareast' => true, - 'jamal' => true, - 'kms' => true, - 'k-uralsk' => true, - 'kustanai' => true, - 'kuzbass' => true, - 'mytis' => true, - 'nakhodka' => true, - 'nkz' => true, - 'norilsk' => true, - 'oskol' => true, - 'pyatigorsk' => true, - 'rubtsovsk' => true, - 'snz' => true, - 'syzran' => true, - 'vdonsk' => true, - 'zgrad' => true, - 'gov' => true, - 'mil' => true, - 'test' => true, - 'blogspot' => true - ), - 'rw' => array( - 'gov' => true, - 'net' => true, - 'edu' => true, - 'ac' => true, - 'com' => true, - 'co' => true, - 'int' => true, - 'mil' => true, - 'gouv' => true - ), - 'sa' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'med' => true, - 'pub' => true, - 'edu' => true, - 'sch' => true - ), - 'sb' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'net' => true, - 'org' => true - ), - 'sc' => array( - 'com' => true, - 'gov' => true, - 'net' => true, - 'org' => true, - 'edu' => true - ), - 'sd' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'edu' => true, - 'med' => true, - 'tv' => true, - 'gov' => true, - 'info' => true - ), - 'se' => array( - 'a' => true, - 'ac' => true, - 'b' => true, - 'bd' => true, - 'brand' => true, - 'c' => true, - 'd' => true, - 'e' => true, - 'f' => true, - 'fh' => true, - 'fhsk' => true, - 'fhv' => true, - 'g' => true, - 'h' => true, - 'i' => true, - 'k' => true, - 'komforb' => true, - 'kommunalforbund' => true, - 'komvux' => true, - 'l' => true, - 'lanbib' => true, - 'm' => true, - 'n' => true, - 'naturbruksgymn' => true, - 'o' => true, - 'org' => true, - 'p' => true, - 'parti' => true, - 'pp' => true, - 'press' => true, - 'r' => true, - 's' => true, - 't' => true, - 'tm' => true, - 'u' => true, - 'w' => true, - 'x' => true, - 'y' => true, - 'z' => true, - 'com' => true, - 'blogspot' => true - ), - 'sg' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'edu' => true, - 'per' => true, - 'blogspot' => true - ), - 'sh' => array( - 'com' => true, - 'net' => true, - 'gov' => true, - 'org' => true, - 'mil' => true, - 'platform' => array( - '*' => true - ), - 'hashbang' => true - ), - 'si' => array( - 'blogspot' => true - ), - 'sj' => true, - 'sk' => array( - 'blogspot' => true - ), - 'sl' => array( - 'com' => true, - 'net' => true, - 'edu' => true, - 'gov' => true, - 'org' => true - ), - 'sm' => true, - 'sn' => array( - 'art' => true, - 'com' => true, - 'edu' => true, - 'gouv' => true, - 'org' => true, - 'perso' => true, - 'univ' => true, - 'blogspot' => true - ), - 'so' => array( - 'com' => true, - 'net' => true, - 'org' => true - ), - 'sr' => true, - 'st' => array( - 'co' => true, - 'com' => true, - 'consulado' => true, - 'edu' => true, - 'embaixada' => true, - 'gov' => true, - 'mil' => true, - 'net' => true, - 'org' => true, - 'principe' => true, - 'saotome' => true, - 'store' => true - ), - 'su' => array( - 'adygeya' => true, - 'arkhangelsk' => true, - 'balashov' => true, - 'bashkiria' => true, - 'bryansk' => true, - 'dagestan' => true, - 'grozny' => true, - 'ivanovo' => true, - 'kalmykia' => true, - 'kaluga' => true, - 'karelia' => true, - 'khakassia' => true, - 'krasnodar' => true, - 'kurgan' => true, - 'lenug' => true, - 'mordovia' => true, - 'msk' => true, - 'murmansk' => true, - 'nalchik' => true, - 'nov' => true, - 'obninsk' => true, - 'penza' => true, - 'pokrovsk' => true, - 'sochi' => true, - 'spb' => true, - 'togliatti' => true, - 'troitsk' => true, - 'tula' => true, - 'tuva' => true, - 'vladikavkaz' => true, - 'vladimir' => true, - 'vologda' => true - ), - 'sv' => array( - 'com' => true, - 'edu' => true, - 'gob' => true, - 'org' => true, - 'red' => true - ), - 'sx' => array( - 'gov' => true - ), - 'sy' => array( - 'edu' => true, - 'gov' => true, - 'net' => true, - 'mil' => true, - 'com' => true, - 'org' => true - ), - 'sz' => array( - 'co' => true, - 'ac' => true, - 'org' => true - ), - 'tc' => true, - 'td' => array( - 'blogspot' => true - ), - 'tel' => true, - 'tf' => true, - 'tg' => true, - 'th' => array( - 'ac' => true, - 'co' => true, - 'go' => true, - 'in' => true, - 'mi' => true, - 'net' => true, - 'or' => true - ), - 'tj' => array( - 'ac' => true, - 'biz' => true, - 'co' => true, - 'com' => true, - 'edu' => true, - 'go' => true, - 'gov' => true, - 'int' => true, - 'mil' => true, - 'name' => true, - 'net' => true, - 'nic' => true, - 'org' => true, - 'test' => true, - 'web' => true - ), - 'tk' => true, - 'tl' => array( - 'gov' => true - ), - 'tm' => array( - 'com' => true, - 'co' => true, - 'org' => true, - 'net' => true, - 'nom' => true, - 'gov' => true, - 'mil' => true, - 'edu' => true - ), - 'tn' => array( - 'com' => true, - 'ens' => true, - 'fin' => true, - 'gov' => true, - 'ind' => true, - 'intl' => true, - 'nat' => true, - 'net' => true, - 'org' => true, - 'info' => true, - 'perso' => true, - 'tourism' => true, - 'edunet' => true, - 'rnrt' => true, - 'rns' => true, - 'rnu' => true, - 'mincom' => true, - 'agrinet' => true, - 'defense' => true, - 'turen' => true - ), - 'to' => array( - 'com' => true, - 'gov' => true, - 'net' => true, - 'org' => true, - 'edu' => true, - 'mil' => true - ), - 'tr' => array( - 'com' => array( - 'blogspot' => true - ), - 'info' => true, - 'biz' => true, - 'net' => true, - 'org' => true, - 'web' => true, - 'gen' => true, - 'tv' => true, - 'av' => true, - 'dr' => true, - 'bbs' => true, - 'name' => true, - 'tel' => true, - 'gov' => true, - 'bel' => true, - 'pol' => true, - 'mil' => true, - 'k12' => true, - 'edu' => true, - 'kep' => true, - 'nc' => array( - 'gov' => true - ) - ), - 'travel' => true, - 'tt' => array( - 'co' => true, - 'com' => true, - 'org' => true, - 'net' => true, - 'biz' => true, - 'info' => true, - 'pro' => true, - 'int' => true, - 'coop' => true, - 'jobs' => true, - 'mobi' => true, - 'travel' => true, - 'museum' => true, - 'aero' => true, - 'name' => true, - 'gov' => true, - 'edu' => true - ), - 'tv' => array( - 'dyndns' => true, - 'better-than' => true, - 'on-the-web' => true, - 'worse-than' => true - ), - 'tw' => array( - 'edu' => true, - 'gov' => true, - 'mil' => true, - 'com' => true, - 'net' => true, - 'org' => true, - 'idv' => true, - 'game' => true, - 'ebiz' => true, - 'club' => true, - '網路' => true, - '組織' => true, - '商業' => true, - 'blogspot' => true - ), - 'tz' => array( - 'ac' => true, - 'co' => true, - 'go' => true, - 'hotel' => true, - 'info' => true, - 'me' => true, - 'mil' => true, - 'mobi' => true, - 'ne' => true, - 'or' => true, - 'sc' => true, - 'tv' => true - ), - 'ua' => array( - 'com' => true, - 'edu' => true, - 'gov' => true, - 'in' => true, - 'net' => true, - 'org' => true, - 'cherkassy' => true, - 'cherkasy' => true, - 'chernigov' => true, - 'chernihiv' => true, - 'chernivtsi' => true, - 'chernovtsy' => true, - 'ck' => true, - 'cn' => true, - 'cr' => true, - 'crimea' => true, - 'cv' => true, - 'dn' => true, - 'dnepropetrovsk' => true, - 'dnipropetrovsk' => true, - 'dominic' => true, - 'donetsk' => true, - 'dp' => true, - 'if' => true, - 'ivano-frankivsk' => true, - 'kh' => true, - 'kharkiv' => true, - 'kharkov' => true, - 'kherson' => true, - 'khmelnitskiy' => true, - 'khmelnytskyi' => true, - 'kiev' => true, - 'kirovograd' => true, - 'km' => true, - 'kr' => true, - 'krym' => true, - 'ks' => true, - 'kv' => true, - 'kyiv' => true, - 'lg' => true, - 'lt' => true, - 'lugansk' => true, - 'lutsk' => true, - 'lv' => true, - 'lviv' => true, - 'mk' => true, - 'mykolaiv' => true, - 'nikolaev' => true, - 'od' => true, - 'odesa' => true, - 'odessa' => true, - 'pl' => true, - 'poltava' => true, - 'rivne' => true, - 'rovno' => true, - 'rv' => true, - 'sb' => true, - 'sebastopol' => true, - 'sevastopol' => true, - 'sm' => true, - 'sumy' => true, - 'te' => true, - 'ternopil' => true, - 'uz' => true, - 'uzhgorod' => true, - 'vinnica' => true, - 'vinnytsia' => true, - 'vn' => true, - 'volyn' => true, - 'yalta' => true, - 'zaporizhzhe' => true, - 'zaporizhzhia' => true, - 'zhitomir' => true, - 'zhytomyr' => true, - 'zp' => true, - 'zt' => true, - 'biz' => true, - 'co' => true, - 'pp' => true - ), - 'ug' => array( - 'co' => true, - 'or' => true, - 'ac' => true, - 'sc' => true, - 'go' => true, - 'ne' => true, - 'com' => true, - 'org' => true, - 'blogspot' => true - ), - 'uk' => array( - 'ac' => true, - 'co' => array( - 'blogspot' => true - ), - 'gov' => array( - 'service' => true - ), - 'ltd' => true, - 'me' => true, - 'net' => true, - 'nhs' => true, - 'org' => true, - 'plc' => true, - 'police' => true, - 'sch' => array( - '*' => true - ) - ), - 'us' => array( - 'dni' => true, - 'fed' => true, - 'isa' => true, - 'kids' => true, - 'nsn' => true, - 'ak' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'al' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ar' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'as' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'az' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ca' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'co' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ct' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'dc' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'de' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'fl' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ga' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'gu' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'hi' => array( - 'cc' => true, - 'lib' => true - ), - 'ia' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'id' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'il' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'in' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ks' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ky' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'la' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ma' => array( - 'k12' => array( - 'pvt' => true, - 'chtr' => true, - 'paroch' => true - ), - 'cc' => true, - 'lib' => true - ), - 'md' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'me' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'mi' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'mn' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'mo' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ms' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'mt' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'nc' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'nd' => array( - 'cc' => true, - 'lib' => true - ), - 'ne' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'nh' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'nj' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'nm' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'nv' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ny' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'oh' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ok' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'or' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'pa' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'pr' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ri' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'sc' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'sd' => array( - 'cc' => true, - 'lib' => true - ), - 'tn' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'tx' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'ut' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'vi' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'vt' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'va' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'wa' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'wi' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'wv' => array( - 'cc' => true - ), - 'wy' => array( - 'k12' => true, - 'cc' => true, - 'lib' => true - ), - 'is-by' => true, - 'land-4-sale' => true, - 'stuff-4-sale' => true - ), - 'uy' => array( - 'com' => array( - 'blogspot' => true - ), - 'edu' => true, - 'gub' => true, - 'mil' => true, - 'net' => true, - 'org' => true - ), - 'uz' => array( - 'co' => true, - 'com' => true, - 'net' => true, - 'org' => true - ), - 'va' => true, - 'vc' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'mil' => true, - 'edu' => true - ), - 've' => array( - 'arts' => true, - 'co' => true, - 'com' => true, - 'e12' => true, - 'edu' => true, - 'firm' => true, - 'gob' => true, - 'gov' => true, - 'info' => true, - 'int' => true, - 'mil' => true, - 'net' => true, - 'org' => true, - 'rec' => true, - 'store' => true, - 'tec' => true, - 'web' => true - ), - 'vg' => true, - 'vi' => array( - 'co' => true, - 'com' => true, - 'k12' => true, - 'net' => true, - 'org' => true - ), - 'vn' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'edu' => true, - 'gov' => true, - 'int' => true, - 'ac' => true, - 'biz' => true, - 'info' => true, - 'name' => true, - 'pro' => true, - 'health' => true, - 'blogspot' => true - ), - 'vu' => array( - 'com' => true, - 'edu' => true, - 'net' => true, - 'org' => true - ), - 'wf' => true, - 'ws' => array( - 'com' => true, - 'net' => true, - 'org' => true, - 'gov' => true, - 'edu' => true, - 'dyndns' => true, - 'mypets' => true - ), - 'yt' => true, - 'امارات' => true, - 'հայ' => true, - 'বাংলা' => true, - 'бел' => true, - '中国' => true, - '中國' => true, - 'الجزائر' => true, - 'مصر' => true, - 'გე' => true, - 'ελ' => true, - '香港' => true, - 'भारत' => true, - 'بھارت' => true, - 'భారత్' => true, - 'ભારત' => true, - 'ਭਾਰਤ' => true, - 'ভারত' => true, - 'இந்தியா' => true, - 'ایران' => true, - 'ايران' => true, - 'عراق' => true, - 'الاردن' => true, - '한국' => true, - 'қаз' => true, - 'ලංකා' => true, - 'இலங்கை' => true, - 'المغرب' => true, - 'мкд' => true, - 'мон' => true, - '澳門' => true, - '澳门' => true, - 'مليسيا' => true, - 'عمان' => true, - 'پاکستان' => true, - 'پاكستان' => true, - 'فلسطين' => true, - 'срб' => array( - 'пр' => true, - 'орг' => true, - 'обр' => true, - 'од' => true, - 'упр' => true, - 'ак' => true - ), - 'рф' => true, - 'قطر' => true, - 'السعودية' => true, - 'السعودیة' => true, - 'السعودیۃ' => true, - 'السعوديه' => true, - 'سودان' => true, - '新加坡' => true, - 'சிங்கப்பூர்' => true, - 'سورية' => true, - 'سوريا' => true, - 'ไทย' => true, - 'تونس' => true, - '台灣' => true, - '台湾' => true, - '臺灣' => true, - 'укр' => true, - 'اليمن' => true, - 'xxx' => true, - 'ye' => array( - '*' => true - ), - 'za' => array( - 'ac' => true, - 'agric' => true, - 'alt' => true, - 'co' => array( - 'blogspot' => true - ), - 'edu' => true, - 'gov' => true, - 'grondar' => true, - 'law' => true, - 'mil' => true, - 'net' => true, - 'ngo' => true, - 'nis' => true, - 'nom' => true, - 'org' => true, - 'school' => true, - 'tm' => true, - 'web' => true - ), - 'zm' => array( - '*' => true - ), - 'zw' => array( - '*' => true - ), - 'aaa' => true, - 'aarp' => true, - 'abarth' => true, - 'abb' => true, - 'abbott' => true, - 'abbvie' => true, - 'abc' => true, - 'able' => true, - 'abogado' => true, - 'abudhabi' => true, - 'academy' => true, - 'accenture' => true, - 'accountant' => true, - 'accountants' => true, - 'aco' => true, - 'active' => true, - 'actor' => true, - 'adac' => true, - 'ads' => true, - 'adult' => true, - 'aeg' => true, - 'aetna' => true, - 'afamilycompany' => true, - 'afl' => true, - 'africa' => true, - 'africamagic' => true, - 'agakhan' => true, - 'agency' => true, - 'aig' => true, - 'aigo' => true, - 'airbus' => true, - 'airforce' => true, - 'airtel' => true, - 'akdn' => true, - 'alfaromeo' => true, - 'alibaba' => true, - 'alipay' => true, - 'allfinanz' => true, - 'allstate' => true, - 'ally' => true, - 'alsace' => true, - 'alstom' => true, - 'americanexpress' => true, - 'americanfamily' => true, - 'amex' => true, - 'amfam' => true, - 'amica' => true, - 'amsterdam' => true, - 'analytics' => true, - 'android' => true, - 'anquan' => true, - 'anz' => true, - 'aol' => true, - 'apartments' => true, - 'app' => true, - 'apple' => true, - 'aquarelle' => true, - 'arab' => true, - 'aramco' => true, - 'archi' => true, - 'army' => true, - 'arte' => true, - 'asda' => true, - 'associates' => true, - 'athleta' => true, - 'attorney' => true, - 'auction' => true, - 'audi' => true, - 'audible' => true, - 'audio' => true, - 'auspost' => true, - 'author' => true, - 'auto' => true, - 'autos' => true, - 'avianca' => true, - 'aws' => true, - 'axa' => true, - 'azure' => true, - 'baby' => true, - 'baidu' => true, - 'banamex' => true, - 'bananarepublic' => true, - 'band' => true, - 'bank' => true, - 'bar' => true, - 'barcelona' => true, - 'barclaycard' => true, - 'barclays' => true, - 'barefoot' => true, - 'bargains' => true, - 'baseball' => true, - 'basketball' => true, - 'bauhaus' => true, - 'bayern' => true, - 'bbc' => true, - 'bbt' => true, - 'bbva' => true, - 'bcg' => true, - 'bcn' => true, - 'beats' => true, - 'beauty' => true, - 'beer' => true, - 'bentley' => true, - 'berlin' => true, - 'best' => true, - 'bestbuy' => true, - 'bet' => true, - 'bharti' => true, - 'bible' => true, - 'bid' => true, - 'bike' => true, - 'bing' => true, - 'bingo' => true, - 'bio' => true, - 'black' => true, - 'blackfriday' => true, - 'blanco' => true, - 'blockbuster' => true, - 'blog' => true, - 'bloomberg' => true, - 'blue' => true, - 'bms' => true, - 'bmw' => true, - 'bnl' => true, - 'bnpparibas' => true, - 'boats' => true, - 'boehringer' => true, - 'bofa' => true, - 'bom' => true, - 'bond' => true, - 'boo' => true, - 'book' => true, - 'booking' => true, - 'boots' => true, - 'bosch' => true, - 'bostik' => true, - 'boston' => true, - 'bot' => true, - 'boutique' => true, - 'box' => true, - 'bradesco' => true, - 'bridgestone' => true, - 'broadway' => true, - 'broker' => true, - 'brother' => true, - 'brussels' => true, - 'budapest' => true, - 'bugatti' => true, - 'build' => true, - 'builders' => true, - 'business' => true, - 'buy' => true, - 'buzz' => true, - 'bzh' => true, - 'cab' => true, - 'cafe' => true, - 'cal' => true, - 'call' => true, - 'calvinklein' => true, - 'camera' => true, - 'camp' => true, - 'cancerresearch' => true, - 'canon' => true, - 'capetown' => true, - 'capital' => true, - 'capitalone' => true, - 'car' => true, - 'caravan' => true, - 'cards' => true, - 'care' => true, - 'career' => true, - 'careers' => true, - 'cars' => true, - 'cartier' => true, - 'casa' => true, - 'case' => true, - 'caseih' => true, - 'cash' => true, - 'casino' => true, - 'catering' => true, - 'catholic' => true, - 'cba' => true, - 'cbn' => true, - 'cbre' => true, - 'cbs' => true, - 'ceb' => true, - 'center' => true, - 'ceo' => true, - 'cern' => true, - 'cfa' => true, - 'cfd' => true, - 'chanel' => true, - 'channel' => true, - 'chase' => true, - 'chat' => true, - 'cheap' => true, - 'chintai' => true, - 'chloe' => true, - 'christmas' => true, - 'chrome' => true, - 'chrysler' => true, - 'church' => true, - 'cipriani' => true, - 'circle' => true, - 'cisco' => true, - 'citadel' => true, - 'citi' => true, - 'citic' => true, - 'city' => true, - 'cityeats' => true, - 'claims' => true, - 'cleaning' => true, - 'click' => true, - 'clinic' => true, - 'clinique' => true, - 'clothing' => true, - 'cloud' => true, - 'club' => true, - 'clubmed' => true, - 'coach' => true, - 'codes' => true, - 'coffee' => true, - 'college' => true, - 'cologne' => true, - 'comcast' => true, - 'commbank' => true, - 'community' => true, - 'company' => true, - 'compare' => true, - 'computer' => true, - 'comsec' => true, - 'condos' => true, - 'construction' => true, - 'consulting' => true, - 'contact' => true, - 'contractors' => true, - 'cooking' => true, - 'cookingchannel' => true, - 'cool' => true, - 'corsica' => true, - 'country' => true, - 'coupon' => true, - 'coupons' => true, - 'courses' => true, - 'credit' => true, - 'creditcard' => true, - 'creditunion' => true, - 'cricket' => true, - 'crown' => true, - 'crs' => true, - 'cruise' => true, - 'cruises' => true, - 'csc' => true, - 'cuisinella' => true, - 'cymru' => true, - 'cyou' => true, - 'dabur' => true, - 'dad' => true, - 'dance' => true, - 'date' => true, - 'dating' => true, - 'datsun' => true, - 'day' => true, - 'dclk' => true, - 'dds' => true, - 'deal' => true, - 'dealer' => true, - 'deals' => true, - 'degree' => true, - 'delivery' => true, - 'dell' => true, - 'deloitte' => true, - 'delta' => true, - 'democrat' => true, - 'dental' => true, - 'dentist' => true, - 'desi' => true, - 'design' => true, - 'dev' => true, - 'dhl' => true, - 'diamonds' => true, - 'diet' => true, - 'digital' => true, - 'direct' => true, - 'directory' => true, - 'discount' => true, - 'discover' => true, - 'dish' => true, - 'diy' => true, - 'dnp' => true, - 'docs' => true, - 'dodge' => true, - 'dog' => true, - 'doha' => true, - 'domains' => true, - 'doosan' => true, - 'dot' => true, - 'download' => true, - 'drive' => true, - 'dstv' => true, - 'dtv' => true, - 'dubai' => true, - 'duck' => true, - 'dunlop' => true, - 'duns' => true, - 'dupont' => true, - 'durban' => true, - 'dvag' => true, - 'dwg' => true, - 'earth' => true, - 'eat' => true, - 'edeka' => true, - 'education' => true, - 'email' => true, - 'emerck' => true, - 'emerson' => true, - 'energy' => true, - 'engineer' => true, - 'engineering' => true, - 'enterprises' => true, - 'epost' => true, - 'epson' => true, - 'equipment' => true, - 'ericsson' => true, - 'erni' => true, - 'esq' => true, - 'estate' => true, - 'esurance' => true, - 'etisalat' => true, - 'eurovision' => true, - 'eus' => true, - 'events' => true, - 'everbank' => true, - 'exchange' => true, - 'expert' => true, - 'exposed' => true, - 'express' => true, - 'extraspace' => true, - 'fage' => true, - 'fail' => true, - 'fairwinds' => true, - 'faith' => true, - 'family' => true, - 'fan' => true, - 'fans' => true, - 'farm' => true, - 'farmers' => true, - 'fashion' => true, - 'fast' => true, - 'fedex' => true, - 'feedback' => true, - 'ferrari' => true, - 'ferrero' => true, - 'fiat' => true, - 'fidelity' => true, - 'fido' => true, - 'film' => true, - 'final' => true, - 'finance' => true, - 'financial' => true, - 'fire' => true, - 'firestone' => true, - 'firmdale' => true, - 'fish' => true, - 'fishing' => true, - 'fit' => true, - 'fitness' => true, - 'flickr' => true, - 'flights' => true, - 'flir' => true, - 'florist' => true, - 'flowers' => true, - 'flsmidth' => true, - 'fly' => true, - 'foo' => true, - 'foodnetwork' => true, - 'football' => true, - 'ford' => true, - 'forex' => true, - 'forsale' => true, - 'forum' => true, - 'foundation' => true, - 'fox' => true, - 'free' => true, - 'fresenius' => true, - 'frl' => true, - 'frogans' => true, - 'frontdoor' => true, - 'frontier' => true, - 'ftr' => true, - 'fujitsu' => true, - 'fujixerox' => true, - 'fund' => true, - 'furniture' => true, - 'futbol' => true, - 'fyi' => true, - 'gal' => true, - 'gallery' => true, - 'gallo' => true, - 'gallup' => true, - 'game' => true, - 'games' => true, - 'gap' => true, - 'garden' => true, - 'gbiz' => true, - 'gdn' => true, - 'gea' => true, - 'gent' => true, - 'genting' => true, - 'george' => true, - 'ggee' => true, - 'gift' => true, - 'gifts' => true, - 'gives' => true, - 'giving' => true, - 'glade' => true, - 'glass' => true, - 'gle' => true, - 'global' => true, - 'globo' => true, - 'gmail' => true, - 'gmo' => true, - 'gmx' => true, - 'godaddy' => true, - 'gold' => true, - 'goldpoint' => true, - 'golf' => true, - 'goo' => true, - 'goodhands' => true, - 'goodyear' => true, - 'goog' => true, - 'google' => true, - 'gop' => true, - 'got' => true, - 'gotv' => true, - 'grainger' => true, - 'graphics' => true, - 'gratis' => true, - 'green' => true, - 'gripe' => true, - 'group' => true, - 'guardian' => true, - 'gucci' => true, - 'guge' => true, - 'guide' => true, - 'guitars' => true, - 'guru' => true, - 'hair' => true, - 'hamburg' => true, - 'hangout' => true, - 'haus' => true, - 'hbo' => true, - 'hdfc' => true, - 'hdfcbank' => true, - 'health' => true, - 'healthcare' => true, - 'help' => true, - 'helsinki' => true, - 'here' => true, - 'hermes' => true, - 'hgtv' => true, - 'hiphop' => true, - 'hisamitsu' => true, - 'hitachi' => true, - 'hiv' => true, - 'hkt' => true, - 'hockey' => true, - 'holdings' => true, - 'holiday' => true, - 'homedepot' => true, - 'homegoods' => true, - 'homes' => true, - 'homesense' => true, - 'honda' => true, - 'honeywell' => true, - 'horse' => true, - 'host' => true, - 'hosting' => true, - 'hot' => true, - 'hoteles' => true, - 'hotmail' => true, - 'house' => true, - 'how' => true, - 'hsbc' => true, - 'htc' => true, - 'hughes' => true, - 'hyatt' => true, - 'hyundai' => true, - 'ibm' => true, - 'icbc' => true, - 'ice' => true, - 'icu' => true, - 'ieee' => true, - 'ifm' => true, - 'iinet' => true, - 'ikano' => true, - 'imamat' => true, - 'imdb' => true, - 'immo' => true, - 'immobilien' => true, - 'industries' => true, - 'infiniti' => true, - 'ing' => true, - 'ink' => true, - 'institute' => true, - 'insurance' => true, - 'insure' => true, - 'intel' => true, - 'international' => true, - 'intuit' => true, - 'investments' => true, - 'ipiranga' => true, - 'irish' => true, - 'iselect' => true, - 'ismaili' => true, - 'ist' => true, - 'istanbul' => true, - 'itau' => true, - 'itv' => true, - 'iveco' => true, - 'iwc' => true, - 'jaguar' => true, - 'java' => true, - 'jcb' => true, - 'jcp' => true, - 'jeep' => true, - 'jetzt' => true, - 'jewelry' => true, - 'jio' => true, - 'jlc' => true, - 'jll' => true, - 'jmp' => true, - 'jnj' => true, - 'joburg' => true, - 'jot' => true, - 'joy' => true, - 'jpmorgan' => true, - 'jprs' => true, - 'juegos' => true, - 'juniper' => true, - 'kaufen' => true, - 'kddi' => true, - 'kerryhotels' => true, - 'kerrylogistics' => true, - 'kerryproperties' => true, - 'kfh' => true, - 'kia' => true, - 'kim' => true, - 'kinder' => true, - 'kindle' => true, - 'kitchen' => true, - 'kiwi' => true, - 'koeln' => true, - 'komatsu' => true, - 'kosher' => true, - 'kpmg' => true, - 'kpn' => true, - 'krd' => true, - 'kred' => true, - 'kuokgroup' => true, - 'kyknet' => true, - 'kyoto' => true, - 'lacaixa' => true, - 'ladbrokes' => true, - 'lamborghini' => true, - 'lamer' => true, - 'lancaster' => true, - 'lancia' => true, - 'lancome' => true, - 'land' => true, - 'landrover' => true, - 'lanxess' => true, - 'lasalle' => true, - 'lat' => true, - 'latino' => true, - 'latrobe' => true, - 'law' => true, - 'lawyer' => true, - 'lds' => true, - 'lease' => true, - 'leclerc' => true, - 'lefrak' => true, - 'legal' => true, - 'lego' => true, - 'lexus' => true, - 'lgbt' => true, - 'liaison' => true, - 'lidl' => true, - 'life' => true, - 'lifeinsurance' => true, - 'lifestyle' => true, - 'lighting' => true, - 'like' => true, - 'lilly' => true, - 'limited' => true, - 'limo' => true, - 'lincoln' => true, - 'linde' => true, - 'link' => true, - 'lipsy' => true, - 'live' => true, - 'living' => true, - 'lixil' => true, - 'loan' => true, - 'loans' => true, - 'locker' => true, - 'locus' => true, - 'loft' => true, - 'lol' => true, - 'london' => true, - 'lotte' => true, - 'lotto' => true, - 'love' => true, - 'lpl' => true, - 'lplfinancial' => true, - 'ltd' => true, - 'ltda' => true, - 'lundbeck' => true, - 'lupin' => true, - 'luxe' => true, - 'luxury' => true, - 'macys' => true, - 'madrid' => true, - 'maif' => true, - 'maison' => true, - 'makeup' => true, - 'man' => true, - 'management' => true, - 'mango' => true, - 'market' => true, - 'marketing' => true, - 'markets' => true, - 'marriott' => true, - 'marshalls' => true, - 'maserati' => true, - 'mattel' => true, - 'mba' => true, - 'mcd' => true, - 'mcdonalds' => true, - 'mckinsey' => true, - 'med' => true, - 'media' => true, - 'meet' => true, - 'melbourne' => true, - 'meme' => true, - 'memorial' => true, - 'men' => true, - 'menu' => true, - 'meo' => true, - 'metlife' => true, - 'miami' => true, - 'microsoft' => true, - 'mini' => true, - 'mint' => true, - 'mit' => true, - 'mitsubishi' => true, - 'mlb' => true, - 'mls' => true, - 'mma' => true, - 'mnet' => true, - 'mobily' => true, - 'moda' => true, - 'moe' => true, - 'moi' => true, - 'mom' => true, - 'monash' => true, - 'money' => true, - 'monster' => true, - 'montblanc' => true, - 'mopar' => true, - 'mormon' => true, - 'mortgage' => true, - 'moscow' => true, - 'moto' => true, - 'motorcycles' => true, - 'mov' => true, - 'movie' => true, - 'movistar' => true, - 'msd' => true, - 'mtn' => true, - 'mtpc' => true, - 'mtr' => true, - 'multichoice' => true, - 'mutual' => true, - 'mutuelle' => true, - 'mzansimagic' => true, - 'nab' => true, - 'nadex' => true, - 'nagoya' => true, - 'naspers' => true, - 'nationwide' => true, - 'natura' => true, - 'navy' => true, - 'nba' => true, - 'nec' => true, - 'netbank' => true, - 'netflix' => true, - 'network' => true, - 'neustar' => true, - 'new' => true, - 'newholland' => true, - 'news' => true, - 'next' => true, - 'nextdirect' => true, - 'nexus' => true, - 'nfl' => true, - 'ngo' => true, - 'nhk' => true, - 'nico' => true, - 'nike' => true, - 'nikon' => true, - 'ninja' => true, - 'nissan' => true, - 'nissay' => true, - 'nokia' => true, - 'northwesternmutual' => true, - 'norton' => true, - 'now' => true, - 'nowruz' => true, - 'nowtv' => true, - 'nra' => true, - 'nrw' => true, - 'ntt' => true, - 'nyc' => true, - 'obi' => true, - 'observer' => true, - 'off' => true, - 'office' => true, - 'okinawa' => true, - 'olayan' => true, - 'olayangroup' => true, - 'oldnavy' => true, - 'ollo' => true, - 'omega' => true, - 'one' => true, - 'ong' => true, - 'onl' => true, - 'online' => true, - 'onyourside' => true, - 'ooo' => true, - 'open' => true, - 'oracle' => true, - 'orange' => true, - 'organic' => true, - 'orientexpress' => true, - 'origins' => true, - 'osaka' => true, - 'otsuka' => true, - 'ott' => true, - 'ovh' => true, - 'page' => true, - 'pamperedchef' => true, - 'panasonic' => true, - 'panerai' => true, - 'paris' => true, - 'pars' => true, - 'partners' => true, - 'parts' => true, - 'party' => true, - 'passagens' => true, - 'pay' => true, - 'payu' => true, - 'pccw' => true, - 'pet' => true, - 'pfizer' => true, - 'pharmacy' => true, - 'philips' => true, - 'photo' => true, - 'photography' => true, - 'photos' => true, - 'physio' => true, - 'piaget' => true, - 'pics' => true, - 'pictet' => true, - 'pictures' => true, - 'pid' => true, - 'pin' => true, - 'ping' => true, - 'pink' => true, - 'pioneer' => true, - 'pizza' => true, - 'place' => true, - 'play' => true, - 'playstation' => true, - 'plumbing' => true, - 'plus' => true, - 'pnc' => true, - 'pohl' => true, - 'poker' => true, - 'politie' => true, - 'porn' => true, - 'pramerica' => true, - 'praxi' => true, - 'press' => true, - 'prime' => true, - 'prod' => true, - 'productions' => true, - 'prof' => true, - 'progressive' => true, - 'promo' => true, - 'properties' => true, - 'property' => true, - 'protection' => true, - 'pru' => true, - 'prudential' => true, - 'pub' => true, - 'pwc' => true, - 'qpon' => true, - 'quebec' => true, - 'quest' => true, - 'qvc' => true, - 'racing' => true, - 'raid' => true, - 'read' => true, - 'realestate' => true, - 'realtor' => true, - 'realty' => true, - 'recipes' => true, - 'red' => true, - 'redstone' => true, - 'redumbrella' => true, - 'rehab' => true, - 'reise' => true, - 'reisen' => true, - 'reit' => true, - 'reliance' => true, - 'ren' => true, - 'rent' => true, - 'rentals' => true, - 'repair' => true, - 'report' => true, - 'republican' => true, - 'rest' => true, - 'restaurant' => true, - 'review' => true, - 'reviews' => true, - 'rexroth' => true, - 'rich' => true, - 'richardli' => true, - 'ricoh' => true, - 'rightathome' => true, - 'ril' => true, - 'rio' => true, - 'rip' => true, - 'rmit' => true, - 'rocher' => true, - 'rocks' => true, - 'rodeo' => true, - 'rogers' => true, - 'room' => true, - 'rsvp' => true, - 'ruhr' => true, - 'run' => true, - 'rwe' => true, - 'ryukyu' => true, - 'saarland' => true, - 'safe' => true, - 'safety' => true, - 'sakura' => true, - 'sale' => true, - 'salon' => true, - 'samsclub' => true, - 'samsung' => true, - 'sandvik' => true, - 'sandvikcoromant' => true, - 'sanofi' => true, - 'sap' => true, - 'sapo' => true, - 'sarl' => true, - 'sas' => true, - 'save' => true, - 'saxo' => true, - 'sbi' => true, - 'sbs' => true, - 'sca' => true, - 'scb' => true, - 'schaeffler' => true, - 'schmidt' => true, - 'scholarships' => true, - 'school' => true, - 'schule' => true, - 'schwarz' => true, - 'science' => true, - 'scjohnson' => true, - 'scor' => true, - 'scot' => true, - 'seat' => true, - 'secure' => true, - 'security' => true, - 'seek' => true, - 'select' => true, - 'sener' => true, - 'services' => true, - 'ses' => true, - 'seven' => true, - 'sew' => true, - 'sex' => true, - 'sexy' => true, - 'sfr' => true, - 'shangrila' => true, - 'sharp' => true, - 'shaw' => true, - 'shell' => true, - 'shia' => true, - 'shiksha' => true, - 'shoes' => true, - 'shouji' => true, - 'show' => true, - 'showtime' => true, - 'shriram' => true, - 'silk' => true, - 'sina' => true, - 'singles' => true, - 'site' => true, - 'ski' => true, - 'skin' => true, - 'sky' => true, - 'skype' => true, - 'sling' => true, - 'smart' => true, - 'smile' => true, - 'sncf' => true, - 'soccer' => true, - 'social' => true, - 'softbank' => true, - 'software' => true, - 'sohu' => true, - 'solar' => true, - 'solutions' => true, - 'song' => true, - 'sony' => true, - 'soy' => true, - 'space' => true, - 'spiegel' => true, - 'spot' => true, - 'spreadbetting' => true, - 'srl' => true, - 'srt' => true, - 'stada' => true, - 'staples' => true, - 'star' => true, - 'starhub' => true, - 'statebank' => true, - 'statefarm' => true, - 'statoil' => true, - 'stc' => true, - 'stcgroup' => true, - 'stockholm' => true, - 'storage' => true, - 'store' => true, - 'studio' => true, - 'study' => true, - 'style' => true, - 'sucks' => true, - 'supersport' => true, - 'supplies' => true, - 'supply' => true, - 'support' => true, - 'surf' => true, - 'surgery' => true, - 'suzuki' => true, - 'swatch' => true, - 'swiftcover' => true, - 'swiss' => true, - 'sydney' => true, - 'symantec' => true, - 'systems' => true, - 'tab' => true, - 'taipei' => true, - 'talk' => true, - 'taobao' => true, - 'target' => true, - 'tatamotors' => true, - 'tatar' => true, - 'tattoo' => true, - 'tax' => true, - 'taxi' => true, - 'tci' => true, - 'tdk' => true, - 'team' => true, - 'tech' => true, - 'technology' => true, - 'telecity' => true, - 'telefonica' => true, - 'temasek' => true, - 'tennis' => true, - 'teva' => true, - 'thd' => true, - 'theater' => true, - 'theatre' => true, - 'theguardian' => true, - 'tiaa' => true, - 'tickets' => true, - 'tienda' => true, - 'tiffany' => true, - 'tips' => true, - 'tires' => true, - 'tirol' => true, - 'tjmaxx' => true, - 'tjx' => true, - 'tkmaxx' => true, - 'tmall' => true, - 'today' => true, - 'tokyo' => true, - 'tools' => true, - 'top' => true, - 'toray' => true, - 'toshiba' => true, - 'total' => true, - 'tours' => true, - 'town' => true, - 'toyota' => true, - 'toys' => true, - 'trade' => true, - 'trading' => true, - 'training' => true, - 'travelchannel' => true, - 'travelers' => true, - 'travelersinsurance' => true, - 'trust' => true, - 'trv' => true, - 'tube' => true, - 'tui' => true, - 'tunes' => true, - 'tushu' => true, - 'tvs' => true, - 'ubank' => true, - 'ubs' => true, - 'uconnect' => true, - 'unicom' => true, - 'university' => true, - 'uno' => true, - 'uol' => true, - 'ups' => true, - 'vacations' => true, - 'vana' => true, - 'vanguard' => true, - 'vegas' => true, - 'ventures' => true, - 'verisign' => true, - 'versicherung' => true, - 'vet' => true, - 'viajes' => true, - 'video' => true, - 'vig' => true, - 'viking' => true, - 'villas' => true, - 'vin' => true, - 'vip' => true, - 'virgin' => true, - 'visa' => true, - 'vision' => true, - 'vista' => true, - 'vistaprint' => true, - 'viva' => true, - 'vivo' => true, - 'vlaanderen' => true, - 'vodka' => true, - 'volkswagen' => true, - 'volvo' => true, - 'vote' => true, - 'voting' => true, - 'voto' => true, - 'voyage' => true, - 'vuelos' => true, - 'wales' => true, - 'walmart' => true, - 'walter' => true, - 'wang' => true, - 'wanggou' => true, - 'warman' => true, - 'watch' => true, - 'watches' => true, - 'weather' => true, - 'weatherchannel' => true, - 'webcam' => true, - 'weber' => true, - 'website' => true, - 'wed' => true, - 'wedding' => true, - 'weibo' => true, - 'weir' => true, - 'whoswho' => true, - 'wien' => true, - 'wiki' => true, - 'williamhill' => true, - 'win' => true, - 'windows' => true, - 'wine' => true, - 'winners' => true, - 'wme' => true, - 'wolterskluwer' => true, - 'woodside' => true, - 'work' => true, - 'works' => true, - 'world' => true, - 'wow' => true, - 'wtc' => true, - 'wtf' => true, - 'xbox' => true, - 'xerox' => true, - 'xfinity' => true, - 'xihuan' => true, - 'xin' => true, - 'कॉम' => true, - 'セール' => true, - '佛山' => true, - '慈善' => true, - '集团' => true, - '在线' => true, - '大众汽车' => true, - '点看' => true, - 'คอม' => true, - '八卦' => true, - 'موقع' => true, - '一号店' => true, - '公益' => true, - '公司' => true, - '香格里拉' => true, - '网站' => true, - '移动' => true, - '我爱你' => true, - 'москва' => true, - 'католик' => true, - 'онлайн' => true, - 'сайт' => true, - '联通' => true, - 'קום' => true, - '时尚' => true, - '微博' => true, - '淡马锡' => true, - 'ファッション' => true, - 'орг' => true, - 'नेट' => true, - 'ストア' => true, - '삼성' => true, - '商标' => true, - '商店' => true, - '商城' => true, - 'дети' => true, - 'ポイント' => true, - '新闻' => true, - '工行' => true, - '家電' => true, - 'كوم' => true, - '中文网' => true, - '中信' => true, - '娱乐' => true, - '谷歌' => true, - '電訊盈科' => true, - '购物' => true, - 'クラウド' => true, - '通販' => true, - '网店' => true, - 'संगठन' => true, - '餐厅' => true, - '网络' => true, - 'ком' => true, - '诺基亚' => true, - '食品' => true, - '飞利浦' => true, - '手表' => true, - '手机' => true, - 'ارامكو' => true, - 'العليان' => true, - 'اتصالات' => true, - 'بازار' => true, - 'موبايلي' => true, - 'ابوظبي' => true, - 'كاثوليك' => true, - 'همراه' => true, - '닷컴' => true, - '政府' => true, - 'شبكة' => true, - 'بيتك' => true, - 'عرب' => true, - '机构' => true, - '组织机构' => true, - '健康' => true, - 'рус' => true, - '珠宝' => true, - '大拿' => true, - 'みんな' => true, - 'グーグル' => true, - '世界' => true, - '書籍' => true, - '网址' => true, - '닷넷' => true, - 'コム' => true, - '天主教' => true, - '游戏' => true, - 'vermögensberater' => true, - 'vermögensberatung' => true, - '企业' => true, - '信息' => true, - '嘉里大酒店' => true, - '嘉里' => true, - '广东' => true, - '政务' => true, - 'xperia' => true, - 'xyz' => true, - 'yachts' => true, - 'yahoo' => true, - 'yamaxun' => true, - 'yandex' => true, - 'yodobashi' => true, - 'yoga' => true, - 'yokohama' => true, - 'you' => true, - 'youtube' => true, - 'yun' => true, - 'zappos' => true, - 'zara' => true, - 'zero' => true, - 'zip' => true, - 'zippo' => true, - 'zone' => true, - 'zuerich' => true -); -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/docs/LICENSE
Deleted
@@ -1,31 +0,0 @@ -HTTP_Request2 - -Copyright (c) 2008-2016, Alexey Borzov <avb@php.net> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. Neither the name of Alexey Borzov nor the names of his contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE.
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/docs/examples/upload-rapidshare.php
Deleted
@@ -1,58 +0,0 @@ -<?php -/** - * Usage example for HTTP_Request2 package: uploading a file to rapidshare.com - * - * Inspired by Perl usage example: http://images.rapidshare.com/software/rsapi.pl - * Rapidshare API description: http://rapidshare.com/dev.html - */ - -require_once 'HTTP/Request2.php'; - -// You'll probably want to change this -$filename = '/etc/passwd'; - -try { - // First step: get an available upload server - $request = new HTTP_Request2( - 'http://rapidshare.com/cgi-bin/rsapi.cgi?sub=nextuploadserver_v1' - ); - $server = $request->send()->getBody(); - if (!preg_match('/^(\\d+)$/', $server)) { - throw new Exception("Invalid upload server: {$server}"); - } - - // Calculate file hash, we'll use it later to check upload - if (false === ($hash = @md5_file($filename))) { - throw new Exception("Cannot calculate MD5 hash of '{$filename}'"); - } - - // Second step: upload a file to the available server - $uploader = new HTTP_Request2( - "http://rs{$server}l3.rapidshare.com/cgi-bin/upload.cgi", - HTTP_Request2::METHOD_POST - ); - // Adding the file - $uploader->addUpload('filecontent', $filename); - // This will tell server to return program-friendly output - $uploader->addPostParameter('rsapi_v1', '1'); - - $response = $uploader->send()->getBody(); - if (!preg_match_all('/^(File^=+)=(.+)$/m', $response, $m, PREG_SET_ORDER)) { - throw new Exception("Invalid response: {$response}"); - } - $rspAry = array(); - foreach ($m as $item) { - $rspAry$item1 = $item2; - } - // Check that uploaded file has the same hash - if (empty($rspAry'File1.4')) { - throw new Exception("MD5 hash data not found in response"); - } elseif ($hash != strtolower($rspAry'File1.4')) { - throw new Exception("Upload failed, local MD5 is {$hash}, uploaded MD5 is {$rspAry'File1.4'}"); - } - echo "Upload succeeded\nDownload link: {$rspAry'File1.1'}\nDelete link: {$rspAry'File1.2'}\n"; - -} catch (Exception $e) { - echo "Error: " . $e->getMessage(); -} -?>
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/AllTests.php
Deleted
@@ -1,58 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -if (!defined('PHPUnit_MAIN_METHOD')) { - if (strpos($_SERVER'argv'0, 'phpunit') === false) { - define('PHPUnit_MAIN_METHOD', 'HTTP_Request2_AllTests::main'); - } else { - define('PHPUnit_MAIN_METHOD', false); - } -} - -require_once dirname(__FILE__) . '/Request2Test.php'; -require_once dirname(__FILE__) . '/ObserverTest.php'; -require_once dirname(__FILE__) . '/Request2/AllTests.php'; - -class HTTP_Request2_AllTests -{ - public static function main() - { - if (!class_exists('PHPUnit_TextUI_TestRunner', true)) { - require_once 'PHPUnit/TextUI/TestRunner.php'; - } - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('HTTP_Request2 package'); - - $suite->addTest(Request2_AllTests::suite()); - $suite->addTestSuite('HTTP_Request2Test'); - $suite->addTestSuite('HTTP_Request2_ObserverTest'); - - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'HTTP_Request2_AllTests::main') { - HTTP_Request2_AllTests::main(); -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/NetworkConfig.php.dist
Deleted
@@ -1,58 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** - * This file contains configuration needed for running HTTP_Request2 tests - * that interact with the network. Do not edit this file, copy it to - * NetworkConfig.php and edit the copy instead. - */ - -/** - * Base URL for HTTP_Request2 Adapters tests - * - * To enable the tests that actually perform network interaction, you should - * copy the contents of _network directory to a directory under your web - * server's document root or create a symbolic link to _network directory - * there. Set this constant to point to the URL of that directory. - */ -define('HTTP_REQUEST2_TESTS_BASE_URL', null); - -/** - * URL that is protected by server digest authentication - * - * This is needed for testing of 100 Continue handling, we can't implement - * digest in PHP since it will kick in a bit later - */ -define('HTTP_REQUEST2_TESTS_DIGEST_URL', null); - -/**#@+ - * Proxy setup for Socket Adapter tests - * - * Set these constants to run additional tests for Socket Adapter using a HTTP - * proxy. If proxy host is not set then the tests will not be run. - */ -define('HTTP_REQUEST2_TESTS_PROXY_HOST', null); -define('HTTP_REQUEST2_TESTS_PROXY_PORT', 8080); -define('HTTP_REQUEST2_TESTS_PROXY_USER', ''); -define('HTTP_REQUEST2_TESTS_PROXY_PASSWORD', ''); -define('HTTP_REQUEST2_TESTS_PROXY_AUTH_SCHEME', 'basic'); -define('HTTP_REQUEST2_TESTS_PROXY_TYPE', 'http'); -/**#@-*/ -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/ObserverTest.php
Deleted
@@ -1,95 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Sets up includes */ -require_once dirname(__FILE__) . '/TestHelper.php'; - -/** - * Class representing a HTTP request - */ -require_once 'HTTP/Request2.php'; - -/** - * Mock observer - */ -class HTTP_Request2_MockObserver implements SplObserver -{ - public $calls = 0; - - public $event; - - public function update (SplSubject $subject) - { - $this->calls++; - $this->event = $subject->getLastEvent(); - } -} - -/** - * Unit test for subject-observer pattern implementation in HTTP_Request2 - */ -class HTTP_Request2_ObserverTest extends PHPUnit_Framework_TestCase -{ - public function testSetLastEvent() - { - $request = new HTTP_Request2(); - $observer = new HTTP_Request2_MockObserver(); - $request->attach($observer); - - $request->setLastEvent('foo', 'bar'); - $this->assertEquals(1, $observer->calls); - $this->assertEquals(array('name' => 'foo', 'data' => 'bar'), $observer->event); - - $request->setLastEvent('baz'); - $this->assertEquals(2, $observer->calls); - $this->assertEquals(array('name' => 'baz', 'data' => null), $observer->event); - } - - public function testAttachOnlyOnce() - { - $request = new HTTP_Request2(); - $observer = new HTTP_Request2_MockObserver(); - $observer2 = new HTTP_Request2_MockObserver(); - $request->attach($observer); - $request->attach($observer2); - $request->attach($observer); - - $request->setLastEvent('event', 'data'); - $this->assertEquals(1, $observer->calls); - $this->assertEquals(1, $observer2->calls); - } - - public function testDetach() - { - $request = new HTTP_Request2(); - $observer = new HTTP_Request2_MockObserver(); - $observer2 = new HTTP_Request2_MockObserver(); - - $request->attach($observer); - $request->detach($observer2); // should not be a error - $request->setLastEvent('first'); - - $request->detach($observer); - $request->setLastEvent('second'); - $this->assertEquals(1, $observer->calls); - $this->assertEquals(array('name' => 'first', 'data' => null), $observer->event); - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/Adapter/AllTests.php
Deleted
@@ -1,77 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -if (!defined('PHPUnit_MAIN_METHOD')) { - if (strpos($_SERVER'argv'0, 'phpunit') === false) { - define('PHPUnit_MAIN_METHOD', 'Request2_Adapter_AllTests::main'); - } else { - define('PHPUnit_MAIN_METHOD', false); - } -} - -require_once dirname(__FILE__) . '/MockTest.php'; -require_once dirname(__FILE__) . '/SkippedTests.php'; -require_once dirname(__FILE__) . '/SocketTest.php'; -require_once dirname(__FILE__) . '/SocketProxyTest.php'; -require_once dirname(__FILE__) . '/CurlTest.php'; - -class Request2_Adapter_AllTests -{ - public static function main() - { - if (!class_exists('PHPUnit_TextUI_TestRunner', true)) { - require_once 'PHPUnit/TextUI/TestRunner.php'; - } - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('HTTP_Request2 package - Request2 - Adapter'); - - $suite->addTestSuite('HTTP_Request2_Adapter_MockTest'); - if (defined('HTTP_REQUEST2_TESTS_BASE_URL') && HTTP_REQUEST2_TESTS_BASE_URL) { - $suite->addTestSuite('HTTP_Request2_Adapter_SocketTest'); - } else { - $suite->addTestSuite('HTTP_Request2_Adapter_Skip_SocketTest'); - } - if (defined('HTTP_REQUEST2_TESTS_PROXY_HOST') && HTTP_REQUEST2_TESTS_PROXY_HOST - && defined('HTTP_REQUEST2_TESTS_BASE_URL') && HTTP_REQUEST2_TESTS_BASE_URL - ) { - $suite->addTestSuite('HTTP_Request2_Adapter_SocketProxyTest'); - } else { - $suite->addTestSuite('HTTP_Request2_Adapter_Skip_SocketProxyTest'); - } - if (defined('HTTP_REQUEST2_TESTS_BASE_URL') && HTTP_REQUEST2_TESTS_BASE_URL - && extension_loaded('curl') - ) { - $suite->addTestSuite('HTTP_Request2_Adapter_CurlTest'); - } else { - $suite->addTestSuite('HTTP_Request2_Adapter_Skip_CurlTest'); - } - - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'Request2_Adapter_AllTests::main') { - Request2_Adapter_AllTests::main(); -} -?>
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/Adapter/CommonNetworkTest.php
Deleted
@@ -1,512 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Sets up includes */ -require_once dirname(dirname(dirname(__FILE__))) . '/TestHelper.php'; - -/** Class representing a HTTP request */ -require_once 'HTTP/Request2.php'; -/** Class for building multipart/form-data request body */ -require_once 'HTTP/Request2/MultipartBody.php'; -/** An observer that saves response body to stream, possibly uncompressing it */ -require_once 'HTTP/Request2/Observer/UncompressingDownload.php'; - -class SlowpokeBody extends HTTP_Request2_MultipartBody -{ - protected $doSleep; - - public function rewind() - { - $this->doSleep = true; - parent::rewind(); - } - - public function read($length) - { - if ($this->doSleep) { - sleep(3); - $this->doSleep = false; - } - return parent::read($length); - } -} - -class HeaderObserver implements SplObserver -{ - public $headers; - - public function update(SplSubject $subject) - { - /* @var $subject HTTP_Request2 */ - $event = $subject->getLastEvent(); - - // force a timeout when writing request body - if ('sentHeaders' == $event'name') { - $this->headers = $event'data'; - } - } -} - -class EventSequenceObserver implements SplObserver -{ - private $_watched = array(); - - public $sequence = array(); - - public function __construct(array $watchedEvents = array()) - { - if (!empty($watchedEvents)) { - $this->_watched = $watchedEvents; - } - } - - public function update(SplSubject $subject) - { - /* @var $subject HTTP_Request2 */ - $event = $subject->getLastEvent(); - - if ($event'name' !== end($this->sequence) - && (empty($this->_watched) || in_array($event'name', $this->_watched, true)) - ) { - $this->sequence = $event'name'; - } - } -} - - -/** - * Tests for HTTP_Request2 package that require a working webserver - * - * The class contains some common tests that should be run for all Adapters, - * it is extended by their unit tests. - * - * You need to properly set up this test suite, refer to NetworkConfig.php.dist - */ -abstract class HTTP_Request2_Adapter_CommonNetworkTest extends PHPUnit_Framework_TestCase -{ - /** - * HTTP Request object - * @var HTTP_Request2 - */ - protected $request; - - /** - * Base URL for remote test files - * @var string - */ - protected $baseUrl; - - /** - * Configuration for HTTP Request object - * @var array - */ - protected $config = array(); - - protected function setUp() - { - if (!defined('HTTP_REQUEST2_TESTS_BASE_URL') || !HTTP_REQUEST2_TESTS_BASE_URL) { - $this->markTestSkipped('Base URL is not configured'); - - } else { - $this->baseUrl = rtrim(HTTP_REQUEST2_TESTS_BASE_URL, '/') . '/'; - $name = strtolower(preg_replace('/^test/i', '', $this->getName())) . '.php'; - - $this->request = new HTTP_Request2( - $this->baseUrl . $name, HTTP_Request2::METHOD_GET, $this->config - ); - } - } - - /** - * Tests possibility to send GET parameters - * - * NB: Currently there are problems with Net_URL2::setQueryVariables(), thus - * array structure is simple: http://pear.php.net/bugs/bug.php?id=18267 - */ - public function testGetParameters() - { - $data = array( - 'bar' => array( - 'key' => 'value' - ), - 'foo' => 'some value', - 'numbered' => array('first', 'second') - ); - - $this->request->getUrl()->setQueryVariables($data); - $response = $this->request->send(); - $this->assertEquals(serialize($data), $response->getBody()); - } - - public function testPostParameters() - { - $data = array( - 'bar' => array( - 'key' => 'some other value' - ), - 'baz' => array( - 'key1' => array( - 'key2' => 'yet another value' - ) - ), - 'foo' => 'some value', - 'indexed' => array('first', 'second') - ); - $events = array( - 'sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders', 'receivedBodyPart', 'receivedBody' - ); - $observer = new EventSequenceObserver($events); - - $this->request->setMethod(HTTP_Request2::METHOD_POST) - ->setHeader('Accept-Encoding', 'identity') - ->addPostParameter($data) - ->attach($observer); - - $response = $this->request->send(); - $this->assertEquals(serialize($data), $response->getBody()); - $this->assertEquals($events, $observer->sequence); - } - - public function testUploads() - { - $this->request->setMethod(HTTP_Request2::METHOD_POST) - ->addUpload('foo', dirname(dirname(dirname(__FILE__))) . '/_files/empty.gif', 'picture.gif', 'image/gif') - ->addUpload('bar', array( - array(dirname(dirname(dirname(__FILE__))) . '/_files/empty.gif', null, 'image/gif'), - array(dirname(dirname(dirname(__FILE__))) . '/_files/plaintext.txt', 'secret.txt', 'text/x-whatever') - )); - - $response = $this->request->send(); - $this->assertContains("foo picture.gif image/gif 43", $response->getBody()); - $this->assertContains("bar0 empty.gif image/gif 43", $response->getBody()); - $this->assertContains("bar1 secret.txt text/x-whatever 15", $response->getBody()); - } - - public function testRawPostData() - { - $data = 'Nothing to see here, move along'; - - $this->request->setMethod(HTTP_Request2::METHOD_POST) - ->setBody($data); - $response = $this->request->send(); - $this->assertEquals($data, $response->getBody()); - } - - public function testCookies() - { - $cookies = array( - 'CUSTOMER' => 'WILE_E_COYOTE', - 'PART_NUMBER' => 'ROCKET_LAUNCHER_0001' - ); - - foreach ($cookies as $k => $v) { - $this->request->addCookie($k, $v); - } - $response = $this->request->send(); - $this->assertEquals(serialize($cookies), $response->getBody()); - } - - public function testTimeout() - { - $this->request->setConfig('timeout', 2); - try { - $this->request->send(); - $this->fail('Expected HTTP_Request2_Exception was not thrown'); - } catch (HTTP_Request2_MessageException $e) { - $this->assertEquals(HTTP_Request2_Exception::TIMEOUT, $e->getCode()); - } - } - - public function testTimeoutInRequest() - { - $this->request->setConfig('timeout', 2) - ->setUrl($this->baseUrl . 'postparameters.php') - ->setBody(new SlowpokeBody(array('foo' => 'some value'), array())); - try { - $this->request->send(); - $this->fail('Expected HTTP_Request2_MessageException was not thrown'); - } catch (HTTP_Request2_MessageException $e) { - $this->assertEquals(HTTP_Request2_Exception::TIMEOUT, $e->getCode()); - } - } - - public function testBasicAuth() - { - $this->request->getUrl()->setQueryVariables(array( - 'user' => 'luser', - 'pass' => 'qwerty' - )); - $wrong = clone $this->request; - - $this->request->setAuth('luser', 'qwerty'); - $response = $this->request->send(); - $this->assertEquals(200, $response->getStatus()); - - $wrong->setAuth('luser', 'password'); - $response = $wrong->send(); - $this->assertEquals(401, $response->getStatus()); - } - - public function testDigestAuth() - { - $this->request->getUrl()->setQueryVariables(array( - 'user' => 'luser', - 'pass' => 'qwerty' - )); - $wrong = clone $this->request; - $observer = new EventSequenceObserver(array('sentHeaders', 'receivedHeaders')); - - $this->request->setAuth('luser', 'qwerty', HTTP_Request2::AUTH_DIGEST) - ->attach($observer); - $response = $this->request->send(); - $this->assertEquals(200, $response->getStatus()); - $this->assertEquals( - array('sentHeaders', 'receivedHeaders', 'sentHeaders', 'receivedHeaders'), - $observer->sequence - ); - - $wrong->setAuth('luser', 'password', HTTP_Request2::AUTH_DIGEST); - $response = $wrong->send(); - $this->assertEquals(401, $response->getStatus()); - } - - public function testRedirectsDefault() - { - $observer = new EventSequenceObserver(array('sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders')); - $this->request->setUrl($this->baseUrl . 'redirects.php') - ->setConfig(array('follow_redirects' => true, 'strict_redirects' => false)) - ->setMethod(HTTP_Request2::METHOD_POST) - ->addPostParameter('foo', 'foo value') - ->attach($observer); - - $response = $this->request->send(); - $this->assertContains('Method=GET', $response->getBody()); - $this->assertNotContains('foo', $response->getBody()); - $this->assertEquals($this->baseUrl . 'redirects.php?redirects=0', $response->getEffectiveUrl()); - $this->assertEquals( - array('sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders', 'sentHeaders', 'receivedHeaders'), - $observer->sequence - ); - } - - public function testRedirectsStrict() - { - $observer = new EventSequenceObserver(array('sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders')); - $this->request->setUrl($this->baseUrl . 'redirects.php') - ->setConfig(array('follow_redirects' => true, 'strict_redirects' => true)) - ->setMethod(HTTP_Request2::METHOD_POST) - ->addPostParameter('foo', 'foo value') - ->attach($observer); - - $response = $this->request->send(); - $this->assertContains('Method=POST', $response->getBody()); - $this->assertContains('foo', $response->getBody()); - $this->assertEquals( - array('sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders', - 'sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders'), - $observer->sequence - ); - } - - public function testRedirectsLimit() - { - $this->request->setUrl($this->baseUrl . 'redirects.php?redirects=4') - ->setConfig(array('follow_redirects' => true, 'max_redirects' => 2)); - - try { - $this->request->send(); - $this->fail('Expected HTTP_Request2_Exception was not thrown'); - } catch (HTTP_Request2_MessageException $e) { - $this->assertEquals(HTTP_Request2_Exception::TOO_MANY_REDIRECTS, $e->getCode()); - } - } - - public function testRedirectsRelative() - { - $this->request->setUrl($this->baseUrl . 'redirects.php?special=relative') - ->setConfig(array('follow_redirects' => true)); - - $response = $this->request->send(); - $this->assertContains('did relative', $response->getBody()); - } - - public function testRedirectsNonHTTP() - { - $this->request->setUrl($this->baseUrl . 'redirects.php?special=ftp') - ->setConfig(array('follow_redirects' => true)); - - try { - $this->request->send(); - $this->fail('Expected HTTP_Request2_Exception was not thrown'); - } catch (HTTP_Request2_MessageException $e) { - $this->assertEquals(HTTP_Request2_Exception::NON_HTTP_REDIRECT, $e->getCode()); - } - } - - public function testCookieJar() - { - $this->request->setUrl($this->baseUrl . 'setcookie.php?name=cookie_name&value=cookie_value'); - $req2 = clone $this->request; - - $this->request->setCookieJar()->send(); - $jar = $this->request->getCookieJar(); - $jar->store( - array('name' => 'foo', 'value' => 'bar'), - $this->request->getUrl() - ); - - $response = $req2->setUrl($this->baseUrl . 'cookies.php')->setCookieJar($jar)->send(); - $this->assertEquals( - serialize(array('cookie_name' => 'cookie_value', 'foo' => 'bar')), - $response->getBody() - ); - } - - public function testCookieJarAndRedirect() - { - $this->request->setUrl($this->baseUrl . 'redirects.php?special=cookie') - ->setConfig('follow_redirects', true) - ->setCookieJar(); - - $response = $this->request->send(); - $this->assertEquals(serialize(array('cookie_on_redirect' => 'success')), $response->getBody()); - } - - /** - * @link http://pear.php.net/bugs/bug.php?id=20125 - */ - public function testChunkedRequest() - { - $data = array( - 'long' => str_repeat('a', 1000), - 'very_long' => str_repeat('b', 2000) - ); - - $this->request->setMethod(HTTP_Request2::METHOD_POST) - ->setUrl($this->baseUrl . 'postparameters.php') - ->setConfig('buffer_size', 512) - ->setHeader('Transfer-Encoding', 'chunked') - ->addPostParameter($data); - - $response = $this->request->send(); - $this->assertEquals(serialize($data), $response->getBody()); - } - - /** - * @link http://pear.php.net/bugs/bug.php?id=19233 - * @link http://pear.php.net/bugs/bug.php?id=15937 - */ - public function testPreventExpectHeader() - { - $fp = fopen(dirname(dirname(dirname(__FILE__))) . '/_files/bug_15305', 'rb'); - $observer = new HeaderObserver(); - $body = new HTTP_Request2_MultipartBody( - array(), - array( - 'upload' => array( - 'fp' => $fp, - 'filename' => 'bug_15305', - 'type' => 'application/octet-stream', - 'size' => 16338 - ) - ) - ); - - $this->request->setMethod(HTTP_Request2::METHOD_POST) - ->setUrl($this->baseUrl . 'uploads.php') - ->setHeader('Expect', '') - ->setBody($body) - ->attach($observer); - - $response = $this->request->send(); - $this->assertNotContains('Expect:', $observer->headers); - $this->assertContains('upload bug_15305 application/octet-stream 16338', $response->getBody()); - } - - public function testDownloadObserverWithPlainBody() - { - $fp = fopen('php://memory', 'r+'); - $observer = new HTTP_Request2_Observer_UncompressingDownload($fp); - - $this->request->setConfig('store_body', false) - ->setUrl($this->baseUrl . 'download.php') - ->attach($observer); - - $this->request->send(); - rewind($fp); - $this->assertEquals(str_repeat('0123456789abcdef', 128), fread($fp, 8192)); - } - - public function testDownloadObserverWithGzippedBody() - { - $fp = fopen('php://memory', 'r+'); - $observer = new HTTP_Request2_Observer_UncompressingDownload($fp); - - $this->request->setConfig('store_body', false) - ->attach($observer); - - $normal = clone $this->request; - $normal->setUrl($this->baseUrl . 'download.php?gzip') - ->send(); - - $slow = clone $this->request; - $slow->setUrl($this->baseUrl . 'download.php?gzip&slowpoke') - ->send(); - - rewind($fp); - $this->assertEquals(str_repeat('0123456789abcdef', 256), fread($fp, 8192)); - } - - /** - * @expectedException HTTP_Request2_MessageException - * @expectedExceptionMessage Body length limit - */ - public function testDownloadObserverEnforcesSizeLimit() - { - $fp = fopen('php://memory', 'r+'); - $observer = new HTTP_Request2_Observer_UncompressingDownload($fp, 1000); - - $this->request->setConfig('store_body', false) - ->setUrl($this->baseUrl . 'download.php?gzip') - ->attach($observer); - - $this->request->send(); - } - - public function testIncompleteBody() - { - $events = array('receivedBodyPart', 'warning', 'receivedBody'); - $this->request->setHeader('Accept-Encoding', 'identity'); - - $plain = clone $this->request; - $plain->attach($observer = new EventSequenceObserver($events)); - $response = $plain->send(); - $this->assertEquals('This is a test', $response->getBody()); - $this->assertEquals($events, $observer->sequence); - - $chunked = clone $this->request; - $chunked->getUrl()->setQueryVariable('chunked', 'yep'); - $chunked->attach($observer = new EventSequenceObserver($events)); - $response = $chunked->send(); - $this->assertEquals('This is a test', $response->getBody()); - $this->assertEquals($events, $observer->sequence); - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/Adapter/CurlTest.php
Deleted
@@ -1,180 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Tests for HTTP_Request2 package that require a working webserver */ -require_once dirname(__FILE__) . '/CommonNetworkTest.php'; - -class UploadSizeObserver implements SplObserver -{ - public $size; - - public function update(SplSubject $subject) - { - /* @var $subject HTTP_Request2 */ - $event = $subject->getLastEvent(); - - if ('sentBody' == $event'name') { - $this->size = $event'data'; - } - } - -} - -/** - * Unit test for Curl Adapter of HTTP_Request2 - */ -class HTTP_Request2_Adapter_CurlTest extends HTTP_Request2_Adapter_CommonNetworkTest -{ - /** - * Configuration for HTTP Request object - * @var array - */ - protected $config = array( - 'adapter' => 'HTTP_Request2_Adapter_Curl' - ); - - /** - * Checks whether redirect support in cURL is disabled by safe_mode or open_basedir - * @return bool - */ - protected function isRedirectSupportDisabled() - { - return ini_get('safe_mode') || ini_get('open_basedir'); - } - - public function testRedirectsDefault() - { - if ($this->isRedirectSupportDisabled()) { - $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); - } else { - parent::testRedirectsDefault(); - } - } - - public function testRedirectsStrict() - { - if ($this->isRedirectSupportDisabled()) { - $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); - } elseif (version_compare(phpversion(), '5.3.2', '<')) { - $this->markTestSkipped('CURLOPT_POSTREDIR required for strict redirects, available in PHP 5.3.2+'); - } else { - parent::testRedirectsStrict(); - } - } - - public function testRedirectsLimit() - { - if ($this->isRedirectSupportDisabled()) { - $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); - } else { - parent::testRedirectsLimit(); - } - } - - public function testRedirectsRelative() - { - if ($this->isRedirectSupportDisabled()) { - $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); - } else { - parent::testRedirectsRelative(); - } - } - - public function testRedirectsNonHTTP() - { - if ($this->isRedirectSupportDisabled()) { - $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); - } else { - parent::testRedirectsNonHTTP(); - } - } - - public function testCookieJarAndRedirect() - { - if ($this->isRedirectSupportDisabled()) { - $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); - } else { - parent::testCookieJarAndRedirect(); - } - } - - public function testBug17450() - { - if (!$this->isRedirectSupportDisabled()) { - $this->markTestSkipped('Neither safe_mode nor open_basedir is enabled'); - } - - $this->request->setUrl($this->baseUrl . 'redirects.php') - ->setConfig(array('follow_redirects' => true)); - - try { - $this->request->send(); - $this->fail('Expected HTTP_Request2_Exception was not thrown'); - - } catch (HTTP_Request2_LogicException $e) { - $this->assertEquals(HTTP_Request2_Exception::MISCONFIGURATION, $e->getCode()); - } - } - - public function testBug20440() - { - $this->request->setUrl($this->baseUrl . 'rawpostdata.php') - ->setMethod(HTTP_Request2::METHOD_PUT) - ->setHeader('Expect', '') - ->setBody('This is a test'); - - $noredirects = clone $this->request; - $noredirects->setConfig('follow_redirects', false) - ->attach($observer = new UploadSizeObserver()); - $noredirects->send(); - // Curl sends body with Transfer-encoding: chunked, so size can be larger - $this->assertGreaterThanOrEqual(14, $observer->size); - - $redirects = clone $this->request; - $redirects->setConfig('follow_redirects', true) - ->attach($observer = new UploadSizeObserver()); - $redirects->send(); - $this->assertGreaterThanOrEqual(14, $observer->size); - } - - /** - * An URL performing a redirect was used for storing cookies in a jar rather than target URL - * - * @link http://pear.php.net/bugs/bug.php?id=20561 - */ - public function testBug20561() - { - if ($this->isRedirectSupportDisabled()) { - $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); - - } else { - $this->request->setUrl($this->baseUrl . 'redirects.php?special=youtube') - ->setConfig(array( - 'follow_redirects' => true, - 'ssl_verify_peer' => false - )) - ->setCookieJar(true); - - $this->request->send(); - $this->assertGreaterThan(0, count($this->request->getCookieJar()->getAll())); - } - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/Adapter/MockTest.php
Deleted
@@ -1,157 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Sets up includes */ -require_once dirname(dirname(dirname(__FILE__))) . '/TestHelper.php'; - -/** - * Class representing a HTTP request - */ -require_once 'HTTP/Request2.php'; - -/** - * Mock adapter intended for testing - */ -require_once 'HTTP/Request2/Adapter/Mock.php'; - -/** - * Unit test for HTTP_Request2_Response class - */ -class HTTP_Request2_Adapter_MockTest extends PHPUnit_Framework_TestCase -{ - public function testDefaultResponse() - { - $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_GET, - array('adapter' => 'mock')); - $response = $req->send(); - $this->assertEquals(400, $response->getStatus()); - $this->assertEquals(0, count($response->getHeader())); - $this->assertEquals('', $response->getBody()); - } - - public function testResponseFromString() - { - $mock = new HTTP_Request2_Adapter_Mock(); - $mock->addResponse( - "HTTP/1.1 200 OK\r\n" . - "Content-Type: text/plain; charset=iso-8859-1\r\n" . - "\r\n" . - "This is a string" - ); - $req = new HTTP_Request2('http://www.example.com/'); - $req->setAdapter($mock); - - $response = $req->send(); - $this->assertEquals(200, $response->getStatus()); - $this->assertEquals(1, count($response->getHeader())); - $this->assertEquals('This is a string', $response->getBody()); - } - - public function testResponseFromFile() - { - $mock = new HTTP_Request2_Adapter_Mock(); - $mock->addResponse(fopen(dirname(dirname(dirname(__FILE__))) . - '/_files/response_headers', 'rb')); - - $req = new HTTP_Request2('http://www.example.com/'); - $req->setAdapter($mock); - - $response = $req->send(); - $this->assertEquals(200, $response->getStatus()); - $this->assertEquals(7, count($response->getHeader())); - $this->assertEquals('Nothing to see here, move along.', $response->getBody()); - } - - public function testResponsesQueue() - { - $mock = new HTTP_Request2_Adapter_Mock(); - $mock->addResponse( - "HTTP/1.1 301 Over there\r\n" . - "Location: http://www.example.com/newpage.html\r\n" . - "\r\n" . - "The document is over there" - ); - $mock->addResponse( - "HTTP/1.1 200 OK\r\n" . - "Content-Type: text/plain; charset=iso-8859-1\r\n" . - "\r\n" . - "This is a string" - ); - - $req = new HTTP_Request2('http://www.example.com/'); - $req->setAdapter($mock); - $this->assertEquals(301, $req->send()->getStatus()); - $this->assertEquals(200, $req->send()->getStatus()); - $this->assertEquals(400, $req->send()->getStatus()); - } - - /** - * Returning URL-specific responses - * @link http://pear.php.net/bugs/bug.php?id=19276 - */ - public function testRequest19276() - { - $mock = new HTTP_Request2_Adapter_Mock(); - $mock->addResponse( - "HTTP/1.1 200 OK\r\n" . - "Content-Type: text/plain; charset=iso-8859-1\r\n" . - "\r\n" . - "This is a response from example.org", - 'http://example.org/' - ); - $mock->addResponse( - "HTTP/1.1 200 OK\r\n" . - "Content-Type: text/plain; charset=iso-8859-1\r\n" . - "\r\n" . - "This is a response from example.com", - 'http://example.com/' - ); - - $req1 = new HTTP_Request2('http://localhost/'); - $req1->setAdapter($mock); - $this->assertEquals(400, $req1->send()->getStatus()); - - $req2 = new HTTP_Request2('http://example.com/'); - $req2->setAdapter($mock); - $this->assertContains('example.com', $req2->send()->getBody()); - - $req3 = new HTTP_Request2('http://example.org'); - $req3->setAdapter($mock); - $this->assertContains('example.org', $req3->send()->getBody()); - } - - public function testResponseException() - { - $mock = new HTTP_Request2_Adapter_Mock(); - $mock->addResponse( - new HTTP_Request2_Exception('Shit happens') - ); - $req = new HTTP_Request2('http://www.example.com/'); - $req->setAdapter($mock); - try { - $req->send(); - } catch (Exception $e) { - $this->assertEquals('Shit happens', $e->getMessage()); - return; - } - $this->fail('Expected HTTP_Request2_Exception was not thrown'); - } -} -?>
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/Adapter/SkippedTests.php
Deleted
@@ -1,56 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Sets up includes */ -require_once dirname(dirname(dirname(__FILE__))) . '/TestHelper.php'; - -/** - * Shows a skipped test if networked tests are not configured - */ -class HTTP_Request2_Adapter_Skip_SocketTest extends PHPUnit_Framework_TestCase -{ - public function testSocketAdapter() - { - $this->markTestSkipped('Socket Adapter tests need base URL configured.'); - } -} - -/** - * Shows a skipped test if proxy is not configured - */ -class HTTP_Request2_Adapter_Skip_SocketProxyTest extends PHPUnit_Framework_TestCase -{ - public function testSocketAdapterWithProxy() - { - $this->markTestSkipped('Socket Adapter proxy tests need base URL and proxy configured'); - } -} - -/** - * Shows a skipped test if networked tests are not configured or cURL extension is unavailable - */ -class HTTP_Request2_Adapter_Skip_CurlTest extends PHPUnit_Framework_TestCase -{ - public function testCurlAdapter() - { - $this->markTestSkipped('Curl Adapter tests need base URL configured and curl extension available'); - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/Adapter/SocketProxyTest.php
Deleted
@@ -1,55 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Tests for HTTP_Request2 package that require a working webserver */ -require_once dirname(__FILE__) . '/CommonNetworkTest.php'; - -/** - * Unit test for Socket Adapter of HTTP_Request2 working through proxy - */ -class HTTP_Request2_Adapter_SocketProxyTest extends HTTP_Request2_Adapter_CommonNetworkTest -{ - /** - * Configuration for HTTP Request object - * @var array - */ - protected $config = array( - 'adapter' => 'HTTP_Request2_Adapter_Socket' - ); - - protected function setUp() - { - if (!defined('HTTP_REQUEST2_TESTS_PROXY_HOST') || !HTTP_REQUEST2_TESTS_PROXY_HOST) { - $this->markTestSkipped('Proxy is not configured'); - - } else { - $this->config += array( - 'proxy_host' => HTTP_REQUEST2_TESTS_PROXY_HOST, - 'proxy_port' => HTTP_REQUEST2_TESTS_PROXY_PORT, - 'proxy_user' => HTTP_REQUEST2_TESTS_PROXY_USER, - 'proxy_password' => HTTP_REQUEST2_TESTS_PROXY_PASSWORD, - 'proxy_auth_scheme' => HTTP_REQUEST2_TESTS_PROXY_AUTH_SCHEME, - 'proxy_type' => HTTP_REQUEST2_TESTS_PROXY_TYPE - ); - parent::setUp(); - } - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/Adapter/SocketTest.php
Deleted
@@ -1,191 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Tests for HTTP_Request2 package that require a working webserver */ -require_once dirname(__FILE__) . '/CommonNetworkTest.php'; - -/** Socket-based adapter for HTTP_Request2 */ -require_once 'HTTP/Request2/Adapter/Socket.php'; - -/** - * Unit test for Socket Adapter of HTTP_Request2 - */ -class HTTP_Request2_Adapter_SocketTest extends HTTP_Request2_Adapter_CommonNetworkTest -{ - /** - * Configuration for HTTP Request object - * @var array - */ - protected $config = array( - 'adapter' => 'HTTP_Request2_Adapter_Socket' - ); - - public function testBug17826() - { - $adapter = new HTTP_Request2_Adapter_Socket(); - - $request1 = new HTTP_Request2($this->baseUrl . 'redirects.php?redirects=2'); - $request1->setConfig(array('follow_redirects' => true, 'max_redirects' => 3)) - ->setAdapter($adapter) - ->send(); - - $request2 = new HTTP_Request2($this->baseUrl . 'redirects.php?redirects=2'); - $request2->setConfig(array('follow_redirects' => true, 'max_redirects' => 3)) - ->setAdapter($adapter) - ->send(); - } - - - /** - * Infinite loop with stream wrapper passed as upload - * - * Dunno how the original reporter managed to pass a file pointer - * that doesn't support fstat() to MultipartBody, maybe he didn't use - * addUpload(). So we don't use it, either. - * - * @link http://pear.php.net/bugs/bug.php?id=19934 - */ - public function testBug19934() - { - if (!in_array('http', stream_get_wrappers())) { - $this->markTestSkipped("This test requires an HTTP fopen wrapper enabled"); - } - - $fp = fopen($this->baseUrl . '/bug19934.php', 'rb'); - $body = new HTTP_Request2_MultipartBody( - array(), - array( - 'upload' => array( - 'fp' => $fp, - 'filename' => 'foo.txt', - 'type' => 'text/plain', - 'size' => 20000 - ) - ) - ); - $this->request->setMethod(HTTP_Request2::METHOD_POST) - ->setUrl($this->baseUrl . 'uploads.php') - ->setBody($body); - - set_error_handler(array($this, 'rewindWarningsHandler')); - $response = $this->request->send(); - restore_error_handler(); - - $this->assertContains("upload foo.txt text/plain 20000", $response->getBody()); - } - - public function rewindWarningsHandler($errno, $errstr) - { - if (($errno & E_WARNING) && false !== strpos($errstr, 'rewind')) { - return true; - } - return false; - } - - /** - * Do not send request body twice to URLs protected by digest auth - * - * @link http://pear.php.net/bugs/bug.php?id=19233 - */ - public function test100ContinueHandling() - { - if (!defined('HTTP_REQUEST2_TESTS_DIGEST_URL') || !HTTP_REQUEST2_TESTS_DIGEST_URL) { - $this->markTestSkipped('This test requires an URL protected by server digest auth'); - } - - $fp = fopen(dirname(dirname(dirname(__FILE__))) . '/_files/bug_15305', 'rb'); - $body = $this->getMock( - 'HTTP_Request2_MultipartBody', array('read'), array( - array(), - array( - 'upload' => array( - 'fp' => $fp, - 'filename' => 'bug_15305', - 'type' => 'application/octet-stream', - 'size' => 16338 - ) - ) - ) - ); - $body->expects($this->never())->method('read'); - - $this->request->setMethod(HTTP_Request2::METHOD_POST) - ->setUrl(HTTP_REQUEST2_TESTS_DIGEST_URL) - ->setBody($body); - - $this->assertEquals(401, $this->request->send()->getStatus()); - } - - public function test100ContinueTimeoutBug() - { - $fp = fopen(dirname(dirname(dirname(__FILE__))) . '/_files/bug_15305', 'rb'); - $body = new HTTP_Request2_MultipartBody( - array(), - array( - 'upload' => array( - 'fp' => $fp, - 'filename' => 'bug_15305', - 'type' => 'application/octet-stream', - 'size' => 16338 - ) - ) - ); - - $this->request->setMethod(HTTP_Request2::METHOD_POST) - ->setUrl($this->baseUrl . 'uploads.php?slowpoke') - ->setBody($body); - - $response = $this->request->send(); - $this->assertContains('upload bug_15305 application/octet-stream 16338', $response->getBody()); - } - - /** - * Socket adapter should not throw an exception (invalid chunk length '') - * if a buggy server doesn't send last zero-length chunk when using chunked encoding - * - * @link http://pear.php.net/bugs/bug.php?id=20228 - */ - public function testBug20228() - { - $events = array('receivedBodyPart', 'warning', 'receivedBody'); - $this->request->setHeader('Accept-Encoding', 'identity') - ->attach($observer = new EventSequenceObserver($events)); - $response = $this->request->send(); - $this->assertEquals('This is a test', $response->getBody()); - $this->assertEquals($events, $observer->sequence); - } - - public function testHowsMySSL() - { - $this->request->setUrl('https://www.howsmyssl.com/a/check') - ->setConfig('ssl_verify_peer', false); - - if (null === ($responseData = json_decode($this->request->send()->getBody(), true))) { - $this->fail('Cannot decode JSON from howsmyssl.com response'); - } - - $this->assertEmpty($responseData'insecure_cipher_suites'); - - if (version_compare(phpversion(), '5.6', '>=')) { - $this->assertEquals('Probably Okay', $responseData'rating'); - } - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/AllTests.php
Deleted
@@ -1,60 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -if (!defined('PHPUnit_MAIN_METHOD')) { - if (strpos($_SERVER'argv'0, 'phpunit') === false) { - define('PHPUnit_MAIN_METHOD', 'Request2_AllTests::main'); - } else { - define('PHPUnit_MAIN_METHOD', false); - } -} - -require_once dirname(__FILE__) . '/CookieJarTest.php'; -require_once dirname(__FILE__) . '/MultipartBodyTest.php'; -require_once dirname(__FILE__) . '/ResponseTest.php'; -require_once dirname(__FILE__) . '/Adapter/AllTests.php'; - -class Request2_AllTests -{ - public static function main() - { - if (!class_exists('PHPUnit_TextUI_TestRunner', true)) { - require_once 'PHPUnit/TextUI/TestRunner.php'; - } - PHPUnit_TextUI_TestRunner::run(self::suite()); - } - - public static function suite() - { - $suite = new PHPUnit_Framework_TestSuite('HTTP_Request2 package - Request2'); - - $suite->addTestSuite('HTTP_Request2_CookieJarTest'); - $suite->addTestSuite('HTTP_Request2_MultipartBodyTest'); - $suite->addTestSuite('HTTP_Request2_ResponseTest'); - $suite->addTest(Request2_Adapter_AllTests::suite()); - - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'Request2_AllTests::main') { - Request2_AllTests::main(); -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/CookieJarTest.php
Deleted
@@ -1,403 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Sets up includes */ -require_once dirname(dirname(__FILE__)) . '/TestHelper.php'; -/** Stores cookies and passes them between HTTP requests */ -require_once 'HTTP/Request2/CookieJar.php'; -/** Mock adapter intended for testing */ -require_once 'HTTP/Request2/Adapter/Mock.php'; - -/** - * Unit test for HTTP_Request2_CookieJar class - */ -class HTTP_Request2_CookieJarTest extends PHPUnit_Framework_TestCase -{ - /** - * Cookie jar instance being tested - * @var HTTP_Request2_CookieJar - */ - protected $jar; - - protected function setUp() - { - $this->jar = new HTTP_Request2_CookieJar(); - } - - /** - * Test that we can't store junk "cookies" in jar - * - * @dataProvider invalidCookieProvider - * @expectedException HTTP_Request2_LogicException - */ - public function testStoreInvalid($cookie) - { - $this->jar->store($cookie); - } - - /** - * Per feature requests, allow to ignore invalid cookies rather than throw exceptions - * - * @link http://pear.php.net/bugs/bug.php?id=19937 - * @link http://pear.php.net/bugs/bug.php?id=20401 - * @dataProvider invalidCookieProvider - */ - public function testCanIgnoreInvalidCookies($cookie) - { - $this->jar->ignoreInvalidCookies(true); - $this->assertFalse($this->jar->store($cookie)); - } - - /** - * Ignore setting a cookie from "parallel" subdomain when relevant option is on - * - * @link http://pear.php.net/bugs/bug.php?id=20401 - */ - public function testRequest20401() - { - $this->jar->ignoreInvalidCookies(true); - $response = HTTP_Request2_Adapter_Mock::createResponseFromFile( - fopen(dirname(dirname(__FILE__)) . '/_files/response_cookies', 'rb') - ); - $setter = new Net_URL2('http://pecl.php.net/'); - - $this->assertFalse($this->jar->addCookiesFromResponse($response, $setter)); - $this->assertCount(3, $this->jar->getAll()); - } - - - /** - * - * @dataProvider noPSLDomainsProvider - */ - public function testDomainMatchNoPSL($requestHost, $cookieDomain, $expected) - { - $this->jar->usePublicSuffixList(false); - $this->assertEquals($expected, $this->jar->domainMatch($requestHost, $cookieDomain)); - } - - /** - * - * @dataProvider PSLDomainsProvider - */ - public function testDomainMatchPSL($requestHost, $cookieDomain, $expected) - { - $this->jar->usePublicSuffixList(true); - $this->assertEquals($expected, $this->jar->domainMatch($requestHost, $cookieDomain)); - } - - public function testConvertExpiresToISO8601() - { - $dt = new DateTime(); - $dt->setTimezone(new DateTimeZone('UTC')); - $dt->modify('+1 day'); - - $this->jar->store(array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => '/', - 'expires' => $dt->format(DateTime::COOKIE), - 'secure' => false - )); - $cookies = $this->jar->getAll(); - $this->assertEquals($cookies0'expires', $dt->format(DateTime::ISO8601)); - } - - public function testProblem2038() - { - $this->jar->store(array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => '/', - 'expires' => 'Sun, 01 Jan 2040 03:04:05 GMT', - 'secure' => false - )); - $cookies = $this->jar->getAll(); - $this->assertEquals(array(array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => '/', - 'expires' => '2040-01-01T03:04:05+0000', - 'secure' => false - )), $cookies); - } - - public function testStoreExpired() - { - $base = array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => '/', - 'secure' => false - ); - - $dt = new DateTime(); - $dt->setTimezone(new DateTimeZone('UTC')); - $dt->modify('-1 day'); - $yesterday = $dt->format(DateTime::COOKIE); - - $dt->modify('+2 days'); - $tomorrow = $dt->format(DateTime::COOKIE); - - $this->jar->store($base + array('expires' => $yesterday)); - $this->assertEquals(0, count($this->jar->getAll())); - - $this->jar->store($base + array('expires' => $tomorrow)); - $this->assertEquals(1, count($this->jar->getAll())); - $this->jar->store($base + array('expires' => $yesterday)); - $this->assertEquals(0, count($this->jar->getAll())); - } - - /** - * - * @dataProvider cookieAndSetterProvider - */ - public function testGetDomainAndPathFromSetter($cookie, $setter, $expected) - { - $this->jar->store($cookie, $setter); - $expected = array_merge($cookie, $expected); - $cookies = $this->jar->getAll(); - $this->assertEquals($expected, $cookies0); - } - - /** - * - * @dataProvider cookieMatchProvider - */ - public function testGetMatchingCookies($url, $expectedCount) - { - $cookies = array( - array('domain' => '.example.com', 'path' => '/', 'secure' => false), - array('domain' => '.example.com', 'path' => '/', 'secure' => true), - array('domain' => '.example.com', 'path' => '/path', 'secure' => false), - array('domain' => '.example.com', 'path' => '/other', 'secure' => false), - array('domain' => 'example.com', 'path' => '/', 'secure' => false), - array('domain' => 'www.example.com', 'path' => '/', 'secure' => false), - array('domain' => 'specific.example.com', 'path' => '/path', 'secure' => false), - array('domain' => 'nowww.example.com', 'path' => '/', 'secure' => false), - ); - - for ($i = 0; $i < count($cookies); $i++) { - $this->jar->store($cookies$i + array('expires' => null, 'name' => "cookie{$i}", 'value' => "cookie_{$i}_value")); - } - - $this->assertEquals($expectedCount, count($this->jar->getMatching(new Net_URL2($url)))); - } - - public function testLongestPathFirst() - { - $cookie = array( - 'name' => 'foo', - 'domain' => '.example.com', - ); - foreach (array('/', '/specific/path/', '/specific/') as $path) { - $this->jar->store($cookie + array('path' => $path, 'value' => str_replace('/', '_', $path))); - } - $this->assertEquals( - 'foo=_specific_path_; foo=_specific_; foo=_', - $this->jar->getMatching(new Net_URL2('http://example.com/specific/path/file.php'), true) - ); - } - - public function testSerializable() - { - $dt = new DateTime(); - $dt->setTimezone(new DateTimeZone('UTC')); - $dt->modify('+1 day'); - $cookie = array('domain' => '.example.com', 'path' => '/', 'secure' => false, 'value' => 'foo'); - - $this->jar->store($cookie + array('name' => 'session', 'expires' => null)); - $this->jar->store($cookie + array('name' => 'long', 'expires' => $dt->format(DateTime::COOKIE))); - - $newJar = unserialize(serialize($this->jar)); - $cookies = $newJar->getAll(); - $this->assertEquals(1, count($cookies)); - $this->assertEquals('long', $cookies0'name'); - - $this->jar->serializeSessionCookies(true); - $newJar = unserialize(serialize($this->jar)); - $this->assertEquals($this->jar->getAll(), $newJar->getAll()); - } - - public function testRemoveExpiredOnUnserialize() - { - $dt = new DateTime(); - $dt->setTimezone(new DateTimeZone('UTC')); - $dt->modify('+2 seconds'); - - $this->jar->store(array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => '/', - 'expires' => $dt->format(DateTime::COOKIE), - )); - - $serialized = serialize($this->jar); - sleep(2); - $newJar = unserialize($serialized); - $this->assertEquals(array(), $newJar->getAll()); - } - - public static function invalidCookieProvider() - { - return array( - array(array()), - array(array('name' => 'foo')), - array(array( - 'name' => 'a name', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => '/', - )), - array(array( - 'name' => 'foo', - 'value' => 'a value', - 'domain' => '.example.com', - 'path' => '/', - )), - array(array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => null, - )), - array(array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => null, - 'path' => '/', - )), - array(array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => '/', - 'expires' => 'invalid date', - )), - ); - } - - public static function noPSLdomainsProvider() - { - return array( - array('localhost', 'localhost', true), - array('www.example.com', 'www.example.com', true), - array('127.0.0.1', '127.0.0.1', true), - array('127.0.0.1', '.0.0.1', false), - array('www.example.com', '.example.com', true), - array('deep.within.example.com', '.example.com', true), - array('example.com', '.com', false), - array('anotherexample.com', 'example.com', false), - array('whatever.msk.ru', '.msk.ru', true), - array('whatever.co.uk', '.co.uk', true), - array('whatever.bd', '.whatever.bd', true), - array('whatever.tokyo.jp', '.whatever.tokyo.jp', true), - array('metro.tokyo.jp', '.metro.tokyo.jp', true), - array('foo.bar', '.foo.bar', true) - ); - } - - public static function PSLdomainsProvider() - { - return array( - array('localhost', 'localhost', true), - array('www.example.com', 'www.example.com', true), - array('127.0.0.1', '127.0.0.1', true), - array('127.0.0.1', '.0.0.1', false), - array('www.example.com', '.example.com', true), - array('deep.within.example.com', '.example.com', true), - array('example.com', '.com', false), - array('anotherexample.com', 'example.com', false), - array('whatever.msk.ru', '.msk.ru', false), - array('whatever.co.uk', '.co.uk', false), - array('whatever.bd', '.whatever.bd', false), - array('whatever.bn', '.whatever.bn', false), - array('nic.tr', '.nic.tr', true), - array('foo.bar', '.foo.bar', true) - ); - } - - public static function cookieAndSetterProvider() - { - return array( - array( - array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => null, - 'path' => null, - 'expires' => null, - 'secure' => false - ), - new Net_Url2('http://example.com/directory/file.php'), - array( - 'domain' => 'example.com', - 'path' => '/directory/' - ) - ), - array( - array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => null, - 'expires' => null, - 'secure' => false - ), - new Net_Url2('http://example.com/path/to/file.php'), - array( - 'path' => '/path/to/' - ) - ), - array( - array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => null, - 'path' => '/', - 'expires' => null, - 'secure' => false - ), - new Net_Url2('http://example.com/another/file.php'), - array( - 'domain' => 'example.com' - ) - ) - ); - } - - public static function cookieMatchProvider() - { - return array( - array('http://www.example.com/path/file.php', 4), - array('https://www.example.com/path/file.php', 5), - array('http://example.com/path/file.php', 3), - array('http://specific.example.com/path/file.php', 4), - array('http://specific.example.com/other/file.php', 3), - array('http://another.example.com/another', 2) - ); - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/MultipartBodyTest.php
Deleted
@@ -1,102 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Sets up includes */ -require_once dirname(dirname(__FILE__)) . '/TestHelper.php'; - -/** - * Class representing a HTTP request - */ -require_once 'HTTP/Request2.php'; - -/** - * Unit test for HTTP_Request2_MultipartBody class - */ -class HTTP_Request2_MultipartBodyTest extends PHPUnit_Framework_TestCase -{ - public function testUploadSimple() - { - $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); - $body = $req->addPostParameter('foo', 'I am a parameter') - ->addUpload('upload', dirname(dirname(__FILE__)) . '/_files/plaintext.txt') - ->getBody(); - - $this->assertTrue($body instanceof HTTP_Request2_MultipartBody); - $asString = $body->__toString(); - $boundary = $body->getBoundary(); - $this->assertEquals($body->getLength(), strlen($asString)); - $this->assertContains('This is a test.', $asString); - $this->assertContains('I am a parameter', $asString); - $this->assertRegexp("!--{$boundary}--\r\n$!", $asString); - } - - /** - * - * @expectedException HTTP_Request2_LogicException - */ - public function testRequest16863() - { - $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); - $fp = fopen(dirname(dirname(__FILE__)) . '/_files/plaintext.txt', 'rb'); - $body = $req->addUpload('upload', $fp) - ->getBody(); - - $asString = $body->__toString(); - $this->assertContains('name="upload"; filename="anonymous.blob"', $asString); - $this->assertContains('This is a test.', $asString); - - $req->addUpload('bad_upload', fopen('php://input', 'rb')); - } - - public function testStreaming() - { - $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); - $body = $req->addPostParameter('foo', 'I am a parameter') - ->addUpload('upload', dirname(dirname(__FILE__)) . '/_files/plaintext.txt') - ->getBody(); - $asString = ''; - while ($part = $body->read(10)) { - $asString .= $part; - } - $this->assertEquals($body->getLength(), strlen($asString)); - $this->assertContains('This is a test.', $asString); - $this->assertContains('I am a parameter', $asString); - } - - public function testUploadArray() - { - $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); - $body = $req->addUpload('upload', array( - array(dirname(dirname(__FILE__)) . '/_files/plaintext.txt', 'bio.txt', 'text/plain'), - array(fopen(dirname(dirname(__FILE__)) . '/_files/empty.gif', 'rb'), 'photo.gif', 'image/gif') - )) - ->getBody(); - $asString = $body->__toString(); - $this->assertContains(file_get_contents(dirname(dirname(__FILE__)) . '/_files/empty.gif'), $asString); - $this->assertContains('name="upload0"; filename="bio.txt"', $asString); - $this->assertContains('name="upload1"; filename="photo.gif"', $asString); - - $body2 = $req->setConfig(array('use_brackets' => false))->getBody(); - $asString = $body2->__toString(); - $this->assertContains('name="upload"; filename="bio.txt"', $asString); - $this->assertContains('name="upload"; filename="photo.gif"', $asString); - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2/ResponseTest.php
Deleted
@@ -1,128 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Sets up includes */ -require_once dirname(dirname(__FILE__)) . '/TestHelper.php'; - -/** - * Class representing a HTTP response - */ -require_once 'HTTP/Request2/Response.php'; - -/** - * Unit test for HTTP_Request2_Response class - */ -class HTTP_Request2_ResponseTest extends PHPUnit_Framework_TestCase -{ - /** - * - * @expectedException HTTP_Request2_MessageException - */ - public function testParseStatusLine() - { - $response = new HTTP_Request2_Response('HTTP/1.1 200 OK'); - $this->assertEquals('1.1', $response->getVersion()); - $this->assertEquals(200, $response->getStatus()); - $this->assertEquals('OK', $response->getReasonPhrase()); - - $response2 = new HTTP_Request2_Response('HTTP/1.2 222 Nishtyak!'); - $this->assertEquals('1.2', $response2->getVersion()); - $this->assertEquals(222, $response2->getStatus()); - $this->assertEquals('Nishtyak!', $response2->getReasonPhrase()); - - $response3 = new HTTP_Request2_Response('Invalid status line'); - } - - public function testParseHeaders() - { - $response = $this->readResponseFromFile('response_headers'); - $this->assertEquals(7, count($response->getHeader())); - $this->assertEquals('PHP/6.2.2', $response->getHeader('X-POWERED-BY')); - $this->assertEquals('text/html; charset=windows-1251', $response->getHeader('cOnTeNt-TyPe')); - $this->assertEquals('accept-charset, user-agent', $response->getHeader('vary')); - } - - public function testParseCookies() - { - $response = $this->readResponseFromFile('response_cookies'); - $cookies = $response->getCookies(); - $this->assertEquals(4, count($cookies)); - $expected = array( - array('name' => 'foo', 'value' => 'bar', 'expires' => null, - 'domain' => null, 'path' => null, 'secure' => false), - array('name' => 'PHPSESSID', 'value' => '1234567890abcdef1234567890abcdef', - 'expires' => null, 'domain' => null, 'path' => '/', 'secure' => true), - array('name' => 'A', 'value' => 'B=C', 'expires' => null, - 'domain' => null, 'path' => null, 'secure' => false), - array('name' => 'baz', 'value' => '%20a%20value', 'expires' => 'Sun, 03 Jan 2010 03:04:05 GMT', - 'domain' => 'pear.php.net', 'path' => null, 'secure' => false), - ); - foreach ($cookies as $k => $cookie) { - $this->assertEquals($expected$k, $cookie); - } - } - - /** - * - * @expectedException HTTP_Request2_MessageException - */ - public function testGzipEncoding() - { - $response = $this->readResponseFromFile('response_gzip'); - $this->assertEquals('0e964e9273c606c46afbd311b5ad4d77', md5($response->getBody())); - - $response = $this->readResponseFromFile('response_gzip_broken'); - $body = $response->getBody(); - } - - public function testDeflateEncoding() - { - $response = $this->readResponseFromFile('response_deflate'); - $this->assertEquals('0e964e9273c606c46afbd311b5ad4d77', md5($response->getBody())); - } - - public function testBug15305() - { - $response = $this->readResponseFromFile('bug_15305'); - $this->assertEquals('c8c5088fc8a7652afef380f086c010a6', md5($response->getBody())); - } - - public function testBug18169() - { - $response = $this->readResponseFromFile('bug_18169'); - $this->assertEquals('', $response->getBody()); - } - - protected function readResponseFromFile($filename) - { - $fp = fopen(dirname(dirname(__FILE__)) . '/_files/' . $filename, 'rb'); - $response = new HTTP_Request2_Response(fgets($fp)); - do { - $headerLine = fgets($fp); - $response->parseHeaderLine($headerLine); - } while ('' != trim($headerLine)); - - while (!feof($fp)) { - $response->appendBody(fread($fp, 1024)); - } - return $response; - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/Request2Test.php
Deleted
@@ -1,392 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** Sets up includes */ -require_once dirname(__FILE__) . '/TestHelper.php'; - -/** - * Class representing a HTTP request - */ -require_once 'HTTP/Request2.php'; - -/** - * Unit test for HTTP_Request2 class - */ -class HTTP_Request2Test extends PHPUnit_Framework_TestCase -{ - public function testConstructorSetsDefaults() - { - $url = new Net_URL2('http://www.example.com/foo'); - $req = new HTTP_Request2($url, HTTP_Request2::METHOD_POST, array('connect_timeout' => 666)); - - $this->assertSame($url, $req->getUrl()); - $this->assertEquals(HTTP_Request2::METHOD_POST, $req->getMethod()); - $this->assertEquals(666, $req->getConfig('connect_timeout')); - } - - /** - * - * @expectedException HTTP_Request2_LogicException - */ - public function testSetUrl() - { - $urlString = 'http://www.example.com/foo/bar.php'; - $url = new Net_URL2($urlString); - - $req1 = new HTTP_Request2(); - $req1->setUrl($url); - $this->assertSame($url, $req1->getUrl()); - - $req2 = new HTTP_Request2(); - $req2->setUrl($urlString); - $this->assertInstanceOf('Net_URL2', $req2->getUrl()); - $this->assertEquals($urlString, $req2->getUrl()->getUrl()); - - $req3 = new HTTP_Request2(); - $req3->setUrl(array('This will cause an error')); - } - - public function testConvertUserinfoToAuth() - { - $req = new HTTP_Request2(); - $req->setUrl('http://foo:b%40r@www.example.com/'); - - $this->assertEquals('', (string)$req->getUrl()->getUserinfo()); - $this->assertEquals( - array('user' => 'foo', 'password' => 'b@r', 'scheme' => HTTP_Request2::AUTH_BASIC), - $req->getAuth() - ); - } - - /** - * - * @expectedException HTTP_Request2_LogicException - */ - public function testSetMethod() - { - $req = new HTTP_Request2(); - $req->setMethod(HTTP_Request2::METHOD_PUT); - $this->assertEquals(HTTP_Request2::METHOD_PUT, $req->getMethod()); - - $req->setMethod('Invalid method'); - } - - public function testSetAndGetConfig() - { - $req = new HTTP_Request2(); - $this->assertArrayHasKey('connect_timeout', $req->getConfig()); - - $req->setConfig(array('connect_timeout' => 123)); - $this->assertEquals(123, $req->getConfig('connect_timeout')); - try { - $req->setConfig(array('foo' => 'unknown parameter')); - $this->fail('Expected HTTP_Request2_LogicException was not thrown'); - } catch (HTTP_Request2_LogicException $e) {} - - try { - $req->getConfig('bar'); - $this->fail('Expected HTTP_Request2_LogicException was not thrown'); - } catch (HTTP_Request2_LogicException $e) {} - } - - public function testSetProxyAsUrl() - { - $req = new HTTP_Request2(); - $req->setConfig('proxy', 'socks5://foo:bar%25baz@localhost:1080/'); - - $this->assertEquals('socks5', $req->getConfig('proxy_type')); - $this->assertEquals('localhost', $req->getConfig('proxy_host')); - $this->assertEquals(1080, $req->getConfig('proxy_port')); - $this->assertEquals('foo', $req->getConfig('proxy_user')); - $this->assertEquals('bar%baz', $req->getConfig('proxy_password')); - } - - /** - * - * @expectedException HTTP_Request2_LogicException - */ - public function testHeaders() - { - $req = new HTTP_Request2(); - $autoHeaders = $req->getHeaders(); - - $req->setHeader('Foo', 'Bar'); - $req->setHeader('Foo-Bar: value'); - $req->setHeader(array('Another-Header' => 'another value', 'Yet-Another: other_value')); - $this->assertEquals( - array('foo-bar' => 'value', 'another-header' => 'another value', - 'yet-another' => 'other_value', 'foo' => 'Bar') + $autoHeaders, - $req->getHeaders() - ); - - $req->setHeader('FOO-BAR'); - $req->setHeader(array('aNOTHER-hEADER')); - $this->assertEquals( - array('yet-another' => 'other_value', 'foo' => 'Bar') + $autoHeaders, - $req->getHeaders() - ); - - $req->setHeader('Invalid header', 'value'); - } - - public function testBug15937() - { - $req = new HTTP_Request2(); - $autoHeaders = $req->getHeaders(); - - $req->setHeader('Expect: '); - $req->setHeader('Foo', ''); - $this->assertEquals( - array('expect' => '', 'foo' => '') + $autoHeaders, - $req->getHeaders() - ); - } - - public function testRequest17507() - { - $req = new HTTP_Request2(); - - $req->setHeader('accept-charset', 'iso-8859-1'); - $req->setHeader('accept-charset', array('windows-1251', 'utf-8'), false); - - $req->setHeader(array('accept' => 'text/html')); - $req->setHeader(array('accept' => 'image/gif'), null, false); - - $headers = $req->getHeaders(); - - $this->assertEquals('iso-8859-1, windows-1251, utf-8', $headers'accept-charset'); - $this->assertEquals('text/html, image/gif', $headers'accept'); - } - - /** - * - * @expectedException HTTP_Request2_LogicException - */ - public function testCookies() - { - $req = new HTTP_Request2(); - $req->addCookie('name', 'value'); - $req->addCookie('foo', 'bar'); - $headers = $req->getHeaders(); - $this->assertEquals('name=value; foo=bar', $headers'cookie'); - - $req->addCookie('invalid cookie', 'value'); - } - - /** - * - * @expectedException HTTP_Request2_LogicException - */ - public function testPlainBody() - { - $req = new HTTP_Request2(); - $req->setBody('A string'); - $this->assertEquals('A string', $req->getBody()); - - $req->setBody(dirname(__FILE__) . '/_files/plaintext.txt', true); - $headers = $req->getHeaders(); - $this->assertRegexp( - '!^(text/plain|application/octet-stream)!', - $headers'content-type' - ); - $this->assertEquals('This is a test.', fread($req->getBody(), 1024)); - - $req->setBody('missing file', true); - } - - /** - * - * @expectedException HTTP_Request2_LogicException - */ - public function testRequest16863() - { - $req = new HTTP_Request2(); - $req->setBody(fopen(dirname(__FILE__) . '/_files/plaintext.txt', 'rb')); - $headers = $req->getHeaders(); - $this->assertEquals('application/octet-stream', $headers'content-type'); - - $req->setBody(fopen('php://input', 'rb')); - } - - public function testUrlencodedBody() - { - $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); - $req->addPostParameter('foo', 'bar'); - $req->addPostParameter(array('baz' => 'quux')); - $req->addPostParameter('foobar', array('one', 'two')); - $this->assertEquals( - 'foo=bar&baz=quux&foobar%5B0%5D=one&foobar%5B1%5D=two', - $req->getBody() - ); - - $req->setConfig(array('use_brackets' => false)); - $this->assertEquals( - 'foo=bar&baz=quux&foobar=one&foobar=two', - $req->getBody() - ); - } - - public function testRequest15368() - { - $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); - $req->addPostParameter('foo', 'te~st'); - $this->assertContains('~', $req->getBody()); - } - - /** - * - * @expectedException HTTP_Request2_LogicException - * @expectedExceptionMessage missing file - */ - public function testUpload() - { - $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); - $req->addUpload('upload', dirname(__FILE__) . '/_files/plaintext.txt'); - - $headers = $req->getHeaders(); - $this->assertEquals('multipart/form-data', $headers'content-type'); - - $req->addUpload('upload_2', 'missing file'); - } - - public function testPropagateUseBracketsToNetURL2() - { - $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_GET, - array('use_brackets' => false)); - $req->getUrl()->setQueryVariable('foo', array('bar', 'baz')); - $this->assertEquals('http://www.example.com/?foo=bar&foo=baz', $req->getUrl()->__toString()); - - $req->setConfig('use_brackets', true)->setUrl('http://php.example.com/'); - $req->getUrl()->setQueryVariable('foo', array('bar', 'baz')); - - $this->assertEquals('http://php.example.com/?foo=bar&foo=baz', $req->getUrl()->__toString()); - } - - public function testSetBodyRemovesPostParameters() - { - $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_POST); - $req->addPostParameter('foo', 'bar'); - $req->setBody(''); - $this->assertEquals('', $req->getBody()); - } - - public function testPostParametersPrecedeSetBodyForPost() - { - $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_POST); - $req->setBody('Request body'); - $req->addPostParameter('foo', 'bar'); - - $this->assertEquals('foo=bar', $req->getBody()); - - $req->setMethod(HTTP_Request2::METHOD_PUT); - $this->assertEquals('Request body', $req->getBody()); - } - - public function testSetMultipartBody() - { - require_once 'HTTP/Request2/MultipartBody.php'; - - $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_POST); - $body = new HTTP_Request2_MultipartBody(array('foo' => 'bar'), array()); - $req->setBody($body); - $this->assertSame($body, $req->getBody()); - } - - public function testBug17460() - { - $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_POST); - $req->addPostParameter('foo', 'bar') - ->setHeader('content-type', 'application/x-www-form-urlencoded; charset=UTF-8'); - - $this->assertEquals('foo=bar', $req->getBody()); - } - - /** - * - * @expectedException HTTP_Request2_LogicException - */ - public function testCookieJar() - { - $req = new HTTP_Request2(); - $this->assertNull($req->getCookieJar()); - - $req->setCookieJar(); - $jar = $req->getCookieJar(); - $this->assertInstanceOf('HTTP_Request2_CookieJar', $jar); - - $req2 = new HTTP_Request2(); - $req2->setCookieJar($jar); - $this->assertSame($jar, $req2->getCookieJar()); - - $req2->setCookieJar(null); - $this->assertNull($req2->getCookieJar()); - - $req2->setCookieJar('foo'); - } - - public function testAddCookieToJar() - { - $req = new HTTP_Request2(); - $req->setCookieJar(); - - try { - $req->addCookie('foo', 'bar'); - $this->fail('Expected HTTP_Request2_Exception was not thrown'); - } catch (HTTP_Request2_LogicException $e) { } - - $req->setUrl('http://example.com/path/file.php'); - $req->addCookie('foo', 'bar'); - - $this->assertArrayNotHasKey('cookie', $req->getHeaders()); - $cookies = $req->getCookieJar()->getAll(); - $this->assertEquals( - array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => 'example.com', - 'path' => '/path/', - 'expires' => null, - 'secure' => false - ), - $cookies0 - ); - } - - /** - * @expectedException HTTP_Request2_LogicException - * @expectedExceptionMessage none - */ - public function testDisallowEmptyUrls() - { - $req = new HTTP_Request2(); - $req->send(); - } - - /** - * @expectedException HTTP_Request2_LogicException - * @expectedExceptionMessage '/foo/bar.php' - */ - public function testDisallowRelativeUrls() - { - $req = new HTTP_Request2('/foo/bar.php'); - $req->send(); - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/TestHelper.php
Deleted
@@ -1,50 +0,0 @@ -<?php -/** - * Unit tests for HTTP_Request2 package - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -// If running from SVN checkout, update include_path -if ('@' . 'package_version@' == '2.3.0') { - $classPath = realpath(dirname(dirname(__FILE__))); - $includePath = array($classPath); - - foreach (explode(PATH_SEPARATOR, get_include_path()) as $component) { - if (false !== ($real = realpath($component)) && $real !== $classPath) { - $includePath = $real; - } - } - - set_include_path(implode(PATH_SEPARATOR, $includePath)); -} - -if (strpos($_SERVER'argv'0, 'phpunit') === false) { - /** Include PHPUnit dependencies based on version */ - require_once 'PHPUnit/Runner/Version.php'; - if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '>=')) { - require_once 'PHPUnit/Autoload.php'; - } else { - require_once 'PHPUnit/Framework.php'; - } -} - -if (!defined('HTTP_REQUEST2_TESTS_BASE_URL') - && is_readable(dirname(__FILE__) . '/NetworkConfig.php') -) { - require_once dirname(__FILE__) . '/NetworkConfig.php'; -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/basicauth.php
Deleted
@@ -1,33 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -$user = isset($_SERVER'PHP_AUTH_USER') ? $_SERVER'PHP_AUTH_USER' : null; -$pass = isset($_SERVER'PHP_AUTH_PW') ? $_SERVER'PHP_AUTH_PW' : null; -$wantedUser = isset($_GET'user') ? $_GET'user' : null; -$wantedPass = isset($_GET'pass') ? $_GET'pass' : null; - -if (!$user || !$pass || $user != $wantedUser || $pass != $wantedPass) { - header('WWW-Authenticate: Basic realm="HTTP_Request2 tests"', true, 401); - echo "Login required"; -} else { - echo "Username={$user};Password={$pass}"; -} - -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/bug19934.php
Deleted
@@ -1,27 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -for ($i = 0; $i < 20; $i++) { - for ($j = 0; $j < 10; $j++) { - echo str_repeat((string)$j, 98) . "\r\n"; - } - flush(); - usleep(50000); -} \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/bug20228.php
Deleted
@@ -1,24 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -header('Transfer-Encoding: chunked'); - -echo "e\r\n"; -echo "This is a test\r\n";
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/cookies.php
Deleted
@@ -1,24 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -ksort($_COOKIE); -echo serialize($_COOKIE); - -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/digestauth.php
Deleted
@@ -1,83 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -/** - * Mostly borrowed from PHP manual and Socket Adapter implementation - * - * @link http://php.net/manual/en/features.http-auth.php - */ - -/** - * Parses the Digest auth header - * - * @param string $txt - */ -function http_digest_parse($txt) -{ - $token = '^\x00-\x1f\x7f-\xff()<>@,;:\\\\"/\\?={}\s+'; - $quoted = '"(?:\\\\.|^\\\\")*"'; - - // protect against missing data - $needed_parts = array_flip(array('nonce', 'nc', 'cnonce', 'qop', 'username', 'uri', 'response')); - $data = array(); - - preg_match_all("!({$token})\\s*=\\s*({$token}|{$quoted})!", $txt, $matches); - for ($i = 0; $i < count($matches0); $i++) { - // ignore unneeded parameters - if (isset($needed_parts$matches1$i)) { - unset($needed_parts$matches1$i); - if ('"' == substr($matches2$i, 0, 1)) { - $data$matches1$i = substr($matches2$i, 1, -1); - } else { - $data$matches1$i = $matches2$i; - } - } - } - - return !empty($needed_parts) ? false : $data; -} - -$realm = 'HTTP_Request2 tests'; -$wantedUser = isset($_GET'user') ? $_GET'user' : null; -$wantedPass = isset($_GET'pass') ? $_GET'pass' : null; -$validAuth = false; - -if (!empty($_SERVER'PHP_AUTH_DIGEST') - && ($data = http_digest_parse($_SERVER'PHP_AUTH_DIGEST')) - && $wantedUser == $data'username' -) { - // generate the valid response - $a1 = md5($data'username' . ':' . $realm . ':' . $wantedPass); - $a2 = md5($_SERVER'REQUEST_METHOD' . ':' . $data'uri'); - $response = md5($a1. ':' . $data'nonce' . ':' . $data'nc' . ':' - . $data'cnonce' . ':' . $data'qop' . ':' . $a2); - - // check valid response against existing one - $validAuth = ($data'response' == $response); -} - -if (!$validAuth || empty($_SERVER'PHP_AUTH_DIGEST')) { - header('WWW-Authenticate: Digest realm="' . $realm . - '",qop="auth",nonce="' . uniqid() . '"', true, 401); - echo "Login required"; -} else { - echo "Username={$data'username'}"; -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/download.php
Deleted
@@ -1,45 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -$payload = str_repeat('0123456789abcdef', 128); - -if (array_key_exists('gzip', $_GET)) { - // we inject a long "filename" into the header to check whether the downloader - // can handle an incomplete header in "slowpoke" mode - $payload = pack('c4Vc2', 0x1f, 0x8b, 8, 8, time(), 2, 255) - . str_repeat('a_really_really_long_file_name', 10) . '.txt' . chr(0) - . gzdeflate($payload) - . pack('V2', crc32($payload), 2048); - header('Content-Encoding: gzip'); -} - -if (!array_key_exists('slowpoke', $_GET)) { - echo $payload; - -} else { - $pos = 0; - $length = strlen($payload); - while ($pos < $length) { - echo substr($payload, $pos, 65); - $pos += 65; - flush(); - usleep(50000); - } -} \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/getparameters.php
Deleted
@@ -1,24 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -ksort($_GET); -echo serialize($_GET); - -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/incompletebody.php
Deleted
@@ -1,32 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -header('Connection: close'); - -if (array_key_exists('chunked', $_GET)) { - header('Transfer-Encoding: chunked'); - echo "2A\r\n"; - -} else { - header('Content-Length: 42'); -} - -echo "This is a test"; -flush(); \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/postparameters.php
Deleted
@@ -1,24 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -ksort($_POST); -echo serialize($_POST); - -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/rawpostdata.php
Deleted
@@ -1,22 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -readfile('php://input'); -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/redirects.php
Deleted
@@ -1,50 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -$redirects = isset($_GET'redirects')? $_GET'redirects': 1; -$https = !empty($_SERVER'HTTPS') && ('off' != strtolower($_SERVER'HTTPS')); -$special = isset($_GET'special')? $_GET'special': null; - -if ('ftp' == $special) { - header('Location: ftp://localhost/pub/exploit.exe', true, 301); - -} elseif ('youtube' == $special) { - header('Location: https://youtube.com/', true, 301); - -} elseif ('relative' == $special) { - header('Location: ./getparameters.php?msg=did%20relative%20redirect', true, 302); - -} elseif ('cookie' == $special) { - setcookie('cookie_on_redirect', 'success'); - header('Location: ./cookies.php', true, 302); - -} elseif ($redirects > 0) { - $url = ($https? 'https': 'http') . '://' . $_SERVER'SERVER_NAME' - . (($https && 443 == $_SERVER'SERVER_PORT' || !$https && 80 == $_SERVER'SERVER_PORT') - ? '' : ':' . $_SERVER'SERVER_PORT') - . $_SERVER'PHP_SELF' . '?redirects=' . (--$redirects); - header('Location: ' . $url, true, 302); - -} else { - echo "Method=" . $_SERVER'REQUEST_METHOD' . ';'; - var_dump($_POST); - var_dump($_GET); -} -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/setcookie.php
Deleted
@@ -1,27 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -$name = empty($_GET'name')? 'foo': $_GET'name'; -$value = empty($_GET'value')? 'bar': $_GET'value'; - -setcookie($name, $value); - -echo "Cookie set!"; -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/timeout.php
Deleted
@@ -1,23 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -sleep(5); - -?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/HTTP_Request2-2.3.0/tests/_network/uploads.php
Deleted
@@ -1,36 +0,0 @@ -<?php -/** - * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. - * - * PHP version 5 - * - * LICENSE - * - * This source file is subject to BSD 3-Clause License that is bundled - * with this package in the file LICENSE and available at the URL - * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE - * - * @category HTTP - * @package HTTP_Request2 - * @author Alexey Borzov <avb@php.net> - * @copyright 2008-2016 Alexey Borzov <avb@php.net> - * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License - * @link http://pear.php.net/package/HTTP_Request2 - */ - -if (isset($_GET'slowpoke')) { - sleep(3); -} - -if (!empty($_FILES)) { - foreach ($_FILES as $name => $file) { - if (is_array($file'name')) { - foreach($file'name' as $k => $v) { - echo "{$name}{$k} {$v} {$file'type'$k} {$file'size'$k}\n"; - } - } else { - echo "{$name} {$file'name'} {$file'type'} {$file'size'}\n"; - } - } -} -?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2.php
Added
@@ -0,0 +1,1057 @@ +<?php +/** + * Class representing a HTTP request message + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * A class representing an URL as per RFC 3986. + */ +require_once 'Net/URL2.php'; + +/** + * Exception class for HTTP_Request2 package + */ +require_once 'HTTP/Request2/Exception.php'; + +/** + * Class representing a HTTP request message + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + * @link http://tools.ietf.org/html/rfc2616#section-5 + */ +class HTTP_Request2 implements SplSubject +{ + /** + * #@+ + * Constants for HTTP request methods + * + * @link http://tools.ietf.org/html/rfc2616#section-5.1.1 + */ + const METHOD_OPTIONS = 'OPTIONS'; + const METHOD_GET = 'GET'; + const METHOD_HEAD = 'HEAD'; + const METHOD_POST = 'POST'; + const METHOD_PUT = 'PUT'; + const METHOD_DELETE = 'DELETE'; + const METHOD_TRACE = 'TRACE'; + const METHOD_CONNECT = 'CONNECT'; + /** + * #@- + */ + + /** + * #@+ + * Constants for HTTP authentication schemes + * + * @link http://tools.ietf.org/html/rfc2617 + */ + const AUTH_BASIC = 'basic'; + const AUTH_DIGEST = 'digest'; + /** + * #@- + */ + + /** + * Regular expression used to check for invalid symbols in RFC 2616 tokens + * + * @link http://pear.php.net/bugs/bug.php?id=15630 + */ + const REGEXP_INVALID_TOKEN = '!\x00-\x1f\x7f-\xff()<>@,;:\\\\"/\\?={}\s!'; + + /** + * Regular expression used to check for invalid symbols in cookie strings + * + * @link http://pear.php.net/bugs/bug.php?id=15630 + * @link http://web.archive.org/web/20080331104521/http://cgi.netscape.com/newsref/std/cookie_spec.html + */ + const REGEXP_INVALID_COOKIE = '/\s,;/'; + + /** + * Fileinfo magic database resource + * + * @var resource|null + * @see detectMimeType() + */ + private static $_fileinfoDb = null; + + /** + * Observers attached to the request (instances of SplObserver) + * + * @var array + */ + protected $observers = ; + + /** + * Request URL + * + * @var Net_URL2 + */ + protected $url; + + /** + * Request method + * + * @var string + */ + protected $method = self::METHOD_GET; + + /** + * Authentication data + * + * @var null|array{user: string, password: string, scheme: string} + * @see getAuth() + */ + protected $auth; + + /** + * Request headers + * + * @var array + */ + protected $headers = ; + + /** + * Configuration parameters + * + * @var array + * @see setConfig() + */ + protected $config = + 'adapter' => 'HTTP_Request2_Adapter_Socket', + 'connect_timeout' => 10, + 'timeout' => 0, + 'use_brackets' => true, + 'protocol_version' => '1.1', + 'buffer_size' => 16384, + 'store_body' => true, + 'local_ip' => null, + + 'proxy_host' => '', + 'proxy_port' => '', + 'proxy_user' => '', + 'proxy_password' => '', + 'proxy_auth_scheme' => self::AUTH_BASIC, + 'proxy_type' => 'http', + + 'ssl_verify_peer' => true, + 'ssl_verify_host' => true, + 'ssl_cafile' => null, + 'ssl_capath' => null, + 'ssl_local_cert' => null, + 'ssl_passphrase' => null, + + 'digest_compat_ie' => false, + + 'follow_redirects' => false, + 'max_redirects' => 5, + 'strict_redirects' => false + ; + + /** + * Last event in request / response handling, intended for observers + * + * @var array + * @see getLastEvent() + */ + protected $lastEvent = + 'name' => 'start', + 'data' => null + ; + + /** + * Request body + * + * @var string|resource|HTTP_Request2_MultipartBody + * @see setBody() + */ + protected $body = ''; + + /** + * Array of POST parameters + * + * @var array + */ + protected $postParams = ; + + /** + * Array of file uploads (for multipart/form-data POST requests) + * + * @var array + */ + protected $uploads = ; + + /** + * Adapter used to perform actual HTTP request + * + * @var HTTP_Request2_Adapter + */ + protected $adapter; + + /** + * Cookie jar to persist cookies between requests + * + * @var HTTP_Request2_CookieJar|null + */ + protected $cookieJar = null; + + /** + * Constructor. Can set request URL, method and configuration array. + * + * Also sets a default value for User-Agent header. + * + * @param string|Net_URL2 $url Request URL + * @param string $method Request method + * @param array $config Configuration for this Request instance + */ + public function __construct( + $url = null, $method = self::METHOD_GET, array $config = + ) { + $this->setConfig($config); + if (!empty($url)) { + $this->setUrl($url); + } + if (!empty($method)) { + $this->setMethod($method); + } + $this->setHeader( + 'user-agent', 'HTTP_Request2/2.6.0 ' . + '(https://github.com/pear/HTTP_Request2) PHP/' . phpversion() + ); + } + + /** + * Sets the URL for this request + * + * If the URL has userinfo part (username & password) these will be removed + * and converted to auth data. If the URL does not have a path component, + * that will be set to '/'. + * + * @param string|Net_URL2 $url Request URL + * + * @return $this + * @throws HTTP_Request2_LogicException + */ + public function setUrl($url) + { + if (is_string($url)) { + $url = new Net_URL2( + $url, Net_URL2::OPTION_USE_BRACKETS => $this->config'use_brackets' + ); + } + if (!$url instanceof Net_URL2) { + throw new HTTP_Request2_LogicException( + 'Parameter is not a valid HTTP URL', + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + // URL contains username / password? + if ($url->getUserinfo()) { + $password = $url->getPassword(); + $this->setAuth( + rawurldecode((string)$url->getUser()), + $password? rawurldecode((string)$password): '' + ); + $url->setUserinfo(''); + } + if ('' == $url->getPath()) { + $url->setPath('/'); + } + $this->url = $url; + + return $this; + } + + /** + * Returns the request URL + * + * @return Net_URL2 + */ + public function getUrl() + { + return $this->url; + } + + /** + * Sets the request method + * + * @param string $method one of the methods defined in RFC 2616 + * + * @return $this + * @throws HTTP_Request2_LogicException if the method name is invalid + */ + public function setMethod($method) + { + // Method name should be a token: http://tools.ietf.org/html/rfc2616#section-5.1.1 + if (preg_match(self::REGEXP_INVALID_TOKEN, $method)) { + throw new HTTP_Request2_LogicException( + "Invalid request method '{$method}'", + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + $this->method = $method; + + return $this; + } + + /** + * Returns the request method + * + * @return string + */ + public function getMethod() + { + return $this->method; + } + + /** + * Sets the configuration parameter(s) + * + * The following parameters are available: + * <ul> + * <li> 'adapter' - adapter to use (string)</li> + * <li> 'connect_timeout' - Connection timeout in seconds (integer)</li> + * <li> 'timeout' - Total number of seconds a request can take. + * Use 0 for no limit, should be greater than + * 'connect_timeout' if set (integer)</li> + * <li> 'use_brackets' - Whether to append to array variable names (bool)</li> + * <li> 'protocol_version' - HTTP Version to use, '1.0' or '1.1' (string)</li> + * <li> 'buffer_size' - Buffer size to use for reading and writing (int)</li> + * <li> 'store_body' - Whether to store response body in response object. + * Set to false if receiving a huge response and + * using an Observer to save it (boolean)</li> + * <li> 'local_ip' - Specifies the IP address that will be used for accessing + * the network (string)</li> + * <li> 'proxy_type' - Proxy type, 'http' or 'socks5' (string)</li> + * <li> 'proxy_host' - Proxy server host (string)</li> + * <li> 'proxy_port' - Proxy server port (integer)</li> + * <li> 'proxy_user' - Proxy auth username (string)</li> + * <li> 'proxy_password' - Proxy auth password (string)</li> + * <li> 'proxy_auth_scheme' - Proxy auth scheme, one of HTTP_Request2::AUTH_* constants (string)</li> + * <li> 'proxy' - Shorthand for proxy_* parameters, proxy given as URL, + * e.g. 'socks5://localhost:1080/' (string)</li> + * <li> 'ssl_verify_peer' - Whether to verify peer's SSL certificate (bool)</li> + * <li> 'ssl_verify_host' - Whether to check that Common Name in SSL + * certificate matches host name (bool)</li> + * <li> 'ssl_cafile' - Cerificate Authority file to verify the peer + * with (use with 'ssl_verify_peer') (string)</li> + * <li> 'ssl_capath' - Directory holding multiple Certificate + * Authority files (string)</li> + * <li> 'ssl_local_cert' - Name of a file containing local cerificate (string)</li> + * <li> 'ssl_passphrase' - Passphrase with which local certificate + * was encoded (string)</li> + * <li> 'digest_compat_ie' - Whether to imitate behaviour of MSIE 5 and 6 + * in using URL without query string in digest + * authentication (boolean)</li> + * <li> 'follow_redirects' - Whether to automatically follow HTTP Redirects (boolean)</li> + * <li> 'max_redirects' - Maximum number of redirects to follow (integer)</li> + * <li> 'strict_redirects' - Whether to keep request method on redirects via status 301 and + * 302 (true, needed for compatibility with RFC 2616) + * or switch to GET (false, needed for compatibility with most + * browsers) (boolean)</li> + * </ul> + * + * @param string|array $nameOrConfig configuration parameter name or array + * ('parameter name' => 'parameter value') + * @param mixed $value parameter value if $nameOrConfig is not an array + * + * @return $this + * @throws HTTP_Request2_LogicException If the parameter is unknown + */ + public function setConfig($nameOrConfig, $value = null) + { + if (is_array($nameOrConfig)) { + foreach ($nameOrConfig as $name => $value) { + $this->setConfig($name, $value); + } + + } elseif ('proxy' === $nameOrConfig) { + $url = new Net_URL2((string)$value); + $this->setConfig( + + 'proxy_type' => $url->getScheme(), + 'proxy_host' => $url->getHost(), + 'proxy_port' => $url->getPort(), + 'proxy_user' => rawurldecode((string)$url->getUser()), + 'proxy_password' => rawurldecode((string)$url->getPassword()) + + ); + + } else { + if (!array_key_exists($nameOrConfig, $this->config)) { + throw new HTTP_Request2_LogicException( + "Unknown configuration parameter '{$nameOrConfig}'", + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + $this->config$nameOrConfig = $value; + } + + return $this; + } + + /** + * Returns the value(s) of the configuration parameter(s) + * + * @param string $name parameter name + * + * @return mixed value of $name parameter, array of all configuration + * parameters if $name is not given + * @throws HTTP_Request2_LogicException If the parameter is unknown + */ + public function getConfig($name = null) + { + if (null === $name) { + return $this->config; + } elseif (!array_key_exists($name, $this->config)) { + throw new HTTP_Request2_LogicException( + "Unknown configuration parameter '{$name}'", + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + return $this->config$name; + } + + /** + * Sets the authentication data + * + * @param string $user user name + * @param string $password password + * @param string $scheme authentication scheme + * + * @return $this + */ + public function setAuth($user, $password = '', $scheme = self::AUTH_BASIC) + { + if (empty($user)) { + $this->auth = null; + } else { + /** @psalm-suppress RedundantCast */ + $this->auth = + 'user' => (string)$user, + 'password' => (string)$password, + 'scheme' => $scheme + ; + } + + return $this; + } + + /** + * Returns the authentication data + * + * The array has the keys 'user', 'password' and 'scheme', where 'scheme' + * is one of the HTTP_Request2::AUTH_* constants. + * + * @return array{user: string, password: string, scheme: string}|null + */ + public function getAuth() + { + return $this->auth; + } + + /** + * Sets request header(s) + * + * The first parameter may be either a full header string 'header: value' or + * header name. In the former case $value parameter is ignored, in the latter + * the header's value will either be set to $value or the header will be + * removed if $value is null. The first parameter can also be an array of + * headers, in that case method will be called recursively. + * + * Note that headers are treated case insensitively as per RFC 2616. + * + * <code> + * $req->setHeader('Foo: Bar'); // sets the value of 'Foo' header to 'Bar' + * $req->setHeader('FoO', 'Baz'); // sets the value of 'Foo' header to 'Baz' + * $req->setHeader(array('foo' => 'Quux')); // sets the value of 'Foo' header to 'Quux' + * $req->setHeader('FOO'); // removes 'Foo' header from request + * </code> + * + * @param string|array $name header name, header string ('Header: value') + * or an array of headers + * @param string|array|null $value header value if $name is not an array, + * header will be removed if value is null + * @param bool $replace whether to replace previous header with the + * same name or append to its value + * + * @return $this + * @throws HTTP_Request2_LogicException + */ + public function setHeader($name, $value = null, $replace = true) + { + if (is_array($name)) { + foreach ($name as $k => $v) { + if (is_string($k)) { + $this->setHeader($k, $v, $replace); + } else { + $this->setHeader($v, null, $replace); + } + } + } else { + if (null === $value && strpos($name, ':')) { + /** @psalm-suppress PossiblyUndefinedArrayOffset */ + list($name, $value) = array_map('trim', explode(':', $name, 2)); + } + // Header name should be a token: http://tools.ietf.org/html/rfc2616#section-4.2 + if (preg_match(self::REGEXP_INVALID_TOKEN, $name)) { + throw new HTTP_Request2_LogicException( + "Invalid header name '{$name}'", + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + // Header names are case insensitive anyway + $name = strtolower($name); + if (null === $value) { + unset($this->headers$name); + + } else { + if (is_array($value)) { + $value = implode(', ', array_map('trim', $value)); + } elseif (is_string($value)) { + $value = trim($value); + } + if (!isset($this->headers$name) || $replace) { + $this->headers$name = $value; + } else { + $this->headers$name .= ', ' . $value; + } + } + } + + return $this; + } + + /** + * Returns the request headers + * + * The array is of the form ('header name' => 'header value'), header names + * are lowercased + * + * @return array + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * Adds a cookie to the request + * + * If the request does not have a CookieJar object set, this method simply + * appends a cookie to "Cookie:" header. + * + * If a CookieJar object is available, the cookie is stored in that object. + * Data from request URL will be used for setting its 'domain' and 'path' + * parameters, 'expires' and 'secure' will be set to null and false, + * respectively. If you need further control, use CookieJar's methods. + * + * @param string $name cookie name + * @param string $value cookie value + * + * @return $this + * @throws HTTP_Request2_LogicException + * @see setCookieJar() + */ + public function addCookie($name, $value) + { + if (!empty($this->cookieJar)) { + $this->cookieJar->store( + 'name' => $name, 'value' => $value, $this->url + ); + + } else { + $cookie = $name . '=' . $value; + if (preg_match(self::REGEXP_INVALID_COOKIE, $cookie)) { + throw new HTTP_Request2_LogicException( + "Invalid cookie: '{$cookie}'", + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + $cookies = empty($this->headers'cookie')? '': $this->headers'cookie' . '; '; + $this->setHeader('cookie', $cookies . $cookie); + } + + return $this; + } + + /** + * Sets the request body + * + * If you provide file pointer rather than file name, it should support + * fstat() and rewind() operations. + * + * @param string|resource|HTTP_Request2_MultipartBody $body Either a + * string with the body or filename containing body or + * pointer to an open file or object with multipart body data + * @param bool $isFilename Whether + * first parameter is a filename + * + * @return $this + * @throws HTTP_Request2_LogicException + */ + public function setBody($body, $isFilename = false) + { + if ($body instanceof HTTP_Request2_MultipartBody) { + $this->body = $body; + } elseif ($isFilename || is_resource($body)) { + $fileData = $this->fopenWrapper($body, empty($this->headers'content-type')); + $this->body = $fileData'fp'; + if (empty($this->headers'content-type')) { + $this->setHeader('content-type', $fileData'type'); + } + } else { + $this->body = (string)$body; + } + $this->postParams = $this->uploads = ; + + return $this; + } + + /** + * Returns the request body + * + * @return string|resource|HTTP_Request2_MultipartBody + */ + public function getBody() + { + if (self::METHOD_POST == $this->method + && (!empty($this->postParams) || !empty($this->uploads)) + ) { + if (0 === strpos($this->headers'content-type', 'application/x-www-form-urlencoded')) { + $body = http_build_query($this->postParams, '', '&'); + if (!$this->getConfig('use_brackets')) { + $body = preg_replace('/%5B\d+%5D=/', '=', $body); + } + // support RFC 3986 by not encoding '~' symbol (request #15368) + return str_replace('%7E', '~', $body); + + } elseif (0 === strpos($this->headers'content-type', 'multipart/form-data')) { + require_once 'HTTP/Request2/MultipartBody.php'; + return new HTTP_Request2_MultipartBody( + $this->postParams, $this->uploads, $this->getConfig('use_brackets') + ); + } + } + return $this->body; + } + + /** + * Adds a file to form-based file upload + * + * Used to emulate file upload via a HTML form. The method also sets + * Content-Type of HTTP request to 'multipart/form-data'. + * + * If you just want to send the contents of a file as the body of HTTP + * request you should use setBody() method. + * + * If you provide file pointers rather than file names, they should support + * fstat() and rewind() operations. + * + * @param string $fieldName name of file-upload field + * @param string|resource|array $filename full name of local file, + * pointer to open file or an array of files + * @param string $sendFilename filename to send in the request + * @param string $contentType content-type of file being uploaded + * + * @return $this + * @throws HTTP_Request2_LogicException + */ + public function addUpload( + $fieldName, $filename, $sendFilename = null, $contentType = null + ) { + if (!is_array($filename)) { + $fileData = $this->fopenWrapper($filename, empty($contentType)); + $this->uploads$fieldName = + 'fp' => $fileData'fp', + 'filename' => !empty($sendFilename)? $sendFilename + :(is_string($filename)? basename($filename): 'anonymous.blob') , + 'size' => $fileData'size', + 'type' => empty($contentType)? $fileData'type': $contentType + ; + } else { + $fps = $names = $sizes = $types = ; + foreach ($filename as $f) { + if (!is_array($f)) { + $f = $f; + } + $fileData = $this->fopenWrapper($f0, empty($f2)); + $fps = $fileData'fp'; + $names = !empty($f1)? $f1 + :(is_string($f0)? basename($f0): 'anonymous.blob'); + $sizes = $fileData'size'; + $types = empty($f2)? $fileData'type': $f2; + } + $this->uploads$fieldName = + 'fp' => $fps, 'filename' => $names, 'size' => $sizes, 'type' => $types + ; + } + if (empty($this->headers'content-type') + || 'application/x-www-form-urlencoded' == $this->headers'content-type' + ) { + $this->setHeader('content-type', 'multipart/form-data'); + } + + return $this; + } + + /** + * Adds POST parameter(s) to the request. + * + * @param string|array $name parameter name or array ('name' => 'value') + * @param mixed $value parameter value (can be an array) + * + * @return $this + */ + public function addPostParameter($name, $value = null) + { + if (!is_array($name)) { + $this->postParams$name = $value; + } else { + foreach ($name as $k => $v) { + $this->addPostParameter($k, $v); + } + } + if (empty($this->headers'content-type')) { + $this->setHeader('content-type', 'application/x-www-form-urlencoded'); + } + + return $this; + } + + #ReturnTypeWillChange + /** + * Attaches a new observer + * + * @param SplObserver $observer any object implementing SplObserver + * + * @return void + */ + public function attach(SplObserver $observer) + { + foreach ($this->observers as $attached) { + if ($attached === $observer) { + return; + } + } + $this->observers = $observer; + } + + #ReturnTypeWillChange + /** + * Detaches an existing observer + * + * @param SplObserver $observer any object implementing SplObserver + * + * @return void + */ + public function detach(SplObserver $observer) + { + foreach ($this->observers as $key => $attached) { + if ($attached === $observer) { + unset($this->observers$key); + return; + } + } + } + + #ReturnTypeWillChange + /** + * Notifies all observers + * + * @return void + */ + public function notify() + { + foreach ($this->observers as $observer) { + $observer->update($this); + } + } + + /** + * Sets the last event + * + * Adapters should use this method to set the current state of the request + * and notify the observers. + * + * @param string $name event name + * @param mixed $data event data + * + * @return void + */ + public function setLastEvent($name, $data = null) + { + $this->lastEvent = + 'name' => $name, + 'data' => $data + ; + $this->notify(); + } + + /** + * Returns the last event + * + * Observers should use this method to access the last change in request. + * The following event names are possible: + * <ul> + * <li>'connect' - after connection to remote server, + * data is the destination (string)</li> + * <li>'disconnect' - after disconnection from server</li> + * <li>'sentHeaders' - after sending the request headers, + * data is the headers sent (string)</li> + * <li>'sentBodyPart' - after sending a part of the request body, + * data is the length of that part (int)</li> + * <li>'sentBody' - after sending the whole request body, + * data is request body length (int)</li> + * <li>'receivedHeaders' - after receiving the response headers, + * data is HTTP_Request2_Response object</li> + * <li>'receivedBodyPart' - after receiving a part of the response + * body, data is that part (string)</li> + * <li>'receivedEncodedBodyPart' - as 'receivedBodyPart', but data is still + * encoded by Content-Encoding</li> + * <li>'receivedBody' - after receiving the complete response + * body, data is HTTP_Request2_Response object</li> + * <li>'warning' - a problem arose during the request + * that is not severe enough to throw + * an Exception, data is the warning + * message (string). Currently dispatched if + * response body was received incompletely.</li> + * </ul> + * Different adapters may not send all the event types. Mock adapter does + * not send any events to the observers. + * + * @return array The array has two keys: 'name' and 'data' + */ + public function getLastEvent() + { + return $this->lastEvent; + } + + /** + * Sets the adapter used to actually perform the request + * + * You can pass either an instance of a class implementing HTTP_Request2_Adapter + * or a class name. The method will only try to include a file if the class + * name starts with HTTP_Request2_Adapter_, it will also try to prepend this + * prefix to the class name if it doesn't contain any underscores, so that + * <code> + * $request->setAdapter('curl'); + * </code> + * will work. + * + * @param string|HTTP_Request2_Adapter $adapter Adapter to use + * + * @return $this + * @throws HTTP_Request2_LogicException + */ + public function setAdapter($adapter) + { + if (is_string($adapter)) { + if (!class_exists($adapter, false)) { + if (false === strpos($adapter, '_')) { + $adapter = 'HTTP_Request2_Adapter_' . ucfirst($adapter); + } + if (!class_exists($adapter, true) + && preg_match('/^HTTP_Request2_Adapter_(a-zA-Z0-9+)$/', $adapter) + ) { + include_once str_replace('_', DIRECTORY_SEPARATOR, $adapter) . '.php'; + } + if (!class_exists($adapter, false)) { + throw new HTTP_Request2_LogicException( + "Class {$adapter} not found", + HTTP_Request2_Exception::MISSING_VALUE + ); + } + } + $adapter = new $adapter; + } + if (!$adapter instanceof HTTP_Request2_Adapter) { + throw new HTTP_Request2_LogicException( + 'Parameter is not a HTTP request adapter', + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + $this->adapter = $adapter; + + return $this; + } + + /** + * Sets the cookie jar + * + * A cookie jar is used to maintain cookies across HTTP requests and + * responses. Cookies from jar will be automatically added to the request + * headers based on request URL. + * + * @param HTTP_Request2_CookieJar|bool|null $jar Existing CookieJar object, true to + * create a new one, false/null to remove + * + * @return $this + * @throws HTTP_Request2_LogicException + */ + public function setCookieJar($jar = true) + { + require_once 'HTTP/Request2/CookieJar.php'; + + if ($jar instanceof HTTP_Request2_CookieJar) { + $this->cookieJar = $jar; + } elseif (true === $jar) { + $this->cookieJar = new HTTP_Request2_CookieJar(); + } elseif (!$jar) { + $this->cookieJar = null; + } else { + throw new HTTP_Request2_LogicException( + 'Invalid parameter passed to setCookieJar()', + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + + return $this; + } + + /** + * Returns current CookieJar object or null if none + * + * @return HTTP_Request2_CookieJar|null + */ + public function getCookieJar() + { + return $this->cookieJar; + } + + /** + * Sends the request and returns the response + * + * @throws HTTP_Request2_Exception + * @return HTTP_Request2_Response + */ + public function send() + { + // Sanity check for URL + if (!$this->url instanceof Net_URL2 + || !$this->url->isAbsolute() + || !in_array(strtolower((string)$this->url->getScheme()), 'https', 'http') + ) { + throw new HTTP_Request2_LogicException( + 'HTTP_Request2 needs an absolute HTTP(S) request URL, ' + . ($this->url instanceof Net_URL2 + ? "'" . $this->url->__toString() . "'" : 'none') + . ' given', + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + if (empty($this->adapter)) { + $this->setAdapter($this->getConfig('adapter')); + } + // force using single byte encoding if mbstring extension overloads + // strlen() and substr(); see bug #1781, bug #10605 + if (extension_loaded('mbstring') && (2 & (int)ini_get('mbstring.func_overload'))) { + $oldEncoding = mb_internal_encoding(); + mb_internal_encoding('8bit'); + } + + try { + return $this->adapter->sendRequest($this); + } finally { + if (!empty($oldEncoding)) { + mb_internal_encoding($oldEncoding); + } + } + } + + /** + * Wrapper around fopen()/fstat() used by setBody() and addUpload() + * + * @param string|resource $file file name or pointer to open file + * @param bool $detectType whether to try autodetecting MIME + * type of file, will only work if $file is a + * filename, not pointer + * + * @return array{fp: resource, size: int, type: string} + * @throws HTTP_Request2_LogicException + */ + protected function fopenWrapper($file, $detectType = false) + { + if (!is_string($file) && !is_resource($file)) { + throw new HTTP_Request2_LogicException( + "Filename or file pointer resource expected", + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + $fileData = + 'type' => 'application/octet-stream', + 'size' => 0 + ; + if (is_resource($file)) { + $fileData'fp' = $file; + } else { + if (!($fileData'fp' = @fopen($file, 'rb'))) { + $error = error_get_last(); + throw new HTTP_Request2_LogicException( + $error ? $error'message' : "fopen() error", + HTTP_Request2_Exception::READ_ERROR + ); + } + if ($detectType) { + $fileData'type' = self::detectMimeType($file); + } + } + if (!($stat = fstat($fileData'fp'))) { + throw new HTTP_Request2_LogicException( + "fstat() call failed", HTTP_Request2_Exception::READ_ERROR + ); + } + $fileData'size' = $stat'size'; + + return $fileData; + } + + /** + * Tries to detect MIME type of a file + * + * The method will try to use fileinfo extension if it is available, + * deprecated mime_content_type() function in the other case. If neither + * works, default 'application/octet-stream' MIME type is returned + * + * @param string $filename file name + * + * @return string file MIME type + */ + protected static function detectMimeType($filename) + { + // finfo extension from PECL available + if (function_exists('finfo_open')) { + if (!isset(self::$_fileinfoDb)) { + self::$_fileinfoDb = @finfo_open(FILEINFO_MIME); + } + if (self::$_fileinfoDb) { + $info = finfo_file(self::$_fileinfoDb, $filename); + } + } + // (deprecated) mime_content_type function available + if (empty($info) && function_exists('mime_content_type')) { + $info = mime_content_type($filename); + } + return empty($info)? 'application/octet-stream': $info; + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/Adapter.php
Added
@@ -0,0 +1,143 @@ +<?php +/** + * Base class for HTTP_Request2 adapters + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Class representing a HTTP response + */ +require_once 'HTTP/Request2/Response.php'; + +/** + * Base class for HTTP_Request2 adapters + * + * HTTP_Request2 class itself only defines methods for aggregating the request + * data, all actual work of sending the request to the remote server and + * receiving its response is performed by adapters. + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +abstract class HTTP_Request2_Adapter +{ + /** + * A list of methods that MUST NOT have a request body, per RFC 2616 + * + * @var array + */ + protected static $bodyDisallowed = 'TRACE'; + + /** + * Methods having defined semantics for request body + * + * Content-Length header (indicating that the body follows, section 4.3 of + * RFC 2616) will be sent for these methods even if no body was added + * + * @var array + * @link http://pear.php.net/bugs/bug.php?id=12900 + * @link http://pear.php.net/bugs/bug.php?id=14740 + */ + protected static $bodyRequired = 'POST', 'PUT'; + + /** + * Request being sent + * + * @var HTTP_Request2 + */ + protected $request; + + /** + * Request body + * + * @var string|resource|HTTP_Request2_MultipartBody + * @see HTTP_Request2::getBody() + */ + protected $requestBody; + + /** + * Length of the request body + * + * @var integer + */ + protected $contentLength; + + /** + * Sends request to the remote server and returns its response + * + * @param HTTP_Request2 $request HTTP request message + * + * @return HTTP_Request2_Response + * @throws HTTP_Request2_Exception + */ + abstract public function sendRequest(HTTP_Request2 $request); + + /** + * Calculates length of the request body, adds proper headers + * + * @param array $headers associative array of request headers, this method + * will add proper 'Content-Length' and 'Content-Type' + * headers to this array (or remove them if not needed) + * + * @return void + */ + protected function calculateRequestLength(&$headers) + { + $this->requestBody = $this->request->getBody(); + + if (is_string($this->requestBody)) { + $this->contentLength = strlen($this->requestBody); + } elseif (is_resource($this->requestBody)) { + $stat = fstat($this->requestBody); + $this->contentLength = $stat'size'; + rewind($this->requestBody); + } else { + $this->contentLength = $this->requestBody->getLength(); + $headers'content-type' = 'multipart/form-data; boundary=' . + $this->requestBody->getBoundary(); + $this->requestBody->rewind(); + } + + if (in_array($this->request->getMethod(), self::$bodyDisallowed) + || 0 == $this->contentLength + ) { + // No body: send a Content-Length header nonetheless (request #12900), + // but do that only for methods that require a body (bug #14740) + if (in_array($this->request->getMethod(), self::$bodyRequired)) { + $headers'content-length' = 0; + } else { + unset($headers'content-length'); + // if the method doesn't require a body and doesn't have a + // body, don't send a Content-Type header. (request #16799) + unset($headers'content-type'); + } + } else { + if (empty($headers'content-type')) { + $headers'content-type' = 'application/x-www-form-urlencoded'; + } + // Content-Length should not be sent for chunked Transfer-Encoding (bug #20125) + if (!isset($headers'transfer-encoding')) { + $headers'content-length' = $this->contentLength; + } + } + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/Adapter/Curl.php
Added
@@ -0,0 +1,592 @@ +<?php +/** + * Adapter for HTTP_Request2 wrapping around cURL extension + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Base class for HTTP_Request2 adapters + */ +require_once 'HTTP/Request2/Adapter.php'; + +/** + * Adapter for HTTP_Request2 wrapping around cURL extension + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_Adapter_Curl extends HTTP_Request2_Adapter +{ + /** + * Mapping of header names to cURL options + * + * @var array + */ + protected static $headerMap = + 'accept-encoding' => CURLOPT_ENCODING, + 'cookie' => CURLOPT_COOKIE, + 'referer' => CURLOPT_REFERER, + 'user-agent' => CURLOPT_USERAGENT + ; + + /** + * Mapping of SSL context options to cURL options + * + * @var array + */ + protected static $sslContextMap = + 'ssl_verify_peer' => CURLOPT_SSL_VERIFYPEER, + 'ssl_cafile' => CURLOPT_CAINFO, + 'ssl_capath' => CURLOPT_CAPATH, + 'ssl_local_cert' => CURLOPT_SSLCERT, + 'ssl_passphrase' => CURLOPT_SSLCERTPASSWD + ; + + /** + * Mapping of CURLE_* constants to Exception subclasses and error codes + * + * @var array<int, array{0: class-string<HTTP_Request2_Exception>, 1?: int}> + */ + protected static $errorMap = + CURLE_UNSUPPORTED_PROTOCOL => HTTP_Request2_MessageException::class, + HTTP_Request2_Exception::NON_HTTP_REDIRECT, + CURLE_COULDNT_RESOLVE_PROXY => HTTP_Request2_ConnectionException::class, + CURLE_COULDNT_RESOLVE_HOST => HTTP_Request2_ConnectionException::class, + CURLE_COULDNT_CONNECT => HTTP_Request2_ConnectionException::class, + // error returned from write callback + CURLE_WRITE_ERROR => HTTP_Request2_MessageException::class, + HTTP_Request2_Exception::NON_HTTP_REDIRECT, + CURLE_OPERATION_TIMEOUTED => HTTP_Request2_MessageException::class, + HTTP_Request2_Exception::TIMEOUT, + CURLE_HTTP_RANGE_ERROR => HTTP_Request2_MessageException::class, + CURLE_SSL_CONNECT_ERROR => HTTP_Request2_ConnectionException::class, + CURLE_LIBRARY_NOT_FOUND => HTTP_Request2_LogicException::class, + HTTP_Request2_Exception::MISCONFIGURATION, + CURLE_FUNCTION_NOT_FOUND => HTTP_Request2_LogicException::class, + HTTP_Request2_Exception::MISCONFIGURATION, + CURLE_ABORTED_BY_CALLBACK => HTTP_Request2_MessageException::class, + HTTP_Request2_Exception::NON_HTTP_REDIRECT, + CURLE_TOO_MANY_REDIRECTS => HTTP_Request2_MessageException::class, + HTTP_Request2_Exception::TOO_MANY_REDIRECTS, + CURLE_SSL_PEER_CERTIFICATE => HTTP_Request2_ConnectionException::class, + CURLE_GOT_NOTHING => HTTP_Request2_MessageException::class, + CURLE_SSL_ENGINE_NOTFOUND => HTTP_Request2_LogicException::class, + HTTP_Request2_Exception::MISCONFIGURATION, + CURLE_SSL_ENGINE_SETFAILED => HTTP_Request2_LogicException::class, + HTTP_Request2_Exception::MISCONFIGURATION, + CURLE_SEND_ERROR => HTTP_Request2_MessageException::class, + CURLE_RECV_ERROR => HTTP_Request2_MessageException::class, + CURLE_SSL_CERTPROBLEM => HTTP_Request2_LogicException::class, + HTTP_Request2_Exception::INVALID_ARGUMENT, + CURLE_SSL_CIPHER => HTTP_Request2_ConnectionException::class, + CURLE_BAD_CONTENT_ENCODING => HTTP_Request2_MessageException::class, + ; + + /** + * Response being received + * + * @var HTTP_Request2_Response|null + */ + protected $response; + + /** + * Whether 'sentHeaders' event was sent to observers + * + * @var boolean + */ + protected $eventSentHeaders = false; + + /** + * Whether 'receivedHeaders' event was sent to observers + * + * @var boolean + */ + protected $eventReceivedHeaders = false; + + /** + * Whether 'sentBoody' event was sent to observers + * + * @var boolean + */ + protected $eventSentBody = false; + + /** + * Position within request body + * + * @var integer + * @see callbackReadBody() + */ + protected $position = 0; + + /** + * Information about last transfer, as returned by curl_getinfo() + * + * @var array + */ + protected $lastInfo; + + /** + * Creates a subclass of HTTP_Request2_Exception from curl error data + * + * @param resource $ch curl handle + * + * @return HTTP_Request2_Exception + */ + protected static function wrapCurlError($ch) + { + $nativeCode = curl_errno($ch); + $message = 'Curl error: ' . curl_error($ch); + if (!isset(self::$errorMap$nativeCode)) { + return new HTTP_Request2_Exception($message, 0, $nativeCode); + } else { + $class = self::$errorMap$nativeCode0; + $code = empty(self::$errorMap$nativeCode1) + ? 0 : self::$errorMap$nativeCode1; + return new $class($message, $code, $nativeCode); + } + } + + /** + * Sends request to the remote server and returns its response + * + * @param HTTP_Request2 $request HTTP request message + * + * @return HTTP_Request2_Response + * @throws HTTP_Request2_Exception + */ + public function sendRequest(HTTP_Request2 $request) + { + if (!extension_loaded('curl')) { + throw new HTTP_Request2_LogicException( + 'cURL extension not available', HTTP_Request2_Exception::MISCONFIGURATION + ); + } + // These constants have the same value for cURL >= 7.62.0 + if (CURLE_SSL_CACERT !== CURLE_SSL_PEER_CERTIFICATE) { + self::$errorMapCURLE_SSL_CACERT = HTTP_Request2_ConnectionException::class; + } + + $this->request = $request; + $this->response = null; + $this->position = 0; + $this->eventSentHeaders = false; + $this->eventReceivedHeaders = false; + $this->eventSentBody = false; + + try { + if (false === curl_exec($ch = $this->createCurlHandle())) { + throw self::wrapCurlError($ch); + } + } finally { + if (isset($ch)) { + $this->lastInfo = curl_getinfo($ch); + if (CURLE_OK !== curl_errno($ch)) { + $this->request->setLastEvent('warning', curl_error($ch)); + } + curl_close($ch); + } + $response = $this->response; + unset($this->request, $this->requestBody, $this->response); + } + + // If no exceptions were thrown, $response should be set here + /** @var HTTP_Request2_Response $response */ + if ($jar = $request->getCookieJar()) { + $jar->addCookiesFromResponse($response); + } + + if (0 < $this->lastInfo'size_download') { + $request->setLastEvent('receivedBody', $response); + } + return $response; + } + + /** + * Returns information about last transfer + * + * @return array associative array as returned by curl_getinfo() + */ + public function getInfo() + { + return $this->lastInfo; + } + + /** + * Creates a new cURL handle and populates it with data from the request + * + * @return resource a cURL handle, as created by curl_init() + * @throws HTTP_Request2_LogicException + * @throws HTTP_Request2_NotImplementedException + */ + protected function createCurlHandle() + { + $ch = curl_init(); + + curl_setopt_array( + $ch, + // setup write callbacks + CURLOPT_HEADERFUNCTION => $this, 'callbackWriteHeader', + CURLOPT_WRITEFUNCTION => $this, 'callbackWriteBody', + // buffer size + CURLOPT_BUFFERSIZE => $this->request->getConfig('buffer_size'), + // connection timeout + CURLOPT_CONNECTTIMEOUT => $this->request->getConfig('connect_timeout'), + // save full outgoing headers, in case someone is interested + CURLINFO_HEADER_OUT => true, + // request url + CURLOPT_URL => $this->request->getUrl()->getUrl() + + ); + + // set up redirects + if (!$this->request->getConfig('follow_redirects')) { + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); + } else { + if (!@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true)) { + throw new HTTP_Request2_LogicException( + 'Redirect support in curl is unavailable due to open_basedir or safe_mode setting', + HTTP_Request2_Exception::MISCONFIGURATION + ); + } + curl_setopt($ch, CURLOPT_MAXREDIRS, $this->request->getConfig('max_redirects')); + // limit redirects to http(s), works in 5.2.10+ + if (defined('CURLOPT_REDIR_PROTOCOLS')) { + curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + } + // works in 5.3.2+, http://bugs.php.net/bug.php?id=49571 + if ($this->request->getConfig('strict_redirects') && defined('CURLOPT_POSTREDIR')) { + curl_setopt($ch, CURLOPT_POSTREDIR, 3); + } + } + + // set local IP via CURLOPT_INTERFACE (request #19515) + if ($ip = $this->request->getConfig('local_ip')) { + curl_setopt($ch, CURLOPT_INTERFACE, $ip); + } + + // request timeout + if ($timeout = $this->request->getConfig('timeout')) { + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); + } + + // set HTTP version + switch ($this->request->getConfig('protocol_version')) { + case '1.0': + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + break; + case '1.1': + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + } + + // set request method + switch ($this->request->getMethod()) { + case HTTP_Request2::METHOD_GET: + curl_setopt($ch, CURLOPT_HTTPGET, true); + break; + case HTTP_Request2::METHOD_POST: + curl_setopt($ch, CURLOPT_POST, true); + break; + case HTTP_Request2::METHOD_HEAD: + curl_setopt($ch, CURLOPT_NOBODY, true); + break; + case HTTP_Request2::METHOD_PUT: + curl_setopt($ch, CURLOPT_UPLOAD, true); + break; + default: + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->request->getMethod()); + } + + // set proxy, if needed + if ($host = $this->request->getConfig('proxy_host')) { + if (!($port = $this->request->getConfig('proxy_port'))) { + throw new HTTP_Request2_LogicException( + 'Proxy port not provided', HTTP_Request2_Exception::MISSING_VALUE + ); + } + curl_setopt($ch, CURLOPT_PROXY, $host . ':' . $port); + if ('' !== ($user = (string)$this->request->getConfig('proxy_user'))) { + curl_setopt( + $ch, CURLOPT_PROXYUSERPWD, + $user . ':' . $this->request->getConfig('proxy_password') + ); + switch ($this->request->getConfig('proxy_auth_scheme')) { + case HTTP_Request2::AUTH_BASIC: + curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); + break; + case HTTP_Request2::AUTH_DIGEST: + curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_DIGEST); + } + } + if ($type = $this->request->getConfig('proxy_type')) { + switch ($type) { + case 'http': + curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); + break; + case 'socks5': + curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); + break; + default: + throw new HTTP_Request2_NotImplementedException( + "Proxy type '{$type}' is not supported" + ); + } + } + } + + // set authentication data + if ($auth = $this->request->getAuth()) { + curl_setopt($ch, CURLOPT_USERPWD, $auth'user' . ':' . $auth'password'); + switch ($auth'scheme') { + case HTTP_Request2::AUTH_BASIC: + curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + break; + case HTTP_Request2::AUTH_DIGEST: + curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + } + } + + // set SSL options + foreach ($this->request->getConfig() as $name => $value) { + if ('ssl_verify_host' == $name && null !== $value) { + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $value? 2: 0); + } elseif (isset(self::$sslContextMap$name) && null !== $value) { + curl_setopt($ch, self::$sslContextMap$name, $value); + } + } + + $headers = $this->request->getHeaders(); + // make cURL automagically send proper header + if (!isset($headers'accept-encoding')) { + $headers'accept-encoding' = ''; + } + + if (($jar = $this->request->getCookieJar()) + && ($cookies = $jar->getMatching($this->request->getUrl(), true)) + ) { + $headers'cookie' = (empty($headers'cookie')? '': $headers'cookie' . '; ') . $cookies; + } + + // set headers having special cURL keys + foreach (self::$headerMap as $name => $option) { + if (isset($headers$name)) { + curl_setopt($ch, $option, $headers$name); + unset($headers$name); + } + } + + $this->calculateRequestLength($headers); + if (isset($headers'content-length') || isset($headers'transfer-encoding')) { + $this->workaroundPhpBug47204($ch, $headers); + } + + // set headers not having special keys + $headersFmt = ; + foreach ($headers as $name => $value) { + $canonicalName = implode('-', array_map('ucfirst', explode('-', $name))); + $headersFmt = $canonicalName . ': ' . $value; + } + curl_setopt($ch, CURLOPT_HTTPHEADER, $headersFmt); + + return $ch; + } + + /** + * Workaround for PHP bug #47204 that prevents rewinding request body + * + * The workaround consists of reading the entire request body into memory + * and setting it as CURLOPT_POSTFIELDS, so it isn't recommended for large + * file uploads, use Socket adapter instead. + * + * @param resource $ch cURL handle + * @param array $headers Request headers + * + * @return void + */ + protected function workaroundPhpBug47204($ch, &$headers) + { + // no redirects, no digest auth -> probably no rewind needed + // also apply workaround only for POSTs, othrerwise we get + // https://pear.php.net/bugs/bug.php?id=20440 for PUTs + if (!$this->request->getConfig('follow_redirects') + && (!($auth = $this->request->getAuth()) + || HTTP_Request2::AUTH_DIGEST !== $auth'scheme') + || HTTP_Request2::METHOD_POST !== $this->request->getMethod() + ) { + curl_setopt($ch, CURLOPT_READFUNCTION, $this, 'callbackReadBody'); + + } else { + // rewind may be needed, read the whole body into memory + if ($this->requestBody instanceof HTTP_Request2_MultipartBody) { + $this->requestBody = $this->requestBody->__toString(); + + } elseif (is_resource($this->requestBody)) { + $fp = $this->requestBody; + $this->requestBody = ''; + while (!feof($fp)) { + $this->requestBody .= fread($fp, 16384); + } + } + // curl hangs up if content-length is present + unset($headers'content-length'); + curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody); + } + } + + /** + * Callback function called by cURL for reading the request body + * + * @param resource $ch cURL handle + * @param resource $fd file descriptor (not used) + * @param integer $length maximum length of data to return + * + * @return string part of the request body, up to $length bytes + */ + protected function callbackReadBody($ch, $fd, $length) + { + if (!$this->eventSentHeaders) { + $this->request->setLastEvent( + 'sentHeaders', curl_getinfo($ch, CURLINFO_HEADER_OUT) + ); + $this->eventSentHeaders = true; + } + if (in_array($this->request->getMethod(), self::$bodyDisallowed) + || 0 == $this->contentLength || $this->position >= $this->contentLength + ) { + return ''; + } + if (is_string($this->requestBody)) { + $string = substr($this->requestBody, $this->position, $length); + } elseif (is_resource($this->requestBody)) { + $string = fread($this->requestBody, $length); + } else { + $string = $this->requestBody->read($length); + } + $this->request->setLastEvent('sentBodyPart', strlen($string)); + $this->position += strlen($string); + return $string; + } + + /** + * Callback function called by cURL for saving the response headers + * + * @param resource $ch cURL handle + * @param string $string response header (with trailing CRLF) + * + * @return integer number of bytes saved + * @see HTTP_Request2_Response::parseHeaderLine() + */ + protected function callbackWriteHeader($ch, $string) + { + if (!$this->eventSentHeaders + // we may receive a second set of headers if doing e.g. digest auth + // but don't bother with 100-Continue responses (bug #15785) + || $this->eventReceivedHeaders + && null !== $this->response + && $this->response->getStatus() >= 200 + ) { + $this->request->setLastEvent( + 'sentHeaders', curl_getinfo($ch, CURLINFO_HEADER_OUT) + ); + } + if (!$this->eventSentBody) { + $upload = curl_getinfo($ch, CURLINFO_SIZE_UPLOAD); + // if body wasn't read by the callback, send event with total body size + if ($upload > $this->position) { + $this->request->setLastEvent( + 'sentBodyPart', $upload - $this->position + ); + } + if ($upload > 0) { + $this->request->setLastEvent('sentBody', $upload); + } + } + $this->eventSentHeaders = true; + $this->eventSentBody = true; + + if ($this->eventReceivedHeaders || empty($this->response)) { + $this->eventReceivedHeaders = false; + $this->response = new HTTP_Request2_Response( + $string, false, curl_getinfo($ch, CURLINFO_EFFECTIVE_URL) + ); + + } else { + $this->response->parseHeaderLine($string); + if ('' == trim($string)) { + // don't bother with 100-Continue responses (bug #15785) + if (200 <= $this->response->getStatus()) { + $this->request->setLastEvent('receivedHeaders', $this->response); + } + + if ($this->request->getConfig('follow_redirects') && $this->response->isRedirect()) { + $redirectUrl = new Net_URL2((string)$this->response->getHeader('location')); + + // for versions lower than 5.2.10, check the redirection URL protocol + if (!defined('CURLOPT_REDIR_PROTOCOLS') && $redirectUrl->isAbsolute() + && !in_array($redirectUrl->getScheme(), 'http', 'https') + ) { + return -1; + } + + if ($jar = $this->request->getCookieJar()) { + $jar->addCookiesFromResponse($this->response); + if (!$redirectUrl->isAbsolute()) { + $redirectUrl = $this->request->getUrl()->resolve($redirectUrl); + } + if ($cookies = $jar->getMatching($redirectUrl, true)) { + curl_setopt($ch, CURLOPT_COOKIE, $cookies); + } + } + } + $this->eventReceivedHeaders = true; + $this->eventSentBody = false; + } + } + return strlen($string); + } + + /** + * Callback function called by cURL for saving the response body + * + * @param resource $ch cURL handle (not used) + * @param string $string part of the response body + * + * @return integer number of bytes saved + * @throws HTTP_Request2_MessageException + * @see HTTP_Request2_Response::appendBody() + */ + protected function callbackWriteBody($ch, $string) + { + // cURL calls WRITEFUNCTION callback without calling HEADERFUNCTION if + // response doesn't start with proper HTTP status line (see bug #15716) + if (empty($this->response)) { + throw new HTTP_Request2_MessageException( + "Malformed response: {$string}", + HTTP_Request2_Exception::MALFORMED_RESPONSE + ); + } + if ($this->request->getConfig('store_body')) { + $this->response->appendBody($string); + } + $this->request->setLastEvent('receivedBodyPart', $string); + return strlen($string); + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/Adapter/Mock.php
Added
@@ -0,0 +1,167 @@ +<?php +/** + * Mock adapter intended for testing + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Base class for HTTP_Request2 adapters + */ +require_once 'HTTP/Request2/Adapter.php'; + +/** + * Mock adapter intended for testing + * + * Can be used to test applications depending on HTTP_Request2 package without + * actually performing any HTTP requests. This adapter will return responses + * previously added via addResponse() + * <code> + * $mock = new HTTP_Request2_Adapter_Mock(); + * $mock->addResponse("HTTP/1.1 ... "); + * + * $request = new HTTP_Request2(); + * $request->setAdapter($mock); + * + * // This will return the response set above + * $response = $req->send(); + * </code> + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_Adapter_Mock extends HTTP_Request2_Adapter +{ + /** + * A queue of responses to be returned by sendRequest() + * + * @var array<int, array{HTTP_Request2_Response|Exception, ?string}> + */ + protected $responses = ; + + /** + * Returns the next response from the queue built by addResponse() + * + * Only responses without explicit URLs or with URLs equal to request URL + * will be considered. If matching response is not found or the queue is + * empty then default empty response with status 400 will be returned, + * if an Exception object was added to the queue it will be thrown. + * + * @param HTTP_Request2 $request HTTP request message + * + * @return HTTP_Request2_Response + * @throws Exception + */ + public function sendRequest(HTTP_Request2 $request) + { + $requestUrl = (string)$request->getUrl(); + $response = null; + foreach ($this->responses as $k => $v) { + if (!$v1 || $requestUrl == $v1) { + $response = $v0; + array_splice($this->responses, $k, 1); + break; + } + } + + if ($response instanceof HTTP_Request2_Response) { + return $response; + } elseif ($response instanceof Exception) { + // rethrow the exception + $class = get_class($response); + $message = $response->getMessage(); + $code = $response->getCode(); + throw new $class($message, $code); + } else { + return self::createResponseFromString("HTTP/1.1 400 Bad Request\r\n\r\n"); + } + } + + /** + * Adds response to the queue + * + * @param mixed $response either a string, a pointer to an open file, + * an instance of HTTP_Request2_Response or Exception + * @param string $url A request URL this response should be valid for + * (see {@link http://pear.php.net/bugs/bug.php?id=19276}) + * + * @return void + * @throws HTTP_Request2_Exception + */ + public function addResponse($response, $url = null) + { + if (is_string($response)) { + $response = self::createResponseFromString($response); + } elseif (is_resource($response)) { + $response = self::createResponseFromFile($response); + } elseif (!$response instanceof HTTP_Request2_Response + && !$response instanceof Exception + ) { + throw new HTTP_Request2_Exception('Parameter is not a valid response'); + } + $this->responses = $response, $url; + } + + /** + * Creates a new HTTP_Request2_Response object from a string + * + * @param string $str string containing HTTP response message + * + * @return HTTP_Request2_Response + * @throws HTTP_Request2_Exception + */ + public static function createResponseFromString($str) + { + $parts = preg_split('!(\r?\n){2}!m', $str, 2); + $headerLines = explode("\n", $parts0); + $response = new HTTP_Request2_Response(array_shift($headerLines)); + foreach ($headerLines as $headerLine) { + $response->parseHeaderLine($headerLine); + } + $response->parseHeaderLine(''); + if (isset($parts1)) { + $response->appendBody($parts1); + } + return $response; + } + + /** + * Creates a new HTTP_Request2_Response object from a file + * + * @param resource $fp file pointer returned by fopen() + * + * @return HTTP_Request2_Response + * @throws HTTP_Request2_Exception + */ + public static function createResponseFromFile($fp) + { + $response = new HTTP_Request2_Response(fgets($fp)); + do { + $headerLine = fgets($fp); + $response->parseHeaderLine($headerLine); + } while ('' != trim($headerLine)); + + while (!feof($fp)) { + $response->appendBody(fread($fp, 8192)); + } + return $response; + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/Adapter/Socket.php
Added
@@ -0,0 +1,1156 @@ +<?php +/** + * Socket-based adapter for HTTP_Request2 + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Base class for HTTP_Request2 adapters */ +require_once 'HTTP/Request2/Adapter.php'; + +/** Socket wrapper class */ +require_once 'HTTP/Request2/SocketWrapper.php'; + +/** + * Socket-based adapter for HTTP_Request2 + * + * This adapter uses only PHP sockets and will work on almost any PHP + * environment. Code is based on original HTTP_Request PEAR package. + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_Adapter_Socket extends HTTP_Request2_Adapter +{ + /** + * Regular expression for 'token' rule from RFC 2616 + */ + const REGEXP_TOKEN = '^\x00-\x1f\x7f-\xff()<>@,;:\\\\"/\\?={}\s+'; + + /** + * Regular expression for 'quoted-string' rule from RFC 2616 + */ + const REGEXP_QUOTED_STRING = '"(?>^"\\\\+|\\\\.)*"'; + + /** + * Connected sockets, needed for Keep-Alive support + * + * @var HTTP_Request2_SocketWrapper + * @see connect() + */ + protected static $sockets = ; + + /** + * Data for digest authentication scheme + * + * The keys for the array are URL prefixes. + * + * The values are associative arrays with data (realm, nonce, nonce-count, + * opaque...) needed for digest authentication. Stored here to prevent making + * duplicate requests to digest-protected resources after we have already + * received the challenge. + * + * @var array + */ + protected static $challenges = ; + + /** + * Connected socket + * + * @var HTTP_Request2_SocketWrapper + * @see connect() + */ + protected $socket; + + /** + * Challenge used for server digest authentication + * + * @var array + */ + protected $serverChallenge; + + /** + * Challenge used for proxy digest authentication + * + * @var array + */ + protected $proxyChallenge; + + /** + * Remaining length of the current chunk, when reading chunked response + * + * @var integer + * @see readChunked() + */ + protected $chunkLength = 0; + + /** + * Remaining amount of redirections to follow + * + * Starts at 'max_redirects' configuration parameter and is reduced on each + * subsequent redirect. An Exception will be thrown once it reaches zero. + * + * @var int|null + */ + protected $redirectCountdown = null; + + /** + * Whether to wait for "100 Continue" response before sending request body + * + * @var bool + */ + protected $expect100Continue = false; + + /** + * Sends request to the remote server and returns its response + * + * @param HTTP_Request2 $request HTTP request message + * + * @return HTTP_Request2_Response + * @throws HTTP_Request2_Exception + */ + public function sendRequest(HTTP_Request2 $request) + { + $this->request = $request; + + try { + $keepAlive = $this->connect(); + $headers = $this->prepareHeaders(); + $this->socket->write($headers); + // provide request headers to the observer, see request #7633 + $this->request->setLastEvent('sentHeaders', $headers); + + if (!$this->expect100Continue) { + $this->writeBody(); + $response = $this->readResponse(); + + } else { + $response = $this->readResponse(); + if (null === $response || 100 === $response->getStatus()) { + $this->expect100Continue = false; + // either got "100 Continue" or timed out -> send body + $this->writeBody(); + $response = $this->readResponse(); + } + } + + // If no exceptions were thrown, $response should be available here + /** @var HTTP_Request2_Response $response */ + if ($jar = $request->getCookieJar()) { + $jar->addCookiesFromResponse($response); + } + + if (!$this->canKeepAlive($keepAlive, $response)) { + $this->disconnect(); + } + + if ($this->shouldUseProxyDigestAuth($response)) { + return $this->sendRequest($request); + } + if ($this->shouldUseServerDigestAuth($response)) { + return $this->sendRequest($request); + } + if ($authInfo = $response->getHeader('authentication-info')) { + $this->updateChallenge($this->serverChallenge, $authInfo); + } + if ($proxyInfo = $response->getHeader('proxy-authentication-info')) { + $this->updateChallenge($this->proxyChallenge, $proxyInfo); + } + + } catch (Exception $e) { + $this->disconnect(); + $this->redirectCountdown = null; + throw $e; + + } finally { + unset($this->request, $this->requestBody); + } + + if (!$request->getConfig('follow_redirects') || !$response->isRedirect()) { + $this->redirectCountdown = null; + return $response; + } else { + return $this->handleRedirect($request, $response); + } + } + + /** + * Connects to the remote server + * + * @return bool whether the connection can be persistent + * @throws HTTP_Request2_Exception + */ + protected function connect() + { + $secure = 0 === strcasecmp((string)$this->request->getUrl()->getScheme(), 'https'); + $tunnel = HTTP_Request2::METHOD_CONNECT === $this->request->getMethod(); + $headers = $this->request->getHeaders(); + $reqHost = (string)$this->request->getUrl()->getHost(); + if (!($reqPort = (int)$this->request->getUrl()->getPort())) { + $reqPort = $secure? 443: 80; + } + + $httpProxy = $socksProxy = false; + if (!($host = $this->request->getConfig('proxy_host'))) { + $host = $reqHost; + $port = $reqPort; + } else { + if (!($port = $this->request->getConfig('proxy_port'))) { + throw new HTTP_Request2_LogicException( + 'Proxy port not provided', + HTTP_Request2_Exception::MISSING_VALUE + ); + } + if ('http' == ($type = $this->request->getConfig('proxy_type'))) { + $httpProxy = true; + } elseif ('socks5' == $type) { + $socksProxy = true; + } else { + throw new HTTP_Request2_NotImplementedException( + "Proxy type '{$type}' is not supported" + ); + } + } + + if ($tunnel && !$httpProxy) { + throw new HTTP_Request2_LogicException( + "Trying to perform CONNECT request without proxy", + HTTP_Request2_Exception::MISSING_VALUE + ); + } + if ($secure && !in_array('ssl', stream_get_transports())) { + throw new HTTP_Request2_LogicException( + 'Need OpenSSL support for https:// requests', + HTTP_Request2_Exception::MISCONFIGURATION + ); + } + + // RFC 2068, section 19.7.1: A client MUST NOT send the Keep-Alive + // connection token to a proxy server... + if ($httpProxy && !$secure && !empty($headers'connection') + && 'Keep-Alive' == $headers'connection' + ) { + $this->request->setHeader('connection'); + } + + $keepAlive = ('1.1' == $this->request->getConfig('protocol_version') && + empty($headers'connection')) || + (!empty($headers'connection') && + 'Keep-Alive' == $headers'connection'); + + $options = ; + if ($ip = $this->request->getConfig('local_ip')) { + $options'socket' = + 'bindto' => (false === strpos($ip, ':') ? $ip : '' . $ip . '') . ':0' + ; + } + if ($secure || $tunnel) { + $options'ssl' = ; + foreach ($this->request->getConfig() as $name => $value) { + if ('ssl_' == substr($name, 0, 4) && null !== $value) { + if ('ssl_verify_host' == $name) { + $options'ssl''verify_peer_name' = $value; + $options'ssl''peer_name' = $reqHost; + + } else { + $options'ssl'substr($name, 4) = $value; + } + } + } + ksort($options'ssl'); + } + + // Use global request timeout if given, see feature requests #5735, #8964 + if ($timeout = $this->request->getConfig('timeout')) { + $deadline = microtime(true) + $timeout; + } else { + $deadline = null; + } + + // Changing SSL context options after connection is established does *not* + // work, we need a new connection if options change + $remote = ((!$secure || $httpProxy || $socksProxy)? 'tcp://': 'tls://') + . $host . ':' . $port; + $socketKey = $remote . ( + ($secure && $httpProxy || $socksProxy) + ? "->{$reqHost}:{$reqPort}" : '' + ) . (empty($options)? '': ':' . serialize($options)); + unset($this->socket); + + // We use persistent connections and have a connected socket? + // Ensure that the socket is still connected, see bug #16149 + if ($keepAlive && !empty(self::$sockets$socketKey) + && !self::$sockets$socketKey->eof() + ) { + $this->socket =& self::$sockets$socketKey; + + } else { + if ($socksProxy) { + require_once 'HTTP/Request2/SOCKS5.php'; + + $this->socket = new HTTP_Request2_SOCKS5( + $remote, + $this->request->getConfig('connect_timeout'), + $options, + (string)$this->request->getConfig('proxy_user'), + (string)$this->request->getConfig('proxy_password') + ); + // handle request timeouts ASAP + $this->socket->setDeadline($deadline, $this->request->getConfig('timeout')); + $this->socket->connect($reqHost, $reqPort); + if (!$secure) { + $conninfo = "tcp://{$reqHost}:{$reqPort} via {$remote}"; + } else { + $this->socket->enableCrypto(); + $conninfo = "tls://{$reqHost}:{$reqPort} via {$remote}"; + } + + } elseif ($secure && $httpProxy && !$tunnel) { + $this->establishTunnel(); + $conninfo = "tls://{$reqHost}:{$reqPort} via {$remote}"; + + } else { + $this->socket = new HTTP_Request2_SocketWrapper( + $remote, $this->request->getConfig('connect_timeout'), $options + ); + } + $this->request->setLastEvent('connect', empty($conninfo)? $remote: $conninfo); + self::$sockets$socketKey =& $this->socket; + } + $this->socket->setDeadline($deadline, $this->request->getConfig('timeout')); + return $keepAlive; + } + + /** + * Establishes a tunnel to a secure remote server via HTTP CONNECT request + * + * This method will fail if 'ssl_verify_peer' is enabled. Probably because PHP + * sees that we are connected to a proxy server (duh!) rather than the server + * that presents its certificate. + * + * @link http://tools.ietf.org/html/rfc2817#section-5.2 + * + * @return void + * @throws HTTP_Request2_Exception + */ + protected function establishTunnel() + { + $donor = new self; + $connect = new HTTP_Request2( + $this->request->getUrl(), HTTP_Request2::METHOD_CONNECT, + array_merge($this->request->getConfig(), 'adapter' => $donor) + ); + $response = $connect->send(); + // Need any successful (2XX) response + if (200 > $response->getStatus() || 300 <= $response->getStatus()) { + throw new HTTP_Request2_ConnectionException( + 'Failed to connect via HTTPS proxy. Proxy response: ' . + $response->getStatus() . ' ' . $response->getReasonPhrase() + ); + } + $this->socket = $donor->socket; + $this->socket->enableCrypto(); + } + + /** + * Checks whether current connection may be reused or should be closed + * + * @param boolean $requestKeepAlive whether connection could + * be persistent in the first place + * @param HTTP_Request2_Response $response response object to check + * + * @return boolean + */ + protected function canKeepAlive($requestKeepAlive, HTTP_Request2_Response $response) + { + // Do not close socket on successful CONNECT request + if (HTTP_Request2::METHOD_CONNECT === $this->request->getMethod() + && 200 <= $response->getStatus() && 300 > $response->getStatus() + ) { + return true; + } + + $lengthKnown = 'chunked' === strtolower($response->getHeader('transfer-encoding') ?: '') + || null !== $response->getHeader('content-length') + // no body possible for such responses, see also request #17031 + || HTTP_Request2::METHOD_HEAD === $this->request->getMethod() + || in_array($response->getStatus(), 204, 304); + $persistent = 'keep-alive' === strtolower($response->getHeader('connection') ?: '') || + (null === $response->getHeader('connection') && + '1.1' === $response->getVersion()); + return $requestKeepAlive && $lengthKnown && $persistent; + } + + /** + * Disconnects from the remote server + * + * @return void + */ + protected function disconnect() + { + if (!empty($this->socket)) { + /** @psalm-suppress PossiblyNullPropertyAssignmentValue */ + $this->socket = null; + $this->request->setLastEvent('disconnect'); + } + } + + /** + * Handles HTTP redirection + * + * This method will throw an Exception if redirect to a non-HTTP(S) location + * is attempted, also if number of redirects performed already is equal to + * 'max_redirects' configuration parameter. + * + * @param HTTP_Request2 $request Original request + * @param HTTP_Request2_Response $response Response containing redirect + * + * @return HTTP_Request2_Response Response from a new location + * @throws HTTP_Request2_Exception + */ + protected function handleRedirect( + HTTP_Request2 $request, HTTP_Request2_Response $response + ) { + if (is_null($this->redirectCountdown)) { + $this->redirectCountdown = $request->getConfig('max_redirects'); + } + if (0 == $this->redirectCountdown) { + $this->redirectCountdown = null; + // Copying cURL behaviour + throw new HTTP_Request2_MessageException( + 'Maximum (' . $request->getConfig('max_redirects') . ') redirects followed', + HTTP_Request2_Exception::TOO_MANY_REDIRECTS + ); + } + $redirectUrl = new Net_URL2( + (string)$response->getHeader('location'), + Net_URL2::OPTION_USE_BRACKETS => $request->getConfig('use_brackets') + ); + // refuse non-HTTP redirect + if ($redirectUrl->isAbsolute() + && !in_array($redirectUrl->getScheme(), 'http', 'https') + ) { + $this->redirectCountdown = null; + throw new HTTP_Request2_MessageException( + 'Refusing to redirect to a non-HTTP URL ' . $redirectUrl->__toString(), + HTTP_Request2_Exception::NON_HTTP_REDIRECT + ); + } + // Theoretically URL should be absolute (see http://tools.ietf.org/html/rfc2616#section-14.30), + // but in practice it is often not + if (!$redirectUrl->isAbsolute()) { + $redirectUrl = $request->getUrl()->resolve($redirectUrl); + } + $redirect = clone $request; + $redirect->setUrl($redirectUrl); + if (303 == $response->getStatus() + || (!$request->getConfig('strict_redirects') + && in_array($response->getStatus(), 301, 302)) + ) { + $redirect->setMethod(HTTP_Request2::METHOD_GET); + $redirect->setBody(''); + } + + if (0 < $this->redirectCountdown) { + $this->redirectCountdown--; + } + return $this->sendRequest($redirect); + } + + /** + * Checks whether another request should be performed with server digest auth + * + * Several conditions should be satisfied for it to return true: + * - response status should be 401 + * - auth credentials should be set in the request object + * - response should contain WWW-Authenticate header with digest challenge + * - there is either no challenge stored for this URL or new challenge + * contains stale=true parameter (in other case we probably just failed + * due to invalid username / password) + * + * The method stores challenge values in $challenges static property + * + * @param HTTP_Request2_Response $response response to check + * + * @return boolean whether another request should be performed + * @throws HTTP_Request2_Exception in case of unsupported challenge parameters + */ + protected function shouldUseServerDigestAuth(HTTP_Request2_Response $response) + { + // no sense repeating a request if we don't have credentials + if (401 != $response->getStatus() || !$this->request->getAuth()) { + return false; + } + if (!$challenge = $this->parseDigestChallenge((string)$response->getHeader('www-authenticate'))) { + return false; + } + + $url = $this->request->getUrl(); + $scheme = (string)$url->getScheme(); + $host = $scheme . '://' . $url->getHost(); + if ($port = $url->getPort()) { + if ((0 === strcasecmp($scheme, 'http') && 80 != $port) + || (0 === strcasecmp($scheme, 'https') && 443 != $port) + ) { + $host .= ':' . $port; + } + } + + if (!empty($challenge'domain')) { + $prefixes = ; + foreach (preg_split('/\\s+/', $challenge'domain') as $prefix) { + // don't bother with different servers + if ('/' == substr($prefix, 0, 1)) { + $prefixes = $host . $prefix; + } + } + } + if (empty($prefixes)) { + $prefixes = $host . '/'; + } + + $ret = true; + foreach ($prefixes as $prefix) { + if (!empty(self::$challenges$prefix) + && (empty($challenge'stale') || strcasecmp('true', $challenge'stale')) + ) { + // probably credentials are invalid + $ret = false; + } + self::$challenges$prefix =& $challenge; + } + return $ret; + } + + /** + * Checks whether another request should be performed with proxy digest auth + * + * Several conditions should be satisfied for it to return true: + * - response status should be 407 + * - proxy auth credentials should be set in the request object + * - response should contain Proxy-Authenticate header with digest challenge + * - there is either no challenge stored for this proxy or new challenge + * contains stale=true parameter (in other case we probably just failed + * due to invalid username / password) + * + * The method stores challenge values in $challenges static property + * + * @param HTTP_Request2_Response $response response to check + * + * @return boolean whether another request should be performed + * @throws HTTP_Request2_Exception in case of unsupported challenge parameters + */ + protected function shouldUseProxyDigestAuth(HTTP_Request2_Response $response) + { + if (407 != $response->getStatus() || !$this->request->getConfig('proxy_user')) { + return false; + } + if (!($challenge = $this->parseDigestChallenge((string)$response->getHeader('proxy-authenticate')))) { + return false; + } + + $key = 'proxy://' . $this->request->getConfig('proxy_host') . + ':' . $this->request->getConfig('proxy_port'); + + if (!empty(self::$challenges$key) + && (empty($challenge'stale') || strcasecmp('true', $challenge'stale')) + ) { + $ret = false; + } else { + $ret = true; + } + self::$challenges$key = $challenge; + return $ret; + } + + /** + * Extracts digest method challenge from (WWW|Proxy)-Authenticate header value + * + * There is a problem with implementation of RFC 2617: several of the parameters + * are defined as quoted-string there and thus may contain backslash escaped + * double quotes (RFC 2616, section 2.2). However, RFC 2617 defines unq(X) as + * just value of quoted-string X without surrounding quotes, it doesn't speak + * about removing backslash escaping. + * + * Now realm parameter is user-defined and human-readable, strange things + * happen when it contains quotes: + * - Apache allows quotes in realm, but apparently uses realm value without + * backslashes for digest computation + * - Squid allows (manually escaped) quotes there, but it is impossible to + * authorize with either escaped or unescaped quotes used in digest, + * probably it can't parse the response (?) + * - Both IE and Firefox display realm value with backslashes in + * the password popup and apparently use the same value for digest + * + * HTTP_Request2 follows IE and Firefox (and hopefully RFC 2617) in + * quoted-string handling, unfortunately that means failure to authorize + * sometimes + * + * @param string $headerValue value of WWW-Authenticate or Proxy-Authenticate header + * + * @return mixed associative array with challenge parameters, false if + * no challenge is present in header value + * @throws HTTP_Request2_NotImplementedException in case of unsupported challenge parameters + */ + protected function parseDigestChallenge($headerValue) + { + $authParam = '(' . self::REGEXP_TOKEN . ')\\s*=\\s*(' . + self::REGEXP_TOKEN . '|' . self::REGEXP_QUOTED_STRING . ')'; + $challenge = "!(?<=^|\\s|,)Digest ({$authParam}\\s*(,\\s*|$))+!"; + if (!preg_match($challenge, $headerValue, $matches)) { + return false; + } + + preg_match_all('!' . $authParam . '!', $matches0, $params); + $paramsAry = ; + $knownParams = 'realm', 'domain', 'nonce', 'opaque', 'stale', + 'algorithm', 'qop'; + for ($i = 0; $i < count($params0); $i++) { + // section 3.2.1: Any unrecognized directive MUST be ignored. + if (in_array($params1$i, $knownParams)) { + if ('"' == substr($params2$i, 0, 1)) { + $paramsAry$params1$i = substr($params2$i, 1, -1); + } else { + $paramsAry$params1$i = $params2$i; + } + } + } + // we only support qop=auth + if (!empty($paramsAry'qop') + && !in_array('auth', array_map('trim', explode(',', $paramsAry'qop'))) + ) { + throw new HTTP_Request2_NotImplementedException( + "Only 'auth' qop is currently supported in digest authentication, " . + "server requested '{$paramsAry'qop'}'" + ); + } + // we only support algorithm=MD5 + if (!empty($paramsAry'algorithm') && 'MD5' != $paramsAry'algorithm') { + throw new HTTP_Request2_NotImplementedException( + "Only 'MD5' algorithm is currently supported in digest authentication, " . + "server requested '{$paramsAry'algorithm'}'" + ); + } + + return $paramsAry; + } + + /** + * Parses Proxy-Authentication-Info header value and updates challenge + * + * @param array $challenge challenge to update + * @param string $headerValue value of Proxy-Authentication-Info header + * + * @return void + * + * @todo validate server rspauth response + */ + protected function updateChallenge(&$challenge, $headerValue) + { + $authParam = '!(' . self::REGEXP_TOKEN . ')\\s*=\\s*(' . + self::REGEXP_TOKEN . '|' . self::REGEXP_QUOTED_STRING . ')!'; + $paramsAry = ; + + preg_match_all($authParam, $headerValue, $params); + for ($i = 0; $i < count($params0); $i++) { + if ('"' == substr($params2$i, 0, 1)) { + $paramsAry$params1$i = substr($params2$i, 1, -1); + } else { + $paramsAry$params1$i = $params2$i; + } + } + // for now, just update the nonce value + if (!empty($paramsAry'nextnonce')) { + $challenge'nonce' = $paramsAry'nextnonce'; + $challenge'nc' = 1; + } + } + + /** + * Creates a value for Proxy-Authorization header when using digest authentication + * + * @param string $user user name + * @param string $password password + * @param string $url request URL + * @param array $challenge digest challenge parameters + * + * @return string value of Proxy-Authorization request header + * @link http://tools.ietf.org/html/rfc2617#section-3.2.2 + */ + protected function createDigestResponse($user, $password, $url, &$challenge) + { + if (false !== ($q = strpos($url, '?')) + && $this->request->getConfig('digest_compat_ie') + ) { + $url = substr($url, 0, $q); + } + + $a1 = md5($user . ':' . $challenge'realm' . ':' . $password); + $a2 = md5($this->request->getMethod() . ':' . $url); + $nc = ''; + + if (empty($challenge'qop')) { + $digest = md5($a1 . ':' . $challenge'nonce' . ':' . $a2); + } else { + $challenge'cnonce' = 'Req2.' . rand(); + if (empty($challenge'nc')) { + $challenge'nc' = 1; + } + $nc = sprintf('%08x', $challenge'nc'++); + $digest = md5( + $a1 . ':' . $challenge'nonce' . ':' . $nc . ':' . + $challenge'cnonce' . ':auth:' . $a2 + ); + } + return 'Digest username="' . str_replace('\\', '"', '\\\\', '\\"', $user) . '", ' . + 'realm="' . $challenge'realm' . '", ' . + 'nonce="' . $challenge'nonce' . '", ' . + 'uri="' . $url . '", ' . + 'response="' . $digest . '"' . + (!empty($challenge'opaque')? + ', opaque="' . $challenge'opaque' . '"': + '') . + (!empty($challenge'qop')? + ', qop="auth", nc=' . $nc . ', cnonce="' . $challenge'cnonce' . '"': + ''); + } + + /** + * Adds 'Authorization' header (if needed) to request headers array + * + * @param array $headers request headers + * @param string $requestHost request host (needed for digest authentication) + * @param string $requestUrl request URL (needed for digest authentication) + * + * @return void + * @throws HTTP_Request2_NotImplementedException + */ + protected function addAuthorizationHeader(&$headers, $requestHost, $requestUrl) + { + if (!($auth = $this->request->getAuth())) { + return; + } + switch ($auth'scheme') { + case HTTP_Request2::AUTH_BASIC: + $headers'authorization' = 'Basic ' . base64_encode( + $auth'user' . ':' . $auth'password' + ); + break; + + case HTTP_Request2::AUTH_DIGEST: + unset($this->serverChallenge); + $fullUrl = ('/' == $requestUrl0)? + $this->request->getUrl()->getScheme() . '://' . + $requestHost . $requestUrl: + $requestUrl; + foreach (array_keys(self::$challenges) as $key) { + if ($key == substr($fullUrl, 0, strlen($key))) { + $headers'authorization' = $this->createDigestResponse( + $auth'user', $auth'password', + $requestUrl, self::$challenges$key + ); + $this->serverChallenge =& self::$challenges$key; + break; + } + } + break; + + default: + throw new HTTP_Request2_NotImplementedException( + "Unknown HTTP authentication scheme '{$auth'scheme'}'" + ); + } + } + + /** + * Adds 'Proxy-Authorization' header (if needed) to request headers array + * + * @param array $headers request headers + * @param string $requestUrl request URL (needed for digest authentication) + * + * @return void + * @throws HTTP_Request2_NotImplementedException + */ + protected function addProxyAuthorizationHeader(&$headers, $requestUrl) + { + if (!$this->request->getConfig('proxy_host') + || '' === ($user = (string)$this->request->getConfig('proxy_user')) + || (0 === strcasecmp('https', (string)$this->request->getUrl()->getScheme()) + && HTTP_Request2::METHOD_CONNECT !== $this->request->getMethod()) + ) { + return; + } + + $password = $this->request->getConfig('proxy_password'); + switch ($this->request->getConfig('proxy_auth_scheme')) { + case HTTP_Request2::AUTH_BASIC: + $headers'proxy-authorization' = 'Basic ' . base64_encode( + $user . ':' . $password + ); + break; + + case HTTP_Request2::AUTH_DIGEST: + unset($this->proxyChallenge); + $proxyUrl = 'proxy://' . $this->request->getConfig('proxy_host') . + ':' . $this->request->getConfig('proxy_port'); + if (!empty(self::$challenges$proxyUrl)) { + $headers'proxy-authorization' = $this->createDigestResponse( + $user, $password, + $requestUrl, self::$challenges$proxyUrl + ); + $this->proxyChallenge =& self::$challenges$proxyUrl; + } + break; + + default: + throw new HTTP_Request2_NotImplementedException( + "Unknown HTTP authentication scheme '" . + $this->request->getConfig('proxy_auth_scheme') . "'" + ); + } + } + + + /** + * Creates the string with the Request-Line and request headers + * + * @return string + * @throws HTTP_Request2_Exception + */ + protected function prepareHeaders() + { + $headers = $this->request->getHeaders(); + $url = $this->request->getUrl(); + $connect = HTTP_Request2::METHOD_CONNECT == $this->request->getMethod(); + $host = (string)$url->getHost(); + + $defaultPort = 0 === strcasecmp((string)$url->getScheme(), 'https')? 443: 80; + if (($port = $url->getPort()) && $port != $defaultPort || $connect) { + $host .= ':' . (empty($port)? $defaultPort: $port); + } + // Do not overwrite explicitly set 'Host' header, see bug #16146 + if (!isset($headers'host')) { + $headers'host' = $host; + } + + if ($connect) { + $requestUrl = $host; + + } else { + if (!$this->request->getConfig('proxy_host') + || 'http' != $this->request->getConfig('proxy_type') + || 0 === strcasecmp((string)$url->getScheme(), 'https') + ) { + $requestUrl = ''; + } else { + $requestUrl = $url->getScheme() . '://' . $host; + } + $path = $url->getPath(); + $query = $url->getQuery(); + $requestUrl .= (empty($path)? '/': $path) . (empty($query)? '': '?' . $query); + } + + if ('1.1' == $this->request->getConfig('protocol_version') + && extension_loaded('zlib') && !isset($headers'accept-encoding') + ) { + $headers'accept-encoding' = 'gzip, deflate'; + } + if (($jar = $this->request->getCookieJar()) + && ($cookies = $jar->getMatching($this->request->getUrl(), true)) + ) { + $headers'cookie' = (empty($headers'cookie')? '': $headers'cookie' . '; ') . $cookies; + } + + $this->addAuthorizationHeader($headers, $host, $requestUrl); + $this->addProxyAuthorizationHeader($headers, $requestUrl); + $this->calculateRequestLength($headers); + if ('1.1' == $this->request->getConfig('protocol_version')) { + $this->updateExpectHeader($headers); + } else { + $this->expect100Continue = false; + } + + $headersStr = $this->request->getMethod() . ' ' . $requestUrl . ' HTTP/' . + $this->request->getConfig('protocol_version') . "\r\n"; + foreach ($headers as $name => $value) { + $canonicalName = implode('-', array_map('ucfirst', explode('-', $name))); + $headersStr .= $canonicalName . ': ' . $value . "\r\n"; + } + return $headersStr . "\r\n"; + } + + /** + * Adds or removes 'Expect: 100-continue' header from request headers + * + * Also sets the $expect100Continue property. Parsing of existing header + * is somewhat needed due to its complex structure and due to the + * requirement in section 8.2.3 of RFC 2616: + * > A client MUST NOT send an Expect request-header field (section + * > 14.20) with the "100-continue" expectation if it does not intend + * > to send a request body. + * + * @param array $headers Array of headers prepared for the request + * + * @return void + * @throws HTTP_Request2_LogicException + * + * @link http://pear.php.net/bugs/bug.php?id=19233 + * @link http://tools.ietf.org/html/rfc2616#section-8.2.3 + */ + protected function updateExpectHeader(&$headers) + { + $this->expect100Continue = false; + $expectations = ; + if (isset($headers'expect')) { + if ('' === $headers'expect') { + // empty 'Expect' header is technically invalid, so just get rid of it + unset($headers'expect'); + return; + } + // build regexp to parse the value of existing Expect header + $expectParam = ';\s*' . self::REGEXP_TOKEN . '(?:\s*=\s*(?:' + . self::REGEXP_TOKEN . '|' + . self::REGEXP_QUOTED_STRING . '))?\s*'; + $expectExtension = self::REGEXP_TOKEN . '(?:\s*=\s*(?:' + . self::REGEXP_TOKEN . '|' + . self::REGEXP_QUOTED_STRING . ')\s*(?:' + . $expectParam . ')*)?'; + $expectItem = '!(100-continue|' . $expectExtension . ')!A'; + + $pos = 0; + $length = strlen($headers'expect'); + + while ($pos < $length) { + $pos += strspn($headers'expect', " \t", $pos); + if (',' === substr($headers'expect', $pos, 1)) { + $pos++; + continue; + + } elseif (!preg_match($expectItem, $headers'expect', $m, 0, $pos)) { + throw new HTTP_Request2_LogicException( + "Cannot parse value '{$headers'expect'}' of Expect header", + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + + } else { + $pos += strlen($m0); + if (strcasecmp('100-continue', $m0)) { + $expectations = $m0; + } + } + } + } + + if (1024 < $this->contentLength) { + $expectations = '100-continue'; + $this->expect100Continue = true; + } + + if (empty($expectations)) { + unset($headers'expect'); + } else { + $headers'expect' = implode(',', $expectations); + } + } + + /** + * Sends the request body + * + * @return void + * @throws HTTP_Request2_MessageException + */ + protected function writeBody() + { + if (in_array($this->request->getMethod(), self::$bodyDisallowed) + || 0 == $this->contentLength + ) { + return; + } + + $position = 0; + $bufferSize = $this->request->getConfig('buffer_size'); + $headers = $this->request->getHeaders(); + $chunked = isset($headers'transfer-encoding'); + while ($position < $this->contentLength) { + if (is_string($this->requestBody)) { + $str = substr($this->requestBody, $position, $bufferSize); + } elseif (is_resource($this->requestBody)) { + $str = fread($this->requestBody, $bufferSize); + } else { + $str = $this->requestBody->read($bufferSize); + } + if (!$chunked) { + $this->socket->write($str); + } else { + $this->socket->write(dechex(strlen($str)) . "\r\n{$str}\r\n"); + } + // Provide the length of written string to the observer, request #7630 + $this->request->setLastEvent('sentBodyPart', strlen($str)); + $position += strlen($str); + } + + // write zero-length chunk + if ($chunked) { + $this->socket->write("0\r\n\r\n"); + } + $this->request->setLastEvent('sentBody', $this->contentLength); + } + + /** + * Reads the remote server's response + * + * @return HTTP_Request2_Response|null + * @throws HTTP_Request2_Exception + */ + protected function readResponse() + { + $bufferSize = (int)$this->request->getConfig('buffer_size'); + // http://tools.ietf.org/html/rfc2616#section-8.2.3 + // ...the client SHOULD NOT wait for an indefinite period before sending the request body + $timeout = $this->expect100Continue ? 1 : null; + + do { + try { + $response = new HTTP_Request2_Response( + $this->socket->readLine($bufferSize, $timeout), + true, + $this->request->getUrl()->__toString() + ); + do { + $headerLine = $this->socket->readLine($bufferSize); + $response->parseHeaderLine($headerLine); + } while ('' != $headerLine); + + } catch (HTTP_Request2_MessageException $e) { + if (HTTP_Request2_Exception::TIMEOUT === $e->getCode() + && $this->expect100Continue + ) { + return null; + } + throw $e; + } + if ($this->expect100Continue && 100 == $response->getStatus()) { + return $response; + } + } while (in_array($response->getStatus(), 100, 101)); + + $this->request->setLastEvent('receivedHeaders', $response); + + // No body possible in such responses + if (HTTP_Request2::METHOD_HEAD == $this->request->getMethod() + || (HTTP_Request2::METHOD_CONNECT == $this->request->getMethod() + && 200 <= $response->getStatus() && 300 > $response->getStatus()) + || in_array($response->getStatus(), 204, 304) + ) { + return $response; + } + + $chunked = 'chunked' == $response->getHeader('transfer-encoding'); + $length = $response->getHeader('content-length'); + $hasBody = false; + // RFC 2616, section 4.4: + // 3. ... If a message is received with both a + // Transfer-Encoding header field and a Content-Length header field, + // the latter MUST be ignored. + $toRead = ($chunked || null === $length)? null: (int)$length; + $this->chunkLength = 0; + + if ($chunked || null === $length || 0 < intval($length)) { + while (!$this->socket->eof() && (is_null($toRead) || 0 < $toRead)) { + if ($chunked) { + $data = $this->readChunked($bufferSize); + } elseif (is_null($toRead)) { + $data = $this->socket->read($bufferSize); + } elseif (false !== ($data = $this->socket->read(min($toRead, $bufferSize)))) { + $toRead -= strlen($data); + } + if ('' === (string)$data && (!$this->chunkLength || $this->socket->eof())) { + break; + } + + $hasBody = true; + if ($this->request->getConfig('store_body')) { + $response->appendBody((string)$data); + } + if (!in_array($response->getHeader('content-encoding'), 'identity', null)) { + $this->request->setLastEvent('receivedEncodedBodyPart', $data); + } else { + $this->request->setLastEvent('receivedBodyPart', $data); + } + } + } + if (0 !== $this->chunkLength || null !== $toRead && $toRead > 0) { + $this->request->setLastEvent( + 'warning', 'transfer closed with outstanding read data remaining' + ); + } + + if ($hasBody) { + $this->request->setLastEvent('receivedBody', $response); + } + return $response; + } + + /** + * Reads a part of response body encoded with chunked Transfer-Encoding + * + * @param int $bufferSize buffer size to use for reading + * + * @return string + * @throws HTTP_Request2_MessageException + */ + protected function readChunked($bufferSize) + { + // at start of the next chunk? + if (0 == $this->chunkLength) { + $line = $this->socket->readLine($bufferSize); + if ('' === $line && $this->socket->eof()) { + $this->chunkLength = -1; // indicate missing chunk + return ''; + + } elseif (!preg_match('/^(0-9a-f+)/i', $line, $matches)) { + throw new HTTP_Request2_MessageException( + "Cannot decode chunked response, invalid chunk length '{$line}'", + HTTP_Request2_Exception::DECODE_ERROR + ); + + } else { + $this->chunkLength = hexdec($matches1); + // Chunk with zero length indicates the end + if (0 == $this->chunkLength) { + $this->socket->readLine($bufferSize); + return ''; + } + } + } + if (false === ($data = $this->socket->read(min($this->chunkLength, $bufferSize)))) { + // Stop in case of read error + $this->chunkLength = -1; + return ''; + } + $this->chunkLength -= strlen($data); + if (0 == $this->chunkLength) { + $this->socket->readLine($bufferSize); // Trailing CRLF + } + return $data; + } +} + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/ConnectionException.php
Added
@@ -0,0 +1,38 @@ +<?php +/** + * Exception classes for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Exception thrown when connection to a web or proxy server fails + * + * The exception will not contain a package error code, but will contain + * native error code, as returned by stream_socket_client() or curl_errno(). + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_ConnectionException extends HTTP_Request2_Exception +{ +} + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/CookieJar.php
Added
@@ -0,0 +1,581 @@ +<?php +/** + * Stores cookies and passes them between HTTP requests + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Class representing a HTTP request message */ +require_once 'HTTP/Request2.php'; + +/** + * Stores cookies and passes them between HTTP requests + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: @package_version@ + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_CookieJar implements Serializable +{ + /** + * Array of stored cookies + * + * The array is indexed by domain, path and cookie name + * .example.com + * / + * some_cookie => cookie data + * /subdir + * other_cookie => cookie data + * .example.org + * ... + * + * @var array + */ + protected $cookies = ; + + /** + * Whether session cookies should be serialized when serializing the jar + * + * @var bool + */ + protected $serializeSession = false; + + /** + * Whether Public Suffix List should be used for domain matching + * + * @var bool + */ + protected $useList = true; + + /** + * Whether an attempt to store an invalid cookie should be ignored, rather than cause an Exception + * + * @var bool + */ + protected $ignoreInvalid = false; + + /** + * Array with Public Suffix List data + * + * @var array + * @link http://publicsuffix.org/ + */ + protected static $psl = ; + + /** + * Class constructor, sets various options + * + * @param bool $serializeSessionCookies Controls serializing session cookies, + * see {@link serializeSessionCookies()} + * @param bool $usePublicSuffixList Controls using Public Suffix List, + * see {@link usePublicSuffixList()} + * @param bool $ignoreInvalidCookies Whether invalid cookies should be ignored, + * see {@link ignoreInvalidCookies()} + */ + public function __construct( + $serializeSessionCookies = false, $usePublicSuffixList = true, + $ignoreInvalidCookies = false + ) { + $this->serializeSessionCookies($serializeSessionCookies); + $this->usePublicSuffixList($usePublicSuffixList); + $this->ignoreInvalidCookies($ignoreInvalidCookies); + } + + /** + * Returns current time formatted in ISO-8601 at UTC timezone + * + * @return string + */ + protected function now() + { + $dt = new DateTime(); + $dt->setTimezone(new DateTimeZone('UTC')); + return $dt->format(DateTime::ISO8601); + } + + /** + * Checks cookie array for correctness, possibly updating its 'domain', 'path' and 'expires' fields + * + * The checks are as follows: + * - cookie array should contain 'name' and 'value' fields; + * - name and value should not contain disallowed symbols; + * - 'expires' should be either empty parseable by DateTime; + * - 'domain' and 'path' should be either not empty or an URL where + * cookie was set should be provided. + * - if $setter is provided, then document at that URL should be allowed + * to set a cookie for that 'domain'. If $setter is not provided, + * then no domain checks will be made. + * + * 'expires' field will be converted to ISO8601 format from COOKIE format, + * 'domain' and 'path' will be set from setter URL if empty. + * + * @param array $cookie cookie data, as returned by + * {@link HTTP_Request2_Response::getCookies()} + * @param Net_URL2 $setter URL of the document that sent Set-Cookie header + * + * @return array Updated cookie array + * @throws HTTP_Request2_LogicException + * @throws HTTP_Request2_MessageException + */ + protected function checkAndUpdateFields(array $cookie, Net_URL2 $setter = null) + { + if ($missing = array_diff('name', 'value', array_keys($cookie))) { + throw new HTTP_Request2_LogicException( + "Cookie array should contain 'name' and 'value' fields", + HTTP_Request2_Exception::MISSING_VALUE + ); + } + if (preg_match(HTTP_Request2::REGEXP_INVALID_COOKIE, $cookie'name')) { + throw new HTTP_Request2_LogicException( + "Invalid cookie name: '{$cookie'name'}'", + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + if (preg_match(HTTP_Request2::REGEXP_INVALID_COOKIE, $cookie'value')) { + throw new HTTP_Request2_LogicException( + "Invalid cookie value: '{$cookie'value'}'", + HTTP_Request2_Exception::INVALID_ARGUMENT + ); + } + $cookie += 'domain' => '', 'path' => '', 'expires' => null, 'secure' => false; + + // Need ISO-8601 date @ UTC timezone + if (!empty($cookie'expires') + && !preg_match('/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\+0000$/', $cookie'expires') + ) { + try { + $dt = new DateTime($cookie'expires'); + $dt->setTimezone(new DateTimeZone('UTC')); + $cookie'expires' = $dt->format(DateTime::ISO8601); + } catch (Exception $e) { + throw new HTTP_Request2_LogicException($e->getMessage()); + } + } + + if (empty($cookie'domain') || empty($cookie'path')) { + if (!$setter) { + throw new HTTP_Request2_LogicException( + 'Cookie misses domain and/or path component, cookie setter URL needed', + HTTP_Request2_Exception::MISSING_VALUE + ); + } + if (empty($cookie'domain')) { + if ($host = $setter->getHost()) { + $cookie'domain' = (string)$host; + } else { + throw new HTTP_Request2_LogicException( + 'Setter URL does not contain host part, can\'t set cookie domain', + HTTP_Request2_Exception::MISSING_VALUE + ); + } + } + if (empty($cookie'path')) { + $path = $setter->getPath(); + $cookie'path' = empty($path) + ? '/' + : substr($path, 0, (int)strrpos($path, '/') + 1); + } + } + + if ($setter && !$this->domainMatch((string)$setter->getHost(), $cookie'domain')) { + throw new HTTP_Request2_MessageException( + "Domain " . $setter->getHost() . " cannot set cookies for " + . $cookie'domain' + ); + } + + return $cookie; + } + + /** + * Stores a cookie in the jar + * + * @param array $cookie cookie data, as returned by + * {@link HTTP_Request2_Response::getCookies()} + * @param Net_URL2 $setter URL of the document that sent Set-Cookie header + * + * @return bool whether the cookie was successfully stored + * @throws HTTP_Request2_Exception + */ + public function store(array $cookie, Net_URL2 $setter = null) + { + try { + $cookie = $this->checkAndUpdateFields($cookie, $setter); + } catch (HTTP_Request2_Exception $e) { + if ($this->ignoreInvalid) { + return false; + } else { + throw $e; + } + } + + if (strlen($cookie'value') + && (is_null($cookie'expires') || $cookie'expires' > $this->now()) + ) { + if (!isset($this->cookies$cookie'domain')) { + $this->cookies$cookie'domain' = ; + } + if (!isset($this->cookies$cookie'domain'$cookie'path')) { + $this->cookies$cookie'domain'$cookie'path' = ; + } + $this->cookies$cookie'domain'$cookie'path'$cookie'name' = $cookie; + + } elseif (isset($this->cookies$cookie'domain'$cookie'path'$cookie'name')) { + unset($this->cookies$cookie'domain'$cookie'path'$cookie'name'); + } + + return true; + } + + /** + * Adds cookies set in HTTP response to the jar + * + * @param HTTP_Request2_Response $response HTTP response message + * @param Net_URL2 $setter original request URL, needed for + * setting default domain/path. If not given, + * effective URL from response will be used. + * + * @return bool whether all cookies were successfully stored + * @throws HTTP_Request2_LogicException + */ + public function addCookiesFromResponse(HTTP_Request2_Response $response, Net_URL2 $setter = null) + { + if (null === $setter) { + if (!($effectiveUrl = $response->getEffectiveUrl())) { + throw new HTTP_Request2_LogicException( + 'Response URL required for adding cookies from response', + HTTP_Request2_Exception::MISSING_VALUE + ); + } + $setter = new Net_URL2($effectiveUrl); + } + + $success = true; + foreach ($response->getCookies() as $cookie) { + $success = $this->store($cookie, $setter) && $success; + } + return $success; + } + + /** + * Returns all cookies matching a given request URL + * + * The following checks are made: + * - cookie domain should match request host + * - cookie path should be a prefix for request path + * - 'secure' cookies will only be sent for HTTPS requests + * + * @param Net_URL2 $url Request url + * @param bool $asString Whether to return cookies as string for "Cookie: " header + * + * @return array|string Matching cookies + * @psalm-return ($asString is true ? string : array) + */ + public function getMatching(Net_URL2 $url, $asString = false) + { + $host = (string)$url->getHost(); + $path = $url->getPath(); + $secure = 0 === strcasecmp((string)$url->getScheme(), 'https'); + + $matched = $ret = ; + foreach (array_keys($this->cookies) as $domain) { + if ($this->domainMatch($host, $domain)) { + foreach (array_keys($this->cookies$domain) as $cPath) { + if (0 === strpos($path, $cPath)) { + foreach ($this->cookies$domain$cPath as $name => $cookie) { + if (!$cookie'secure' || $secure) { + $matched$namestrlen($cookie'path') = $cookie; + } + } + } + } + } + } + foreach ($matched as $cookies) { + krsort($cookies); + $ret = array_merge($ret, $cookies); + } + if (!$asString) { + return $ret; + } else { + $str = ''; + foreach ($ret as $c) { + $str .= (empty($str)? '': '; ') . $c'name' . '=' . $c'value'; + } + return $str; + } + } + + /** + * Returns all cookies stored in a jar + * + * @return array + */ + public function getAll() + { + $cookies = ; + foreach (array_keys($this->cookies) as $domain) { + foreach (array_keys($this->cookies$domain) as $path) { + foreach ($this->cookies$domain$path as $name => $cookie) { + $cookies = $cookie; + } + } + } + return $cookies; + } + + /** + * Sets whether session cookies should be serialized when serializing the jar + * + * @param boolean $serialize serialize? + * + * @return void + */ + public function serializeSessionCookies($serialize) + { + $this->serializeSession = (bool)$serialize; + } + + /** + * Sets whether invalid cookies should be silently ignored or cause an Exception + * + * @param boolean $ignore ignore? + * + * @return void + * + * @link http://pear.php.net/bugs/bug.php?id=19937 + * @link http://pear.php.net/bugs/bug.php?id=20401 + */ + public function ignoreInvalidCookies($ignore) + { + $this->ignoreInvalid = (bool)$ignore; + } + + /** + * Sets whether Public Suffix List should be used for restricting cookie-setting + * + * Without PSL {@link domainMatch()} will only prevent setting cookies for + * top-level domains like '.com' or '.org'. However, it will not prevent + * setting a cookie for '.co.uk' even though only third-level registrations + * are possible in .uk domain. + * + * With the List it is possible to find the highest level at which a domain + * may be registered for a particular top-level domain and consequently + * prevent cookies set for '.co.uk' or '.msk.ru'. The same list is used by + * Firefox, Chrome and Opera browsers to restrict cookie setting. + * + * Note that PSL is licensed differently to HTTP_Request2 package (refer to + * the license information in public-suffix-list.php), so you can disable + * its use if this is an issue for you. + * + * @param boolean $useList use the list? + * + * @return void + * + * @link http://publicsuffix.org/learn/ + */ + public function usePublicSuffixList($useList) + { + $this->useList = (bool)$useList; + } + + /** + * Returns string representation of object + * + * @return string + * + * @see Serializable::serialize() + */ + public function serialize() + { + return serialize($this->__serialize()); + } + + /** + * Returns an associative array of key/value pairs that represent the serialized form of the object + * + * @return array + */ + public function __serialize() + { + $cookies = $this->getAll(); + if (!$this->serializeSession) { + for ($i = count($cookies) - 1; $i >= 0; $i--) { + if (empty($cookies$i'expires')) { + unset($cookies$i); + } + } + } + return + 'cookies' => $cookies, + 'serializeSession' => $this->serializeSession, + 'useList' => $this->useList, + 'ignoreInvalid' => $this->ignoreInvalid + ; + } + + /** + * Constructs the object from serialized string + * + * @param string $serialized string representation + * + * @return void + */ + public function unserialize($serialized) + { + $this->__unserialize(unserialize($serialized)); + } + + /** + * Constructs the object from array serialized form + * + * @param array $data serialized form (as generated by {@see __serialize()} + * + * @return void + */ + public function __unserialize(array $data) + { + $now = $this->now(); + $this->serializeSessionCookies($data'serializeSession'); + $this->usePublicSuffixList($data'useList'); + if (array_key_exists('ignoreInvalid', $data)) { + $this->ignoreInvalidCookies($data'ignoreInvalid'); + } + foreach ($data'cookies' as $cookie) { + if (!empty($cookie'expires') && $cookie'expires' <= $now) { + continue; + } + if (!isset($this->cookies$cookie'domain')) { + $this->cookies$cookie'domain' = ; + } + if (!isset($this->cookies$cookie'domain'$cookie'path')) { + $this->cookies$cookie'domain'$cookie'path' = ; + } + $this->cookies$cookie'domain'$cookie'path'$cookie'name' = $cookie; + } + } + + /** + * Checks whether a cookie domain matches a request host. + * + * The method is used by {@link store()} to check for whether a document + * at given URL can set a cookie with a given domain attribute and by + * {@link getMatching()} to find cookies matching the request URL. + * + * @param string $requestHost request host + * @param string $cookieDomain cookie domain + * + * @return bool match success + */ + public function domainMatch($requestHost, $cookieDomain) + { + if ($requestHost == $cookieDomain) { + return true; + } + // IP address, we require exact match + if (preg_match('/^(?:\d{1,3}\.){3}\d{1,3}$/', $requestHost)) { + return false; + } + if ('.' != $cookieDomain0) { + $cookieDomain = '.' . $cookieDomain; + } + // prevents setting cookies for '.com' and similar domains + if (!$this->useList && substr_count($cookieDomain, '.') < 2 + || $this->useList && !self::getRegisteredDomain($cookieDomain) + ) { + return false; + } + return substr('.' . $requestHost, -strlen($cookieDomain)) == $cookieDomain; + } + + /** + * Removes subdomains to get the registered domain (the first after top-level) + * + * The method will check Public Suffix List to find out where top-level + * domain ends and registered domain starts. It will remove domain parts + * to the left of registered one. + * + * @param string $domain domain name + * + * @return string|bool registered domain, will return false if $domain is + * either invalid or a TLD itself + */ + public static function getRegisteredDomain($domain) + { + $domainParts = explode('.', ltrim($domain, '.')); + + // load the list if needed + if (empty(self::$psl)) { + $path = '@data_dir@' . DIRECTORY_SEPARATOR . 'HTTP_Request2'; + if (0 === strpos($path, '@' . 'data_dir@')) { + $path = realpath( + __DIR__ . DIRECTORY_SEPARATOR . '..' + . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data' + ); + } + self::$psl = include_once $path . DIRECTORY_SEPARATOR . 'public-suffix-list.php'; + } + + if (!($result = self::checkDomainsList($domainParts, self::$psl))) { + // known TLD, invalid domain name + return false; + } + + // unknown TLD + if (!strpos($result, '.')) { + // fallback to checking that domain "has at least two dots" + if (2 > ($count = count($domainParts))) { + return false; + } + return $domainParts$count - 2 . '.' . $domainParts$count - 1; + } + return $result; + } + + /** + * Recursive helper method for {@link getRegisteredDomain()} + * + * @param array $domainParts remaining domain parts + * @param mixed $listNode node in {@link HTTP_Request2_CookieJar::$psl} to check + * + * @return string|null concatenated domain parts, null in case of error + */ + protected static function checkDomainsList(array $domainParts, $listNode) + { + $sub = array_pop($domainParts); + + if (!is_array($listNode) || is_null($sub) + || array_key_exists('!' . $sub, $listNode) + ) { + return $sub; + + } elseif (array_key_exists($sub, $listNode)) { + $result = self::checkDomainsList($domainParts, $listNode$sub); + + } elseif (array_key_exists('*', $listNode)) { + $result = self::checkDomainsList($domainParts, $listNode'*'); + + } else { + return $sub; + } + + return (strlen($result ?: '') > 0) ? ($result . '.' . $sub) : null; + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/Exception.php
Added
@@ -0,0 +1,118 @@ +<?php +/** + * Exception classes for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Base class for exceptions in PEAR + */ +require_once 'PEAR/Exception.php'; + +/** + * Base exception class for HTTP_Request2 package + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=132 + */ +class HTTP_Request2_Exception extends PEAR_Exception +{ + /** + * An invalid argument was passed to a method + */ + const INVALID_ARGUMENT = 1; + /** + * Some required value was not available + */ + const MISSING_VALUE = 2; + /** + * Request cannot be processed due to errors in PHP configuration + */ + const MISCONFIGURATION = 3; + /** + * Error reading the local file + */ + const READ_ERROR = 4; + + /** + * Server returned a response that does not conform to HTTP protocol + */ + const MALFORMED_RESPONSE = 10; + /** + * Failure decoding Content-Encoding or Transfer-Encoding of response + */ + const DECODE_ERROR = 20; + /** + * Operation timed out + */ + const TIMEOUT = 30; + /** + * Number of redirects exceeded 'max_redirects' configuration parameter + */ + const TOO_MANY_REDIRECTS = 40; + /** + * Redirect to a protocol other than http(s):// + */ + const NON_HTTP_REDIRECT = 50; + + /** + * Native error code + * + * @var int|null + */ + private $_nativeCode; + + /** + * Constructor, can set package error code and native error code + * + * @param string $message exception message + * @param int $code package error code, one of class constants + * @param int $nativeCode error code from underlying PHP extension + */ + public function __construct($message = '', $code = null, $nativeCode = null) + { + parent::__construct($message, $code); + $this->_nativeCode = $nativeCode; + } + + /** + * Returns error code produced by underlying PHP extension + * + * For Socket Adapter this may contain error number returned by + * stream_socket_client(), for Curl Adapter this will contain error number + * returned by curl_errno() + * + * @return int|null + */ + public function getNativeCode() + { + return $this->_nativeCode; + } +} + +// backwards compatibility, include the child exceptions if installed with PEAR installer +require_once 'HTTP/Request2/ConnectionException.php'; +require_once 'HTTP/Request2/LogicException.php'; +require_once 'HTTP/Request2/MessageException.php'; +require_once 'HTTP/Request2/NotImplementedException.php'; + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/LogicException.php
Added
@@ -0,0 +1,42 @@ +<?php +/** + * Exception classes for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Exception that represents error in the program logic + * + * This exception usually implies a programmer's error, like passing invalid + * data to methods or trying to use PHP extensions that weren't installed or + * enabled. Usually exceptions of this kind will be thrown before request even + * starts. + * + * The exception will usually contain a package error code. + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_LogicException extends HTTP_Request2_Exception +{ +} + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/MessageException.php
Added
@@ -0,0 +1,37 @@ +<?php +/** + * Exception classes for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Exception thrown when sending or receiving HTTP message fails + * + * The exception may contain both package error code and native error code. + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_MessageException extends HTTP_Request2_Exception +{ +} + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/MultipartBody.php
Added
@@ -0,0 +1,275 @@ +<?php +/** + * Helper class for building multipart/form-data request body + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Exception class for HTTP_Request2 package */ +require_once 'HTTP/Request2/Exception.php'; + +/** + * Class for building multipart/form-data request body + * + * The class helps to reduce memory consumption by streaming large file uploads + * from disk, it also allows monitoring of upload progress (see request #7630) + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + * @link http://tools.ietf.org/html/rfc1867 + */ +class HTTP_Request2_MultipartBody +{ + /** + * MIME boundary + * + * @var string + */ + private $_boundary; + + /** + * Form parameters added via {@link HTTP_Request2::addPostParameter()} + * + * @var array + */ + private $_params = ; + + /** + * File uploads added via {@link HTTP_Request2::addUpload()} + * + * @var array + */ + private $_uploads = ; + + /** + * Header for parts with parameters + * + * @var string + */ + private $_headerParam = "--%s\r\nContent-Disposition: form-data; name=\"%s\"\r\n\r\n"; + + /** + * Header for parts with uploads + * + * @var string + */ + private $_headerUpload = "--%s\r\nContent-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\nContent-Type: %s\r\n\r\n"; + + /** + * Current position in parameter and upload arrays + * + * First number is index of "current" part, second number is position within + * "current" part + * + * @var array + */ + private $_pos = 0, 0; + + + /** + * Constructor. Sets the arrays with POST data. + * + * @param array $params values of form fields set via + * {@link HTTP_Request2::addPostParameter()} + * @param array $uploads file uploads set via + * {@link HTTP_Request2::addUpload()} + * @param bool $useBrackets whether to append brackets to array variable names + */ + public function __construct(array $params, array $uploads, $useBrackets = true) + { + $this->_params = self::_flattenArray('', $params, $useBrackets); + foreach ($uploads as $fieldName => $f) { + if (!is_array($f'fp')) { + $this->_uploads = $f + 'name' => $fieldName; + } else { + for ($i = 0; $i < count($f'fp'); $i++) { + $upload = + 'name' => ($useBrackets? $fieldName . '' . $i . '': $fieldName) + ; + foreach ('fp', 'filename', 'size', 'type' as $key) { + $upload$key = $f$key$i; + } + $this->_uploads = $upload; + } + } + } + } + + /** + * Returns the length of the body to use in Content-Length header + * + * @return integer + */ + public function getLength() + { + $boundaryLength = strlen($this->getBoundary()); + $headerParamLength = strlen($this->_headerParam) - 4 + $boundaryLength; + $headerUploadLength = strlen($this->_headerUpload) - 8 + $boundaryLength; + $length = $boundaryLength + 6; + foreach ($this->_params as $p) { + $length += $headerParamLength + strlen($p0) + strlen($p1) + 2; + } + foreach ($this->_uploads as $u) { + $length += $headerUploadLength + strlen($u'name') + strlen($u'type') + + strlen($u'filename') + $u'size' + 2; + } + return $length; + } + + /** + * Returns the boundary to use in Content-Type header + * + * @return string + */ + public function getBoundary() + { + if (empty($this->_boundary)) { + $this->_boundary = '--' . md5('PEAR-HTTP_Request2-' . microtime()); + } + return $this->_boundary; + } + + /** + * Returns next chunk of request body + * + * @param integer $length Number of bytes to read + * + * @return string Up to $length bytes of data, empty string if at end + * @throws HTTP_Request2_LogicException + */ + public function read($length) + { + $ret = ''; + $boundary = $this->getBoundary(); + $paramCount = count($this->_params); + $uploadCount = count($this->_uploads); + while ($length > 0 && $this->_pos0 <= $paramCount + $uploadCount) { + $oldLength = $length; + if ($this->_pos0 < $paramCount) { + $param = sprintf( + $this->_headerParam, $boundary, $this->_params$this->_pos00 + ) . $this->_params$this->_pos01 . "\r\n"; + $ret .= substr($param, $this->_pos1, $length); + $length -= min(strlen($param) - $this->_pos1, $length); + + } elseif ($this->_pos0 < $paramCount + $uploadCount) { + $pos = $this->_pos0 - $paramCount; + $header = sprintf( + $this->_headerUpload, $boundary, $this->_uploads$pos'name', + $this->_uploads$pos'filename', $this->_uploads$pos'type' + ); + if ($this->_pos1 < strlen($header)) { + $ret .= substr($header, $this->_pos1, $length); + $length -= min(strlen($header) - $this->_pos1, $length); + } + $filePos = max(0, $this->_pos1 - strlen($header)); + if ($filePos < $this->_uploads$pos'size') { + while ($length > 0 && !feof($this->_uploads$pos'fp')) { + if (false === ($chunk = fread($this->_uploads$pos'fp', $length))) { + throw new HTTP_Request2_LogicException( + 'Failed reading file upload', HTTP_Request2_Exception::READ_ERROR + ); + } + $ret .= $chunk; + $length -= strlen($chunk); + } + } + if ($length > 0) { + $start = $this->_pos1 + ($oldLength - $length) - + strlen($header) - $this->_uploads$pos'size'; + $ret .= substr("\r\n", $start, $length); + $length -= min(2 - $start, $length); + } + + } else { + $closing = '--' . $boundary . "--\r\n"; + $ret .= substr($closing, $this->_pos1, $length); + $length -= min(strlen($closing) - $this->_pos1, $length); + } + if ($length > 0) { + $this->_pos = $this->_pos0 + 1, 0; + } else { + $this->_pos1 += $oldLength; + } + } + return $ret; + } + + /** + * Sets the current position to the start of the body + * + * This allows reusing the same body in another request + * + * @return void + */ + public function rewind() + { + $this->_pos = 0, 0; + foreach ($this->_uploads as $u) { + rewind($u'fp'); + } + } + + /** + * Returns the body as string + * + * Note that it reads all file uploads into memory so it is a good idea not + * to use this method with large file uploads and rely on read() instead. + * + * @return string + */ + public function __toString() + { + $this->rewind(); + return $this->read($this->getLength()); + } + + + /** + * Helper function to change the (probably multidimensional) associative array + * into the simple one. + * + * @param string $name name for item + * @param mixed $values item's values + * @param bool $useBrackets whether to append to array variables' names + * + * @return array array with the following items: array('item name', 'item value'); + */ + private static function _flattenArray($name, $values, $useBrackets) + { + if (!is_array($values)) { + return $name, $values; + } else { + $ret = ; + foreach ($values as $k => $v) { + if (empty($name)) { + $newName = $k; + } elseif ($useBrackets) { + $newName = $name . '' . $k . ''; + } else { + $newName = $name; + } + $ret = array_merge($ret, self::_flattenArray($newName, $v, $useBrackets)); + } + return $ret; + } + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/NotImplementedException.php
Added
@@ -0,0 +1,35 @@ +<?php +/** + * Exception classes for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Exception thrown in case of missing features + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_NotImplementedException extends HTTP_Request2_Exception +{ +} + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/Observer/Log.php
Added
@@ -0,0 +1,198 @@ +<?php +/** + * An observer useful for debugging / testing. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author David Jean Louis <izi@php.net> + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Exception class for HTTP_Request2 package + */ +require_once 'HTTP/Request2/Exception.php'; + +/** + * A debug observer useful for debugging / testing. + * + * This observer logs to a log target data corresponding to the various request + * and response events, it logs by default to php://output but can be configured + * to log to a file or via the PEAR Log package. + * + * A simple example: + * <code> + * require_once 'HTTP/Request2.php'; + * require_once 'HTTP/Request2/Observer/Log.php'; + * + * $request = new HTTP_Request2('http://www.example.com'); + * $observer = new HTTP_Request2_Observer_Log(); + * $request->attach($observer); + * $request->send(); + * </code> + * + * A more complex example with PEAR Log: + * <code> + * require_once 'HTTP/Request2.php'; + * require_once 'HTTP/Request2/Observer/Log.php'; + * require_once 'Log.php'; + * + * $request = new HTTP_Request2('http://www.example.com'); + * // we want to log with PEAR log + * $observer = new HTTP_Request2_Observer_Log(Log::factory('console')); + * + * // we only want to log received headers + * $observer->events = array('receivedHeaders'); + * + * $request->attach($observer); + * $request->send(); + * </code> + * + * @category HTTP + * @package HTTP_Request2 + * @author David Jean Louis <izi@php.net> + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_Observer_Log implements SplObserver +{ + // properties {{{ + + /** + * The log target, it can be a resource or a PEAR Log instance. + * + * @var resource|Log $target + */ + protected $target; + + /** + * The events to log. + * + * @var array $events + */ + public $events = + 'connect', + 'sentHeaders', + 'sentBody', + 'receivedHeaders', + 'receivedBody', + 'disconnect', + ; + + // }}} + // __construct() {{{ + + /** + * Constructor. + * + * @param string|resource|Log $target Can be a file path (default: php://output), a resource, + * or an instance of the PEAR Log class. + * @param array $events Array of events to listen to (default: all events) + * + * @return void + */ + public function __construct($target = 'php://output', array $events = ) + { + if (!empty($events)) { + $this->events = $events; + } + if (is_resource($target) || $target instanceof Log) { + $this->target = $target; + } elseif (false === ($this->target = @fopen($target, 'ab'))) { + throw new HTTP_Request2_Exception("Unable to open '{$target}'"); + } + } + + // }}} + // update() {{{ + + #ReturnTypeWillChange + /** + * Called when the request notifies us of an event. + * + * @param HTTP_Request2 $subject The HTTP_Request2 instance + * + * @return void + */ + public function update(SplSubject $subject) + { + if (!$subject instanceof HTTP_Request2) { + return; + } + $event = $subject->getLastEvent(); + if (!in_array($event'name', $this->events)) { + return; + } + + switch ($event'name') { + case 'connect': + $this->log('* Connected to ' . $event'data'); + break; + case 'sentHeaders': + $headers = explode("\r\n", $event'data'); + array_pop($headers); + foreach ($headers as $header) { + $this->log('> ' . $header); + } + break; + case 'sentBody': + $this->log('> ' . $event'data' . ' byte(s) sent'); + break; + case 'receivedHeaders': + $this->log( + sprintf( + '< HTTP/%s %s %s', $event'data'->getVersion(), + $event'data'->getStatus(), $event'data'->getReasonPhrase() + ) + ); + $headers = $event'data'->getHeader(); + foreach ($headers as $key => $val) { + $this->log('< ' . $key . ': ' . $val); + } + $this->log('< '); + break; + case 'receivedBody': + $this->log($event'data'->getBody()); + break; + case 'disconnect': + $this->log('* Disconnected'); + break; + } + } + + // }}} + // log() {{{ + + /** + * Logs the given message to the configured target. + * + * @param string $message Message to display + * + * @return void + */ + protected function log($message) + { + if ($this->target instanceof Log) { + $this->target->debug($message); + } elseif (is_resource($this->target)) { + fwrite($this->target, $message . "\r\n"); + } + } + + // }}} +} + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/Observer/UncompressingDownload.php
Added
@@ -0,0 +1,278 @@ +<?php +/** + * An observer that saves response body to stream, possibly uncompressing it + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Delian Krustev <krustev@krustev.net> + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +require_once 'HTTP/Request2/Response.php'; + +/** + * An observer that saves response body to stream, possibly uncompressing it + * + * This Observer is written in compliment to pear's HTTP_Request2 in order to + * avoid reading the whole response body in memory. Instead it writes the body + * to a stream. If the body is transferred with content-encoding set to + * "deflate" or "gzip" it is decoded on the fly. + * + * The constructor accepts an already opened (for write) stream (file_descriptor). + * If the response is deflate/gzip encoded a "zlib.inflate" filter is applied + * to the stream. When the body has been read from the request and written to + * the stream ("receivedBody" event) the filter is removed from the stream. + * + * The "zlib.inflate" filter works fine with pure "deflate" encoding. It does + * not understand the "deflate+zlib" and "gzip" headers though, so they have to + * be removed prior to being passed to the stream. This is done in the "update" + * method. + * + * It is also possible to limit the size of written extracted bytes by passing + * "max_bytes" to the constructor. This is important because e.g. 1GB of + * zeroes take about a MB when compressed. + * + * Exceptions are being thrown if data could not be written to the stream or + * the written bytes have already exceeded the requested maximum. If the "gzip" + * header is malformed or could not be parsed an exception will be thrown too. + * + * Example usage follows: + * + * <code> + * require_once 'HTTP/Request2.php'; + * require_once 'HTTP/Request2/Observer/UncompressingDownload.php'; + * + * #$inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html'; + * #$inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on'; + * $inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on&zlib=on'; + * #$outPath = "/dev/null"; + * $outPath = "delme"; + * + * $stream = fopen($outPath, 'wb'); + * if (!$stream) { + * throw new Exception('fopen failed'); + * } + * + * $request = new HTTP_Request2( + * $inPath, + * HTTP_Request2::METHOD_GET, + * array( + * 'store_body' => false, + * 'connect_timeout' => 5, + * 'timeout' => 10, + * 'ssl_verify_peer' => true, + * 'ssl_verify_host' => true, + * 'ssl_cafile' => null, + * 'ssl_capath' => '/etc/ssl/certs', + * 'max_redirects' => 10, + * 'follow_redirects' => true, + * 'strict_redirects' => false + * ) + * ); + * + * $observer = new HTTP_Request2_Observer_UncompressingDownload($stream, 9999999); + * $request->attach($observer); + * + * $response = $request->send(); + * + * fclose($stream); + * echo "OK\n"; + * </code> + * + * @category HTTP + * @package HTTP_Request2 + * @author Delian Krustev <krustev@krustev.net> + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + */ +class HTTP_Request2_Observer_UncompressingDownload implements SplObserver +{ + /** + * The stream to write response body to + * + * @var resource + */ + private $_stream; + + /** + * 'zlib.inflate' filter possibly added to stream + * + * @var resource|null + */ + private $_streamFilter; + + /** + * The value of response's Content-Encoding header + * + * @var string + */ + private $_encoding; + + /** + * Whether the observer is still waiting for gzip/deflate header + * + * @var bool + */ + private $_processingHeader = true; + + /** + * Starting position in the stream observer writes to + * + * @var int + */ + private $_startPosition = 0; + + /** + * Maximum bytes to write + * + * @var int|null + */ + private $_maxDownloadSize; + + /** + * Whether response being received is a redirect + * + * @var bool + */ + private $_redirect = false; + + /** + * Accumulated body chunks that may contain (gzip) header + * + * @var string + */ + private $_possibleHeader = ''; + + /** + * Class constructor + * + * Note that there might be problems with max_bytes and files bigger + * than 2 GB on 32bit platforms + * + * @param resource $stream a stream (or file descriptor) opened for writing. + * @param int $maxDownloadSize maximum bytes to write + */ + public function __construct($stream, $maxDownloadSize = null) + { + $this->_stream = $stream; + if ($maxDownloadSize) { + $this->_maxDownloadSize = $maxDownloadSize; + $this->_startPosition = ftell($this->_stream); + } + } + + #ReturnTypeWillChange + /** + * Called when the request notifies us of an event. + * + * @param HTTP_Request2 $subject The HTTP_Request2 instance + * + * @return void + * @throws HTTP_Request2_MessageException + */ + public function update(SplSubject $subject) + { + if (!$subject instanceof HTTP_Request2) { + return; + } + $event = $subject->getLastEvent(); + $encoded = false; + + /* @var $event'data' HTTP_Request2_Response */ + switch ($event'name') { + case 'receivedHeaders': + $this->_processingHeader = true; + $this->_redirect = $event'data'->isRedirect(); + $this->_encoding = strtolower($event'data'->getHeader('content-encoding') ?: ''); + $this->_possibleHeader = ''; + break; + + case 'receivedEncodedBodyPart': + if (!$this->_streamFilter + && ($this->_encoding === 'deflate' || $this->_encoding === 'gzip') + ) { + $this->_streamFilter = stream_filter_append( + $this->_stream, 'zlib.inflate', STREAM_FILTER_WRITE + ); + } + $encoded = true; + // fall-through is intentional + + case 'receivedBodyPart': + if ($this->_redirect) { + break; + } + + if (!$encoded || !$this->_processingHeader) { + $bytes = fwrite($this->_stream, $event'data'); + + } else { + $offset = 0; + $this->_possibleHeader .= $event'data'; + if ('deflate' === $this->_encoding) { + if (2 > strlen($this->_possibleHeader)) { + break; + } + $header = unpack('n', substr($this->_possibleHeader, 0, 2)); + if (0 == $header1 % 31) { + $offset = 2; + } + + } elseif ('gzip' === $this->_encoding) { + if (10 > strlen($this->_possibleHeader)) { + break; + } + try { + $offset = HTTP_Request2_Response::parseGzipHeader($this->_possibleHeader, false); + + } catch (HTTP_Request2_MessageException $e) { + // need more data? + if (false !== strpos($e->getMessage(), 'data too short')) { + break; + } + throw $e; + } + } + + $this->_processingHeader = false; + $bytes = fwrite($this->_stream, substr($this->_possibleHeader, $offset)); + } + + if (false === $bytes) { + throw new HTTP_Request2_MessageException('fwrite failed.'); + } + + if ($this->_maxDownloadSize + && ftell($this->_stream) - $this->_startPosition > $this->_maxDownloadSize + ) { + throw new HTTP_Request2_MessageException( + sprintf( + 'Body length limit (%d bytes) reached', + $this->_maxDownloadSize + ) + ); + } + break; + + case 'receivedBody': + if ($this->_streamFilter) { + stream_filter_remove($this->_streamFilter); + $this->_streamFilter = null; + } + break; + } + } +}
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/Response.php
Added
@@ -0,0 +1,694 @@ +<?php +/** + * Class representing a HTTP response + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Exception class for HTTP_Request2 package + */ +require_once 'HTTP/Request2/Exception.php'; + +/** + * Class representing a HTTP response + * + * The class is designed to be used in "streaming" scenario, building the + * response as it is being received: + * <code> + * $statusLine = read_status_line(); + * $response = new HTTP_Request2_Response($statusLine); + * do { + * $headerLine = read_header_line(); + * $response->parseHeaderLine($headerLine); + * } while ($headerLine != ''); + * + * while ($chunk = read_body()) { + * $response->appendBody($chunk); + * } + * + * var_dump($response->getHeader(), $response->getCookies(), $response->getBody()); + * </code> + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + * @link http://tools.ietf.org/html/rfc2616#section-6 + */ +class HTTP_Request2_Response +{ + /** + * HTTP protocol version (e.g. 1.0, 1.1) + * + * @var string + */ + protected $version; + + /** + * Status code + * + * @var integer + * @link http://tools.ietf.org/html/rfc2616#section-6.1.1 + */ + protected $code; + + /** + * Reason phrase + * + * @var string|null + * @link http://tools.ietf.org/html/rfc2616#section-6.1.1 + */ + protected $reasonPhrase; + + /** + * Effective URL (may be different from original request URL in case of redirects) + * + * @var string + */ + protected $effectiveUrl; + + /** + * Associative array of response headers + * + * @var array + */ + protected $headers = ; + + /** + * Cookies set in the response + * + * @var array + */ + protected $cookies = ; + + /** + * Name of last header processed by {@see parseHeaderLine()} + * + * Used to handle the headers that span multiple lines + * + * @var string|null + */ + protected $lastHeader = null; + + /** + * Response body + * + * @var string + */ + protected $body = ''; + + /** + * Whether the body is still encoded by Content-Encoding + * + * cURL provides the decoded body to the callback; if we are reading from + * socket the body is still gzipped / deflated + * + * @var bool + */ + protected $bodyEncoded; + + /** + * Associative array of HTTP status code / reason phrase. + * + * @var array + * @link http://tools.ietf.org/html/rfc2616#section-10 + */ + protected static $phrases = + + // 1xx: Informational - Request received, continuing process + 100 => 'Continue', + 101 => 'Switching Protocols', + + // 2xx: Success - The action was successfully received, understood and + // accepted + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + + // 3xx: Redirection - Further action must be taken in order to complete + // the request + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', // 1.1 + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 307 => 'Temporary Redirect', + + // 4xx: Client Error - The request contains bad syntax or cannot be + // fulfilled + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Timeout', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Long', + 415 => 'Unsupported Media Type', + 416 => 'Requested Range Not Satisfiable', + 417 => 'Expectation Failed', + + // 5xx: Server Error - The server failed to fulfill an apparently + // valid request + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported', + 509 => 'Bandwidth Limit Exceeded', + + ; + + /** + * Returns the default reason phrase for the given code or all reason phrases + * + * @param int $code Response code + * + * @return string|array|null Default reason phrase for $code if $code is given + * (null if no phrase is available), array of all + * reason phrases if $code is null + * @link http://pear.php.net/bugs/18716 + * + * @psalm-return ($code is null ? array<int, string> : ?string) + */ + public static function getDefaultReasonPhrase($code = null) + { + if (null === $code) { + return self::$phrases; + } else { + return isset(self::$phrases$code) ? self::$phrases$code : null; + } + } + + /** + * Constructor, parses the response status line + * + * @param string $statusLine Response status line (e.g. "HTTP/1.1 200 OK") + * @param bool $bodyEncoded Whether body is still encoded by Content-Encoding + * @param string $effectiveUrl Effective URL of the response + * + * @throws HTTP_Request2_MessageException if status line is invalid according to spec + */ + public function __construct($statusLine, $bodyEncoded = true, $effectiveUrl = null) + { + if (!preg_match('!^HTTP/(\d\.\d) (\d{3}) (^\r\n*)!', $statusLine, $m)) { + throw new HTTP_Request2_MessageException( + "Malformed response: {$statusLine}", + HTTP_Request2_Exception::MALFORMED_RESPONSE + ); + } + $this->version = $m1; + $this->code = intval($m2); + $this->reasonPhrase = '' !== $m3 ? $m3 : self::getDefaultReasonPhrase($this->code); + $this->bodyEncoded = (bool)$bodyEncoded; + $this->effectiveUrl = (string)$effectiveUrl; + } + + /** + * Parses the line from HTTP response filling $headers array + * + * The method should be called after reading the line from socket or receiving + * it into cURL callback. Passing an empty string here indicates the end of + * response headers and triggers additional processing, so be sure to pass an + * empty string in the end. + * + * @param string $headerLine Line from HTTP response + * + * @return void + */ + public function parseHeaderLine($headerLine) + { + $headerLine = trim($headerLine, "\r\n"); + + if ('' == $headerLine) { + // empty string signals the end of headers, process the received ones + if (!empty($this->headers'set-cookie')) { + $cookies = is_array($this->headers'set-cookie')? + $this->headers'set-cookie': + $this->headers'set-cookie'; + foreach ($cookies as $cookieString) { + $this->parseCookie($cookieString); + } + unset($this->headers'set-cookie'); + } + foreach (array_keys($this->headers) as $k) { + if (is_array($this->headers$k)) { + $this->headers$k = implode(', ', $this->headers$k); + } + } + + } elseif (preg_match('!^(^\x00-\x1f\x7f-\xff()<>@,;:\\\\"/\\?={}\s+):(.+)$!', $headerLine, $m)) { + // string of the form header-name: header value + $name = strtolower($m1); + $value = trim($m2); + if (empty($this->headers$name)) { + $this->headers$name = $value; + } else { + if (!is_array($this->headers$name)) { + $this->headers$name = $this->headers$name; + } + $this->headers$name = $value; + } + $this->lastHeader = $name; + + } elseif (preg_match('!^\s+(.+)$!', $headerLine, $m) && $this->lastHeader) { + // continuation of a previous header + if (!is_array($this->headers$this->lastHeader)) { + $this->headers$this->lastHeader .= ' ' . trim($m1); + } else { + $key = count($this->headers$this->lastHeader) - 1; + $this->headers$this->lastHeader$key .= ' ' . trim($m1); + } + } + } + + /** + * Parses a Set-Cookie header to fill $cookies array + * + * @param string $cookieString value of Set-Cookie header + * + * @return void + * + * @link http://web.archive.org/web/20080331104521/http://cgi.netscape.com/newsref/std/cookie_spec.html + */ + protected function parseCookie($cookieString) + { + $cookie = + 'expires' => null, + 'domain' => null, + 'path' => null, + 'secure' => false + ; + + if (!strpos($cookieString, ';')) { + // Only a name=value pair + $pos = (int)strpos($cookieString, '='); + $cookie'name' = trim(substr($cookieString, 0, $pos)); + $cookie'value' = trim(substr($cookieString, $pos + 1)); + + } else { + // Some optional parameters are supplied + $elements = explode(';', $cookieString); + $pos = (int)strpos($elements0, '='); + $cookie'name' = trim(substr($elements0, 0, $pos)); + $cookie'value' = trim(substr($elements0, $pos + 1)); + + for ($i = 1; $i < count($elements); $i++) { + if (false === strpos($elements$i, '=')) { + $elName = trim($elements$i); + $elValue = null; + } else { + list ($elName, $elValue) = array_map('trim', explode('=', $elements$i)); + } + $elName = strtolower($elName); + if ('secure' == $elName) { + $cookie'secure' = true; + } elseif ('expires' == $elName) { + $cookie'expires' = str_replace('"', '', (string)$elValue); + } elseif ('path' == $elName || 'domain' == $elName) { + $cookie$elName = urldecode((string)$elValue); + } else { + $cookie$elName = $elValue; + } + } + } + $this->cookies = $cookie; + } + + /** + * Appends a string to the response body + * + * @param string $bodyChunk part of response body + * + * @return void + */ + public function appendBody($bodyChunk) + { + $this->body .= $bodyChunk; + } + + /** + * Returns the effective URL of the response + * + * This may be different from the request URL if redirects were followed. + * + * @return string + * @link http://pear.php.net/bugs/bug.php?id=18412 + */ + public function getEffectiveUrl() + { + return $this->effectiveUrl; + } + + /** + * Returns the status code + * + * @return integer + */ + public function getStatus() + { + return $this->code; + } + + /** + * Returns the reason phrase + * + * @return string|null + */ + public function getReasonPhrase() + { + return $this->reasonPhrase; + } + + /** + * Whether response is a redirect that can be automatically handled by HTTP_Request2 + * + * @return bool + */ + public function isRedirect() + { + return in_array($this->code, 300, 301, 302, 303, 307) + && isset($this->headers'location'); + } + + /** + * Returns either the named header or all response headers + * + * @param string $headerName Name of header to return + * + * @return string|array|null Value of $headerName header (null if header is + * not present), array of all response headers if + * $headerName is null + * @psalm-return ($headerName is null ? array<string, string> : ?string) + */ + public function getHeader($headerName = null) + { + if (null === $headerName) { + return $this->headers; + } else { + $headerName = strtolower($headerName); + return isset($this->headers$headerName)? $this->headers$headerName: null; + } + } + + /** + * Returns cookies set in response + * + * @return array + */ + public function getCookies() + { + return $this->cookies; + } + + /** + * Returns the body of the response + * + * @return string + * @throws HTTP_Request2_Exception if body cannot be decoded + */ + public function getBody() + { + if ('' !== $this->body + && $this->bodyEncoded + && in_array(strtolower($this->getHeader('content-encoding') ?: ''), 'gzip', 'deflate') + ) { + if (extension_loaded('mbstring') && (2 & (int)ini_get('mbstring.func_overload'))) { + $oldEncoding = mb_internal_encoding(); + mb_internal_encoding('8bit'); + } + + try { + switch (strtolower((string)$this->getHeader('content-encoding'))) { + case 'gzip': + return self::decodeGzip($this->body); + case 'deflate': + return self::decodeDeflate($this->body); + } + } finally { + if (extension_loaded('mbstring') && !empty($oldEncoding)) { + mb_internal_encoding($oldEncoding); + } + } + } + + return $this->body; + } + + /** + * Get the HTTP version of the response + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Checks whether data starts with GZIP format identification bytes from RFC 1952 + * + * @param string $data gzip-encoded (presumably) data + * + * @return bool + */ + public static function hasGzipIdentification($data) + { + return 0 === strcmp(substr($data, 0, 2), "\x1f\x8b"); + } + + /** + * Tries to parse GZIP format header in the given string + * + * If the header conforms to RFC 1952, its length is returned. If any + * sanity check fails, HTTP_Request2_MessageException is thrown. + * + * Note: This function might be usable outside of HTTP_Request2 so it might + * be good idea to be moved to some common package. (Delian Krustev) + * + * @param string $data Either the complete response body or + * the leading part of it + * @param boolean $dataComplete Whether $data contains complete response body + * + * @return int gzip header length in bytes + * @throws HTTP_Request2_MessageException + * @link http://tools.ietf.org/html/rfc1952 + */ + public static function parseGzipHeader($data, $dataComplete = false) + { + // if data is complete, trailing 8 bytes should be present for size and crc32 + $length = strlen($data) - ($dataComplete ? 8 : 0); + + if ($length < 10 || !self::hasGzipIdentification($data)) { + throw new HTTP_Request2_MessageException( + 'The data does not seem to contain a valid gzip header', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + + $method = ord(substr($data, 2, 1)); + if (8 != $method) { + throw new HTTP_Request2_MessageException( + 'Error parsing gzip header: unknown compression method', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + $flags = ord(substr($data, 3, 1)); + if ($flags & 224) { + throw new HTTP_Request2_MessageException( + 'Error parsing gzip header: reserved bits are set', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + + // header is 10 bytes minimum. may be longer, though. + $headerLength = 10; + // extra fields, need to skip 'em + if ($flags & 4) { + if ($length - $headerLength - 2 < 0) { + throw new HTTP_Request2_MessageException( + 'Error parsing gzip header: data too short', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + $extraLength = unpack('v', substr($data, 10, 2)); + if ($length - $headerLength - 2 - $extraLength1 < 0) { + throw new HTTP_Request2_MessageException( + 'Error parsing gzip header: data too short', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + $headerLength += $extraLength1 + 2; + } + // file name, need to skip that + if ($flags & 8) { + if ($length - $headerLength - 1 < 0) { + throw new HTTP_Request2_MessageException( + 'Error parsing gzip header: data too short', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + $filenameLength = strpos(substr($data, $headerLength), chr(0)); + if (false === $filenameLength + || $length - $headerLength - $filenameLength - 1 < 0 + ) { + throw new HTTP_Request2_MessageException( + 'Error parsing gzip header: data too short', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + $headerLength += $filenameLength + 1; + } + // comment, need to skip that also + if ($flags & 16) { + if ($length - $headerLength - 1 < 0) { + throw new HTTP_Request2_MessageException( + 'Error parsing gzip header: data too short', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + $commentLength = strpos(substr($data, $headerLength), chr(0)); + if (false === $commentLength + || $length - $headerLength - $commentLength - 1 < 0 + ) { + throw new HTTP_Request2_MessageException( + 'Error parsing gzip header: data too short', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + $headerLength += $commentLength + 1; + } + // have a CRC for header. let's check + if ($flags & 2) { + if ($length - $headerLength - 2 < 0) { + throw new HTTP_Request2_MessageException( + 'Error parsing gzip header: data too short', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + $crcReal = 0xffff & crc32(substr($data, 0, $headerLength)); + $crcStored = unpack('v', substr($data, $headerLength, 2)); + if ($crcReal != $crcStored1) { + throw new HTTP_Request2_MessageException( + 'Header CRC check failed', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + $headerLength += 2; + } + return $headerLength; + } + + /** + * Decodes the message-body encoded by gzip + * + * The real decoding work is done by gzinflate() built-in function, this + * method only parses the header and checks data for compliance with + * RFC 1952 + * + * @param string $data gzip-encoded data + * + * @return string decoded data + * @throws HTTP_Request2_LogicException + * @throws HTTP_Request2_MessageException + * @link http://tools.ietf.org/html/rfc1952 + */ + public static function decodeGzip($data) + { + // If it doesn't look like gzip-encoded data, don't bother + if (!self::hasGzipIdentification($data)) { + return $data; + } + if (!function_exists('gzinflate')) { + throw new HTTP_Request2_LogicException( + 'Unable to decode body: gzip extension not available', + HTTP_Request2_Exception::MISCONFIGURATION + ); + } + + // unpacked data CRC and size at the end of encoded data + $tmp = unpack('V2', substr($data, -8)); + $dataCrc = $tmp1; + $dataSize = $tmp2; + + $headerLength = self::parseGzipHeader($data, true); + + // don't pass $dataSize to gzinflate, see bugs #13135, #14370 + $unpacked = gzinflate(substr($data, $headerLength, -8)); + if (false === $unpacked) { + throw new HTTP_Request2_MessageException( + 'gzinflate() call failed', + HTTP_Request2_Exception::DECODE_ERROR + ); + + // GZIP stores the size of the compressed data in bytes modulo + // 2^32. To accommodate large file transfers, apply this to the + // observed data size. This allows file downloads above 4 GiB. + } elseif ((0xffffffff & $dataSize) !== (0xffffffff & strlen($unpacked))) { + throw new HTTP_Request2_MessageException( + 'Data size check failed', + HTTP_Request2_Exception::DECODE_ERROR + ); + } elseif ((0xffffffff & $dataCrc) !== (0xffffffff & crc32($unpacked))) { + throw new HTTP_Request2_MessageException( + 'Data CRC check failed', + HTTP_Request2_Exception::DECODE_ERROR + ); + } + return $unpacked; + } + + /** + * Decodes the message-body encoded by deflate + * + * @param string $data deflate-encoded data + * + * @return string decoded data + * @throws HTTP_Request2_LogicException + */ + public static function decodeDeflate($data) + { + if (!function_exists('gzuncompress')) { + throw new HTTP_Request2_LogicException( + 'Unable to decode body: gzip extension not available', + HTTP_Request2_Exception::MISCONFIGURATION + ); + } + // RFC 2616 defines 'deflate' encoding as zlib format from RFC 1950, + // while many applications send raw deflate stream from RFC 1951. + // We should check for presence of zlib header and use gzuncompress() or + // gzinflate() as needed. See bug #15305 + $header = unpack('n', substr($data, 0, 2)); + return (0 == $header1 % 31)? gzuncompress($data): gzinflate($data); + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/SOCKS5.php
Added
@@ -0,0 +1,138 @@ +<?php +/** + * SOCKS5 proxy connection class + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Socket wrapper class used by Socket Adapter */ +require_once 'HTTP/Request2/SocketWrapper.php'; + +/** + * SOCKS5 proxy connection class (used by Socket Adapter) + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + * @link http://pear.php.net/bugs/bug.php?id=19332 + * @link http://tools.ietf.org/html/rfc1928 + */ +class HTTP_Request2_SOCKS5 extends HTTP_Request2_SocketWrapper +{ + /** + * Constructor, tries to connect and authenticate to a SOCKS5 proxy + * + * @param string $address Proxy address, e.g. 'tcp://localhost:1080' + * @param int $timeout Connection timeout (seconds) + * @param array $contextOptions Stream context options + * @param string $username Proxy user name + * @param string $password Proxy password + * + * @throws HTTP_Request2_LogicException + * @throws HTTP_Request2_ConnectionException + * @throws HTTP_Request2_MessageException + */ + public function __construct( + $address, $timeout = 10, array $contextOptions = , + $username = '', $password = '' + ) { + parent::__construct($address, $timeout, $contextOptions); + + if ('' !== $username) { + $request = pack('C4', 5, 2, 0, 2); + } else { + $request = pack('C3', 5, 1, 0); + } + $this->write($request); + $response = unpack('Cversion/Cmethod', (string)$this->read(3)); + if (!$response || 5 !== $response'version') { + throw new HTTP_Request2_MessageException( + 'Invalid version received from SOCKS5 proxy: ' + . ($response ? $response'version' : 'none'), + HTTP_Request2_Exception::MALFORMED_RESPONSE + ); + } + switch ($response'method') { + case 2: + $this->performAuthentication($username, $password); + case 0: + break; + default: + throw new HTTP_Request2_ConnectionException( + "Connection rejected by proxy due to unsupported auth method" + ); + } + } + + /** + * Performs username/password authentication for SOCKS5 + * + * @param string $username Proxy user name + * @param string $password Proxy password + * + * @return void + * @throws HTTP_Request2_ConnectionException + * @throws HTTP_Request2_MessageException + * @link http://tools.ietf.org/html/rfc1929 + */ + protected function performAuthentication($username, $password) + { + $request = pack('C2', 1, strlen($username)) . $username + . pack('C', strlen($password)) . $password; + + $this->write($request); + $response = unpack('Cvn/Cstatus', (string)$this->read(3)); + if (!$response || 1 !== $response'vn' || 0 !== $response'status') { + throw new HTTP_Request2_ConnectionException( + 'Connection rejected by proxy due to invalid username and/or password' + ); + } + } + + /** + * Connects to a remote host via proxy + * + * @param string $remoteHost Remote host + * @param int $remotePort Remote port + * + * @return void + * @throws HTTP_Request2_ConnectionException + * @throws HTTP_Request2_MessageException + */ + public function connect($remoteHost, $remotePort) + { + $request = pack('C5', 0x05, 0x01, 0x00, 0x03, strlen($remoteHost)) + . $remoteHost . pack('n', $remotePort); + + $this->write($request); + $response = unpack('Cversion/Creply/Creserved', (string)$this->read(1024)); + if (!$response || 5 !== $response'version' || 0 !== $response'reserved') { + throw new HTTP_Request2_MessageException( + 'Invalid response received from SOCKS5 proxy', + HTTP_Request2_Exception::MALFORMED_RESPONSE + ); + } elseif (0 !== $response'reply') { + throw new HTTP_Request2_ConnectionException( + "Unable to connect to {$remoteHost}:{$remotePort} through SOCKS5 proxy", + 0, $response'reply' + ); + } + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/HTTP/Request2/SocketWrapper.php
Added
@@ -0,0 +1,393 @@ +<?php +/** + * Socket wrapper class used by Socket Adapter + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Exception classes for HTTP_Request2 package */ +require_once 'HTTP/Request2/Exception.php'; + +/** + * Socket wrapper class used by Socket Adapter + * + * Needed to properly handle connection errors, global timeout support and + * similar things. Loosely based on Net_Socket used by older HTTP_Request. + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @version Release: 2.6.0 + * @link http://pear.php.net/package/HTTP_Request2 + * @link http://pear.php.net/bugs/bug.php?id=19332 + * @link http://tools.ietf.org/html/rfc1928 + */ +class HTTP_Request2_SocketWrapper +{ + /** + * PHP warning messages raised during stream_socket_client() call + * + * @var array + */ + protected $connectionWarnings = ; + + /** + * Connected socket + * + * @var resource + */ + protected $socket; + + /** + * Sum of start time and global timeout, exception will be thrown if request continues past this time + * + * @var float|null + */ + protected $deadline; + + /** + * Global timeout value, mostly for exception messages + * + * @var integer + */ + protected $timeout; + + /** + * Class constructor, tries to establish connection + * + * @param string $address Address for stream_socket_client() call, + * e.g. 'tcp://localhost:80' + * @param int $timeout Connection timeout (seconds) + * @param array $contextOptions Context options + * + * @throws HTTP_Request2_LogicException + * @throws HTTP_Request2_ConnectionException + */ + public function __construct($address, $timeout, array $contextOptions = ) + { + if (!empty($contextOptions) + && !isset($contextOptions'socket') && !isset($contextOptions'ssl') + ) { + // Backwards compatibility with 2.1.0 and 2.1.1 releases + $contextOptions = 'ssl' => $contextOptions; + } + if (isset($contextOptions'ssl')) { + $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; + if (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT')) { + $cryptoMethod |= STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT; + } + $contextOptions'ssl' += + // Using "Intermediate compatibility" cipher bundle from + // https://wiki.mozilla.org/Security/Server_Side_TLS + 'ciphers' => 'TLS_AES_128_GCM_SHA256:' + . 'TLS_AES_256_GCM_SHA384:' + . 'TLS_CHACHA20_POLY1305_SHA256:' + . 'ECDHE-ECDSA-AES128-GCM-SHA256:' + . 'ECDHE-RSA-AES128-GCM-SHA256:' + . 'ECDHE-ECDSA-AES256-GCM-SHA384:' + . 'ECDHE-RSA-AES256-GCM-SHA384:' + . 'ECDHE-ECDSA-CHACHA20-POLY1305:' + . 'ECDHE-RSA-CHACHA20-POLY1305:' + . 'DHE-RSA-AES128-GCM-SHA256:' + . 'DHE-RSA-AES256-GCM-SHA384', + 'disable_compression' => true, + 'crypto_method' => $cryptoMethod + ; + } + $context = stream_context_create(); + foreach ($contextOptions as $wrapper => $options) { + foreach ($options as $name => $value) { + if (!stream_context_set_option($context, $wrapper, $name, $value)) { + throw new HTTP_Request2_LogicException( + "Error setting '{$wrapper}' wrapper context option '{$name}'" + ); + } + } + } + set_error_handler($this, 'connectionWarningsHandler'); + $socket = stream_socket_client( + $address, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $context + ); + restore_error_handler(); + // if we fail to bind to a specified local address (see request #19515), + // connection still succeeds, albeit with a warning. Throw an Exception + // with the warning text in this case as that connection is unlikely + // to be what user wants and as Curl throws an error in similar case. + if ($this->connectionWarnings) { + if ($socket) { + fclose($socket); + } + $error = $errstr ?: implode("\n", $this->connectionWarnings); + throw new HTTP_Request2_ConnectionException( + "Unable to connect to {$address}. Error: {$error}", 0, $errno + ); + } + // Run socket in non-blocking mode, to prevent possible problems with + // HTTPS requests not timing out properly (see bug #21229) + $this->socket = $socket; + stream_set_blocking($this->socket, false); + } + + /** + * Destructor, disconnects socket + */ + public function __destruct() + { + fclose($this->socket); + } + + /** + * Wrapper around fread(), handles global request timeout + * + * @param int $length Reads up to this number of bytes + * + * @return string|false Data read from socket by fread() + * @throws HTTP_Request2_MessageException In case of timeout + */ + public function read($length) + { + // Looks like stream_select() may return true, but then fread() will return an empty string... + // For some reason or other happens mostly with servers behind Cloudflare. + // Let's do the fread() call in a loop until either an error/eof or non-empty string: + do { + $data = false; + $timeouts = $this->_getTimeoutsForStreamSelect(); + + $r = $this->socket; + $w = ; + $e = ; + if (stream_select($r, $w, $e, $timeouts0, $timeouts1)) { + $data = fread($this->socket, $length); + } + + $this->checkTimeout(); + } while ('' === $data && !$this->eof()); + + return $data; + } + + /** + * Reads until either the end of the socket or a newline, whichever comes first + * + * Strips the trailing newline from the returned data, handles global + * request timeout. Method idea borrowed from Net_Socket PEAR package. + * + * @param int $bufferSize buffer size to use for reading + * @param int $localTimeout timeout value to use just for this call + * (used when waiting for "100 Continue" response) + * + * @return string Available data up to the newline (not including newline) + * @throws HTTP_Request2_MessageException In case of timeout + */ + public function readLine($bufferSize, $localTimeout = null) + { + $line = ''; + while (!feof($this->socket)) { + if (null !== $localTimeout) { + $timeouts = $localTimeout, 0; + $started = microtime(true); + } else { + $timeouts = $this->_getTimeoutsForStreamSelect(); + $started = 0.0; + } + + $r = $this->socket; + $w = ; + $e = ; + if (stream_select($r, $w, $e, $timeouts0, $timeouts1)) { + $line .= @fgets($this->socket, $bufferSize); + } + + if (null === $localTimeout) { + $this->checkTimeout(); + } elseif (microtime(true) - $started > $localTimeout) { + throw new HTTP_Request2_MessageException( + "readLine() call timed out", HTTP_Request2_Exception::TIMEOUT + ); + } + if (substr($line, -1) == "\n") { + return rtrim($line, "\r\n"); + } + } + return $line; + } + + /** + * Wrapper around fwrite(), handles global request timeout + * + * @param string $data String to be written + * + * @return int + * @throws HTTP_Request2_MessageException + */ + public function write($data) + { + $totalWritten = 0; + while (strlen($data) && !$this->eof()) { + $written = 0; + $error = null; + $timeouts = $this->_getTimeoutsForStreamSelect(); + + $r = null; + $w = $this->socket; + $e = null; + if (stream_select($r, $w, $e, $timeouts0, $timeouts1)) { + set_error_handler( + static function ($errNo, $errStr) use (&$error) { + if (0 !== ((E_NOTICE | E_WARNING) & $errNo)) { + $error = $errStr; + } + return true; + } + ); + $written = fwrite($this->socket, $data); + restore_error_handler(); + } + $this->checkTimeout(); + + // php_sockop_write() defined in /main/streams/xp_socket.c may return zero written bytes for non-blocking + // sockets in case of transient errors. These writes will not have notices raised and should be retried + if (false === $written || 0 === $written && null !== $error) { + throw new HTTP_Request2_MessageException( + 'Error writing request' . (null === $error ? '' : ': ' . $error) + ); + } + $data = substr($data, $written); + $totalWritten += $written; + } + return $totalWritten; + } + + /** + * Tests for end-of-file on a socket + * + * @return bool + */ + public function eof() + { + return feof($this->socket); + } + + /** + * Sets request deadline + * + * If null is passed for $deadline then deadline will be calculated based + * on default_socket_timeout PHP setting. This is done to keep BC with previous + * versions that used blocking sockets. + * + * @param float|null $deadline Exception will be thrown if request continues + * past this time + * @param int $timeout Original request timeout value, to use in + * Exception message + * + * @return void + */ + public function setDeadline($deadline, $timeout) + { + if (null === $deadline && 0 < ($defaultTimeout = (int)ini_get('default_socket_timeout'))) { + $deadline = microtime(true) + $defaultTimeout; + } + $this->deadline = $deadline; + $this->timeout = $timeout; + } + + /** + * Turns on encryption on a socket + * + * @return void + * @throws HTTP_Request2_ConnectionException + */ + public function enableCrypto() + { + $cryptoMethod = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; + if (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT')) { + $cryptoMethod |= STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT; + } + + try { + stream_set_blocking($this->socket, true); + if (!stream_socket_enable_crypto($this->socket, true, $cryptoMethod)) { + throw new HTTP_Request2_ConnectionException( + 'Failed to enable secure connection when connecting through proxy' + ); + } + } finally { + stream_set_blocking($this->socket, false); + } + } + + /** + * Throws an Exception if stream timed out + * + * @return void + * @throws HTTP_Request2_MessageException + */ + protected function checkTimeout() + { + $info = stream_get_meta_data($this->socket); + if ($info'timed_out' || $this->deadline && microtime(true) > $this->deadline) { + $reason = $this->timeout + ? "after {$this->timeout} second(s)" + : 'due to default_socket_timeout php.ini setting'; + throw new HTTP_Request2_MessageException( + "Request timed out {$reason}", HTTP_Request2_Exception::TIMEOUT + ); + } + } + + /** + * Returns timeouts based on deadline for use with stream_select() + * + * @return array First element is $tv_sec parameter for stream_select(), + * second element is $tv_usec + */ + private function _getTimeoutsForStreamSelect() + { + if (!$this->deadline) { + return null, null; + } + $parts = array_map( + 'intval', + explode('.', sprintf('%.6F', $this->deadline - microtime(true))) + ); + if (0 > $parts0 || 0 === $parts0 && $parts1 < 50000) { + return 0, 50000; + } + return $parts; + } + + /** + * Error handler to use during stream_socket_client() call + * + * One stream_socket_client() call may produce *multiple* PHP warnings + * (especially OpenSSL-related), we keep them in an array to later use for + * the message of HTTP_Request2_ConnectionException + * + * @param int $errno error level + * @param string $errstr error message + * + * @return bool + */ + protected function connectionWarningsHandler($errno, $errstr) + { + if ($errno & E_WARNING) { + array_unshift($this->connectionWarnings, $errstr); + } + return true; + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/data/generate-list.php
Added
@@ -0,0 +1,107 @@ +<?php +/** + * Helper file for downloading Public Suffix List and converting it to PHP array + * + * You can run this script to update PSL to the current version instead of + * waiting for a new release of HTTP_Request2. + * + * NB: peer validation is DISABLED when downloading. If you want to enable it, + * change ssl_verify_peer to true and provide CA file (see below) + */ + +/** URL to download Public Suffix List from */ +define('LIST_URL', 'https://publicsuffix.org/list/public_suffix_list.dat'); +/** Name of PHP file to write */ +define('OUTPUT_FILE', __DIR__ . '/public-suffix-list.php'); + +if (file_exists('../vendor/autoload.php')) { + require_once '../vendor/autoload.php'; +} else { + require_once 'HTTP/Request2.php'; +} + +function buildSubdomain(&$node, $tldParts) +{ + $part = trim(array_pop($tldParts)); + + if (!array_key_exists($part, $node)) { + $node$part = ; + } + + if (0 < count($tldParts)) { + buildSubdomain($node$part, $tldParts); + } +} + +function writeNode($fp, $valueTree, $key = null, $indent = 0) +{ + if (is_null($key)) { + fwrite($fp, "return "); + + } else { + fwrite($fp, str_repeat(' ', $indent) . "'$key' => "); + } + + if (0 == ($count = count($valueTree))) { + fwrite($fp, 'true'); + } else { + fwrite($fp, "\n"); + for ($keys = array_keys($valueTree), $i = 0; $i < $count; $i++) { + writeNode($fp, $valueTree$keys$i, $keys$i, $indent + 1); + if ($i + 1 != $count) { + fwrite($fp, ",\n"); + } else { + fwrite($fp, "\n"); + } + } + fwrite($fp, str_repeat(' ', $indent) . ""); + } +} + + +try { + $request = new HTTP_Request2(LIST_URL, HTTP_Request2::METHOD_GET, + // Provide path to your CA file and change 'ssl_verify_peer' to true to enable peer validation + // 'ssl_cafile' => '... path to your Certificate Authority file ...', + 'ssl_verify_peer' => false + ); + $response = $request->send(); + if (200 != $response->getStatus()) { + throw new Exception("List download URL returned status: " . + $response->getStatus() . ' ' . $response->getReasonPhrase()); + } + $list = $response->getBody(); + if (false === strpos($list, '// ===BEGIN ICANN DOMAINS===')) { + throw new Exception("List download URL does not contain expected phrase"); + } + if (!($fp = @fopen(OUTPUT_FILE, 'wb'))) { + throw new Exception("Unable to open " . OUTPUT_FILE); + } + +} catch (Exception $e) { + die($e->getMessage()); +} + +$tldTree = ; +$license = true; + +fwrite($fp, "<?php\n"); + +foreach (array_filter(array_map('trim', explode("\n", $list))) as $line) { + if ('//' != substr($line, 0, 2)) { + buildSubdomain($tldTree, explode('.', $line)); + + } elseif ($license) { + if (0 === strpos($line, "// ===BEGIN ICANN DOMAINS===")) { + fwrite($fp, "\n"); + $license = false; + } else { + fwrite($fp, $line . "\n"); + } + } +} + +writeNode($fp, $tldTree); +fwrite($fp, ";\n?>"); +fclose($fp); +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/data/public-suffix-list.php
Added
@@ -0,0 +1,10957 @@ +<?php +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +// Please pull this list from, and only from https://publicsuffix.org/list/public_suffix_list.dat, +// rather than any other VCS sites. Pulling from any other URL is not guaranteed to be supported. +// Instructions on pulling and using this list can be found at https://publicsuffix.org/list/. + +return + 'ac' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'net' => true, + 'mil' => true, + 'org' => true, + 'drr' => true + , + 'ad' => + 'nom' => true + , + 'ae' => + 'co' => true, + 'net' => true, + 'org' => true, + 'sch' => true, + 'ac' => true, + 'gov' => true, + 'mil' => true, + 'blogspot' => true + , + 'aero' => + 'accident-investigation' => true, + 'accident-prevention' => true, + 'aerobatic' => true, + 'aeroclub' => true, + 'aerodrome' => true, + 'agents' => true, + 'aircraft' => true, + 'airline' => true, + 'airport' => true, + 'air-surveillance' => true, + 'airtraffic' => true, + 'air-traffic-control' => true, + 'ambulance' => true, + 'amusement' => true, + 'association' => true, + 'author' => true, + 'ballooning' => true, + 'broker' => true, + 'caa' => true, + 'cargo' => true, + 'catering' => true, + 'certification' => true, + 'championship' => true, + 'charter' => true, + 'civilaviation' => true, + 'club' => true, + 'conference' => true, + 'consultant' => true, + 'consulting' => true, + 'control' => true, + 'council' => true, + 'crew' => true, + 'design' => true, + 'dgca' => true, + 'educator' => true, + 'emergency' => true, + 'engine' => true, + 'engineer' => true, + 'entertainment' => true, + 'equipment' => true, + 'exchange' => true, + 'express' => true, + 'federation' => true, + 'flight' => true, + 'fuel' => true, + 'gliding' => true, + 'government' => true, + 'groundhandling' => true, + 'group' => true, + 'hanggliding' => true, + 'homebuilt' => true, + 'insurance' => true, + 'journal' => true, + 'journalist' => true, + 'leasing' => true, + 'logistics' => true, + 'magazine' => true, + 'maintenance' => true, + 'media' => true, + 'microlight' => true, + 'modelling' => true, + 'navigation' => true, + 'parachuting' => true, + 'paragliding' => true, + 'passenger-association' => true, + 'pilot' => true, + 'press' => true, + 'production' => true, + 'recreation' => true, + 'repbody' => true, + 'res' => true, + 'research' => true, + 'rotorcraft' => true, + 'safety' => true, + 'scientist' => true, + 'services' => true, + 'show' => true, + 'skydiving' => true, + 'software' => true, + 'student' => true, + 'trader' => true, + 'trading' => true, + 'trainer' => true, + 'union' => true, + 'workinggroup' => true, + 'works' => true + , + 'af' => + 'gov' => true, + 'com' => true, + 'org' => true, + 'net' => true, + 'edu' => true + , + 'ag' => + 'com' => true, + 'org' => true, + 'net' => true, + 'co' => true, + 'nom' => true + , + 'ai' => + 'off' => true, + 'com' => true, + 'net' => true, + 'org' => true, + 'uwu' => true + , + 'al' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'mil' => true, + 'net' => true, + 'org' => true, + 'blogspot' => true + , + 'am' => + 'co' => true, + 'com' => true, + 'commune' => true, + 'net' => true, + 'org' => true, + 'radio' => true, + 'blogspot' => true, + 'neko' => true, + 'nyaa' => true + , + 'ao' => + 'ed' => true, + 'gv' => true, + 'og' => true, + 'co' => true, + 'pb' => true, + 'it' => true + , + 'aq' => true, + 'ar' => + 'bet' => true, + 'com' => + 'blogspot' => true + , + 'coop' => true, + 'edu' => true, + 'gob' => true, + 'gov' => true, + 'int' => true, + 'mil' => true, + 'musica' => true, + 'mutual' => true, + 'net' => true, + 'org' => true, + 'senasa' => true, + 'tur' => true + , + 'arpa' => + 'e164' => true, + 'in-addr' => true, + 'ip6' => true, + 'iris' => true, + 'uri' => true, + 'urn' => true + , + 'as' => + 'gov' => true + , + 'asia' => + 'cloudns' => true + , + 'at' => + 'ac' => + 'sth' => true + , + 'co' => + 'blogspot' => true + , + 'gv' => true, + 'or' => true, + 'funkfeuer' => + 'wien' => true + , + 'futurecms' => + '*' => true, + 'ex' => + '*' => true + , + 'in' => + '*' => true + + , + 'futurehosting' => true, + 'futuremailing' => true, + 'ortsinfo' => + 'ex' => + '*' => true + , + 'kunden' => + '*' => true + + , + 'biz' => true, + 'info' => true, + '123webseite' => true, + 'priv' => true, + 'myspreadshop' => true, + '12hp' => true, + '2ix' => true, + '4lima' => true, + 'lima-city' => true + , + 'au' => + 'com' => + 'blogspot' => true, + 'cloudlets' => + 'mel' => true + , + 'myspreadshop' => true + , + 'net' => true, + 'org' => true, + 'edu' => + 'act' => true, + 'catholic' => true, + 'nsw' => + 'schools' => true + , + 'nt' => true, + 'qld' => true, + 'sa' => true, + 'tas' => true, + 'vic' => true, + 'wa' => true + , + 'gov' => + 'qld' => true, + 'sa' => true, + 'tas' => true, + 'vic' => true, + 'wa' => true + , + 'asn' => true, + 'id' => true, + 'info' => true, + 'conf' => true, + 'oz' => true, + 'act' => true, + 'nsw' => true, + 'nt' => true, + 'qld' => true, + 'sa' => true, + 'tas' => true, + 'vic' => true, + 'wa' => true + , + 'aw' => + 'com' => true + , + 'ax' => + 'be' => true, + 'cat' => true, + 'es' => true, + 'eu' => true, + 'gg' => true, + 'mc' => true, + 'us' => true, + 'xy' => true + , + 'az' => + 'com' => true, + 'net' => true, + 'int' => true, + 'gov' => true, + 'org' => true, + 'edu' => true, + 'info' => true, + 'pp' => true, + 'mil' => true, + 'name' => true, + 'pro' => true, + 'biz' => true + , + 'ba' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'mil' => true, + 'net' => true, + 'org' => true, + 'rs' => true, + 'blogspot' => true + , + 'bb' => + 'biz' => true, + 'co' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'info' => true, + 'net' => true, + 'org' => true, + 'store' => true, + 'tv' => true + , + 'bd' => + '*' => true + , + 'be' => + 'ac' => true, + 'webhosting' => true, + 'blogspot' => true, + 'interhostsolutions' => + 'cloud' => true + , + 'kuleuven' => + 'ezproxy' => true + , + '123website' => true, + 'myspreadshop' => true, + 'transurl' => + '*' => true + + , + 'bf' => + 'gov' => true + , + 'bg' => + 'a' => true, + 'b' => true, + 'c' => true, + 'd' => true, + 'e' => true, + 'f' => true, + 'g' => true, + 'h' => true, + 'i' => true, + 'j' => true, + 'k' => true, + 'l' => true, + 'm' => true, + 'n' => true, + 'o' => true, + 'p' => true, + 'q' => true, + 'r' => true, + 's' => true, + 't' => true, + 'u' => true, + 'v' => true, + 'w' => true, + 'x' => true, + 'y' => true, + 'z' => true, + '0' => true, + '1' => true, + '2' => true, + '3' => true, + '4' => true, + '5' => true, + '6' => true, + '7' => true, + '8' => true, + '9' => true, + 'blogspot' => true, + 'barsy' => true + , + 'bh' => + 'com' => true, + 'edu' => true, + 'net' => true, + 'org' => true, + 'gov' => true + , + 'bi' => + 'co' => true, + 'com' => true, + 'edu' => true, + 'or' => true, + 'org' => true + , + 'biz' => + 'activetrail' => true, + 'cloudns' => true, + 'jozi' => true, + 'dyndns' => true, + 'for-better' => true, + 'for-more' => true, + 'for-some' => true, + 'for-the' => true, + 'selfip' => true, + 'webhop' => true, + 'orx' => true, + 'mmafan' => true, + 'myftp' => true, + 'no-ip' => true, + 'dscloud' => true + , + 'bj' => + 'africa' => true, + 'agro' => true, + 'architectes' => true, + 'assur' => true, + 'avocats' => true, + 'co' => true, + 'com' => true, + 'eco' => true, + 'econo' => true, + 'edu' => true, + 'info' => true, + 'loisirs' => true, + 'money' => true, + 'net' => true, + 'org' => true, + 'ote' => true, + 'resto' => true, + 'restaurant' => true, + 'tourism' => true, + 'univ' => true, + 'blogspot' => true + , + 'bm' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'net' => true, + 'org' => true + , + 'bn' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'net' => true, + 'org' => true, + 'co' => true + , + 'bo' => + 'com' => true, + 'edu' => true, + 'gob' => true, + 'int' => true, + 'org' => true, + 'net' => true, + 'mil' => true, + 'tv' => true, + 'web' => true, + 'academia' => true, + 'agro' => true, + 'arte' => true, + 'blog' => true, + 'bolivia' => true, + 'ciencia' => true, + 'cooperativa' => true, + 'democracia' => true, + 'deporte' => true, + 'ecologia' => true, + 'economia' => true, + 'empresa' => true, + 'indigena' => true, + 'industria' => true, + 'info' => true, + 'medicina' => true, + 'movimiento' => true, + 'musica' => true, + 'natural' => true, + 'nombre' => true, + 'noticias' => true, + 'patria' => true, + 'politica' => true, + 'profesional' => true, + 'plurinacional' => true, + 'pueblo' => true, + 'revista' => true, + 'salud' => true, + 'tecnologia' => true, + 'tksat' => true, + 'transporte' => true, + 'wiki' => true + , + 'br' => + '9guacu' => true, + 'abc' => true, + 'adm' => true, + 'adv' => true, + 'agr' => true, + 'aju' => true, + 'am' => true, + 'anani' => true, + 'aparecida' => true, + 'app' => true, + 'arq' => true, + 'art' => true, + 'ato' => true, + 'b' => true, + 'barueri' => true, + 'belem' => true, + 'bhz' => true, + 'bib' => true, + 'bio' => true, + 'blog' => true, + 'bmd' => true, + 'boavista' => true, + 'bsb' => true, + 'campinagrande' => true, + 'campinas' => true, + 'caxias' => true, + 'cim' => true, + 'cng' => true, + 'cnt' => true, + 'com' => + 'blogspot' => true, + 'simplesite' => true + , + 'contagem' => true, + 'coop' => true, + 'coz' => true, + 'cri' => true, + 'cuiaba' => true, + 'curitiba' => true, + 'def' => true, + 'des' => true, + 'det' => true, + 'dev' => true, + 'ecn' => true, + 'eco' => true, + 'edu' => true, + 'emp' => true, + 'enf' => true, + 'eng' => true, + 'esp' => true, + 'etc' => true, + 'eti' => true, + 'far' => true, + 'feira' => true, + 'flog' => true, + 'floripa' => true, + 'fm' => true, + 'fnd' => true, + 'fortal' => true, + 'fot' => true, + 'foz' => true, + 'fst' => true, + 'g12' => true, + 'geo' => true, + 'ggf' => true, + 'goiania' => true, + 'gov' => + 'ac' => true, + 'al' => true, + 'am' => true, + 'ap' => true, + 'ba' => true, + 'ce' => true, + 'df' => true, + 'es' => true, + 'go' => true, + 'ma' => true, + 'mg' => true, + 'ms' => true, + 'mt' => true, + 'pa' => true, + 'pb' => true, + 'pe' => true, + 'pi' => true, + 'pr' => true, + 'rj' => true, + 'rn' => true, + 'ro' => true, + 'rr' => true, + 'rs' => true, + 'sc' => true, + 'se' => true, + 'sp' => true, + 'to' => true + , + 'gru' => true, + 'imb' => true, + 'ind' => true, + 'inf' => true, + 'jab' => true, + 'jampa' => true, + 'jdf' => true, + 'joinville' => true, + 'jor' => true, + 'jus' => true, + 'leg' => + 'ac' => true, + 'al' => true, + 'am' => true, + 'ap' => true, + 'ba' => true, + 'ce' => true, + 'df' => true, + 'es' => true, + 'go' => true, + 'ma' => true, + 'mg' => true, + 'ms' => true, + 'mt' => true, + 'pa' => true, + 'pb' => true, + 'pe' => true, + 'pi' => true, + 'pr' => true, + 'rj' => true, + 'rn' => true, + 'ro' => true, + 'rr' => true, + 'rs' => true, + 'sc' => true, + 'se' => true, + 'sp' => true, + 'to' => true + , + 'lel' => true, + 'log' => true, + 'londrina' => true, + 'macapa' => true, + 'maceio' => true, + 'manaus' => true, + 'maringa' => true, + 'mat' => true, + 'med' => true, + 'mil' => true, + 'morena' => true, + 'mp' => true, + 'mus' => true, + 'natal' => true, + 'net' => true, + 'niteroi' => true, + 'nom' => + '*' => true + , + 'not' => true, + 'ntr' => true, + 'odo' => true, + 'ong' => true, + 'org' => true, + 'osasco' => true, + 'palmas' => true, + 'poa' => true, + 'ppg' => true, + 'pro' => true, + 'psc' => true, + 'psi' => true, + 'pvh' => true, + 'qsl' => true, + 'radio' => true, + 'rec' => true, + 'recife' => true, + 'rep' => true, + 'ribeirao' => true, + 'rio' => true, + 'riobranco' => true, + 'riopreto' => true, + 'salvador' => true, + 'sampa' => true, + 'santamaria' => true, + 'santoandre' => true, + 'saobernardo' => true, + 'saogonca' => true, + 'seg' => true, + 'sjc' => true, + 'slg' => true, + 'slz' => true, + 'sorocaba' => true, + 'srv' => true, + 'taxi' => true, + 'tc' => true, + 'tec' => true, + 'teo' => true, + 'the' => true, + 'tmp' => true, + 'trd' => true, + 'tur' => true, + 'tv' => true, + 'udi' => true, + 'vet' => true, + 'vix' => true, + 'vlog' => true, + 'wiki' => true, + 'zlg' => true + , + 'bs' => + 'com' => true, + 'net' => true, + 'org' => true, + 'edu' => true, + 'gov' => true, + 'we' => true + , + 'bt' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'net' => true, + 'org' => true + , + 'bv' => true, + 'bw' => + 'co' => true, + 'org' => true + , + 'by' => + 'gov' => true, + 'mil' => true, + 'com' => + 'blogspot' => true + , + 'of' => true, + 'mycloud' => true, + 'mediatech' => true + , + 'bz' => + 'com' => true, + 'net' => true, + 'org' => true, + 'edu' => true, + 'gov' => true, + 'za' => true, + 'gsj' => true + , + 'ca' => + 'ab' => true, + 'bc' => true, + 'mb' => true, + 'nb' => true, + 'nf' => true, + 'nl' => true, + 'ns' => true, + 'nt' => true, + 'nu' => true, + 'on' => true, + 'pe' => true, + 'qc' => true, + 'sk' => true, + 'yk' => true, + 'gc' => true, + 'barsy' => true, + 'awdev' => + '*' => true + , + 'co' => true, + 'blogspot' => true, + 'no-ip' => true, + 'myspreadshop' => true + , + 'cat' => true, + 'cc' => + 'cloudns' => true, + 'ftpaccess' => true, + 'game-server' => true, + 'myphotos' => true, + 'scrapping' => true, + 'twmail' => true, + 'csx' => true, + 'fantasyleague' => true, + 'spawn' => + 'instances' => true + + , + 'cd' => + 'gov' => true + , + 'cf' => + 'blogspot' => true + , + 'cg' => true, + 'ch' => + 'square7' => true, + 'blogspot' => true, + 'flow' => + 'ae' => + 'alp1' => true + , + 'appengine' => true + , + 'linkyard-cloud' => true, + 'dnsking' => true, + 'gotdns' => true, + '123website' => true, + 'myspreadshop' => true, + 'firenet' => + '*' => true, + 'svc' => + '*' => true + + , + '12hp' => true, + '2ix' => true, + '4lima' => true, + 'lima-city' => true + , + 'ci' => + 'org' => true, + 'or' => true, + 'com' => true, + 'co' => true, + 'edu' => true, + 'ed' => true, + 'ac' => true, + 'net' => true, + 'go' => true, + 'asso' => true, + 'aéroport' => true, + 'int' => true, + 'presse' => true, + 'md' => true, + 'gouv' => true, + 'fin' => true, + 'nl' => true + , + 'ck' => + '*' => true, + '!www' => true + , + 'cl' => + 'co' => true, + 'gob' => true, + 'gov' => true, + 'mil' => true, + 'blogspot' => true + , + 'cm' => + 'co' => true, + 'com' => true, + 'gov' => true, + 'net' => true + , + 'cn' => + 'ac' => true, + 'com' => + 'amazonaws' => + 'cn-north-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-deprecated' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'cn-northwest-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'compute' => + '*' => true + , + 'airflow' => + 'cn-north-1' => + '*' => true + , + 'cn-northwest-1' => + '*' => true + + , + 'eb' => + 'cn-north-1' => true, + 'cn-northwest-1' => true + , + 'elb' => + '*' => true + + , + 'sagemaker' => + 'cn-north-1' => + 'notebook' => true, + 'studio' => true + , + 'cn-northwest-1' => + 'notebook' => true, + 'studio' => true + + + , + 'edu' => true, + 'gov' => true, + 'net' => true, + 'org' => true, + 'mil' => true, + '公司' => true, + '网络' => true, + '網絡' => true, + 'ah' => true, + 'bj' => true, + 'cq' => true, + 'fj' => true, + 'gd' => true, + 'gs' => true, + 'gz' => true, + 'gx' => true, + 'ha' => true, + 'hb' => true, + 'he' => true, + 'hi' => true, + 'hl' => true, + 'hn' => true, + 'jl' => true, + 'js' => true, + 'jx' => true, + 'ln' => true, + 'nm' => true, + 'nx' => true, + 'qh' => true, + 'sc' => true, + 'sd' => true, + 'sh' => true, + 'sn' => true, + 'sx' => true, + 'tj' => true, + 'xj' => true, + 'xz' => true, + 'yn' => true, + 'zj' => true, + 'hk' => true, + 'mo' => true, + 'tw' => true, + 'canva-apps' => true, + 'instantcloud' => true, + 'quickconnect' => + 'direct' => true + + , + 'co' => + 'arts' => true, + 'com' => + 'blogspot' => true + , + 'edu' => true, + 'firm' => true, + 'gov' => true, + 'info' => true, + 'int' => true, + 'mil' => true, + 'net' => true, + 'nom' => true, + 'org' => true, + 'rec' => true, + 'web' => true, + 'carrd' => true, + 'crd' => true, + 'otap' => + '*' => true + , + 'leadpages' => true, + 'lpages' => true, + 'mypi' => true, + 'n4t' => true, + 'firewalledreplit' => + 'id' => true + , + 'repl' => + 'id' => true + , + 'supabase' => true + , + 'com' => + 'devcdnaccesso' => + '*' => true + , + 'adobeaemcloud' => + 'dev' => + '*' => true + + , + 'airkitapps' => true, + 'airkitapps-au' => true, + 'aivencloud' => true, + 'kasserver' => true, + 'amazonaws' => + 'af-south-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'ap-east-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'ap-northeast-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'ap-northeast-2' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'ap-northeast-3' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'ap-south-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'ap-south-2' => + 'execute-api' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'ap-southeast-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'ap-southeast-2' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'ap-southeast-3' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'ap-southeast-4' => + 'execute-api' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'ca-central-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'eu-central-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'eu-central-2' => + 'execute-api' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'eu-north-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'eu-south-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'eu-south-2' => + 'execute-api' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'eu-west-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-deprecated' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'eu-west-2' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'eu-west-3' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'il-central-1' => + 'execute-api' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'me-central-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'me-south-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'sa-east-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'us-east-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-deprecated' => true, + 's3-fips' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'us-east-2' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-deprecated' => true, + 's3-fips' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'us-gov-east-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'us-gov-west-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true, + 's3-object-lambda' => true, + 's3-website' => true + , + 'us-west-1' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'us-west-2' => + 'execute-api' => true, + 'emrappui-prod' => true, + 'emrnotebooks-prod' => true, + 'emrstudio-prod' => true, + 'dualstack' => + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-fips' => true, + 's3-website' => true + , + 's3' => true, + 's3-accesspoint' => true, + 's3-accesspoint-fips' => true, + 's3-deprecated' => true, + 's3-fips' => true, + 's3-object-lambda' => true, + 's3-website' => true, + 'analytics-gateway' => true, + 'aws-cloud9' => + 'webview-assets' => true + , + 'cloud9' => + 'vfs' => true, + 'webview-assets' => true + + , + 'compute' => + '*' => true + , + 'compute-1' => + '*' => true + , + 'airflow' => + 'ap-northeast-1' => + '*' => true + , + 'ap-northeast-2' => + '*' => true + , + 'ap-south-1' => + '*' => true + , + 'ap-southeast-1' => + '*' => true + , + 'ap-southeast-2' => + '*' => true + , + 'ca-central-1' => + '*' => true + , + 'eu-central-1' => + '*' => true + , + 'eu-north-1' => + '*' => true + , + 'eu-west-1' => + '*' => true + , + 'eu-west-2' => + '*' => true + , + 'eu-west-3' => + '*' => true + , + 'sa-east-1' => + '*' => true + , + 'us-east-1' => + '*' => true + , + 'us-east-2' => + '*' => true + , + 'us-west-2' => + '*' => true + + , + 's3' => true, + 's3-1' => true, + 's3-ap-east-1' => true, + 's3-ap-northeast-1' => true, + 's3-ap-northeast-2' => true, + 's3-ap-northeast-3' => true, + 's3-ap-south-1' => true, + 's3-ap-southeast-1' => true, + 's3-ap-southeast-2' => true, + 's3-ca-central-1' => true, + 's3-eu-central-1' => true, + 's3-eu-north-1' => true, + 's3-eu-west-1' => true, + 's3-eu-west-2' => true, + 's3-eu-west-3' => true, + 's3-external-1' => true, + 's3-fips-us-gov-east-1' => true, + 's3-fips-us-gov-west-1' => true, + 's3-global' => + 'accesspoint' => + 'mrap' => true + + , + 's3-me-south-1' => true, + 's3-sa-east-1' => true, + 's3-us-east-2' => true, + 's3-us-gov-east-1' => true, + 's3-us-gov-west-1' => true, + 's3-us-west-1' => true, + 's3-us-west-2' => true, + 's3-website-ap-northeast-1' => true, + 's3-website-ap-southeast-1' => true, + 's3-website-ap-southeast-2' => true, + 's3-website-eu-west-1' => true, + 's3-website-sa-east-1' => true, + 's3-website-us-east-1' => true, + 's3-website-us-gov-west-1' => true, + 's3-website-us-west-1' => true, + 's3-website-us-west-2' => true, + 'elb' => + '*' => true + + , + 'amazoncognito' => + 'af-south-1' => + 'auth' => true + , + 'ap-northeast-1' => + 'auth' => true + , + 'ap-northeast-2' => + 'auth' => true + , + 'ap-northeast-3' => + 'auth' => true + , + 'ap-south-1' => + 'auth' => true + , + 'ap-southeast-1' => + 'auth' => true + , + 'ap-southeast-2' => + 'auth' => true + , + 'ap-southeast-3' => + 'auth' => true + , + 'ca-central-1' => + 'auth' => true + , + 'eu-central-1' => + 'auth' => true + , + 'eu-north-1' => + 'auth' => true + , + 'eu-south-1' => + 'auth' => true + , + 'eu-west-1' => + 'auth' => true + , + 'eu-west-2' => + 'auth' => true + , + 'eu-west-3' => + 'auth' => true + , + 'il-central-1' => + 'auth' => true + , + 'me-south-1' => + 'auth' => true + , + 'sa-east-1' => + 'auth' => true + , + 'us-east-1' => + 'auth' => true, + 'auth-fips' => true + , + 'us-east-2' => + 'auth' => true, + 'auth-fips' => true + , + 'us-gov-west-1' => + 'auth-fips' => true + , + 'us-west-1' => + 'auth' => true, + 'auth-fips' => true + , + 'us-west-2' => + 'auth' => true, + 'auth-fips' => true + + , + 'amplifyapp' => + '*' => true + , + 'awsapprunner' => + '*' => true + , + 'elasticbeanstalk' => + 'af-south-1' => true, + 'ap-east-1' => true, + 'ap-northeast-1' => true, + 'ap-northeast-2' => true, + 'ap-northeast-3' => true, + 'ap-south-1' => true, + 'ap-southeast-1' => true, + 'ap-southeast-2' => true, + 'ap-southeast-3' => true, + 'ca-central-1' => true, + 'eu-central-1' => true, + 'eu-north-1' => true, + 'eu-south-1' => true, + 'eu-west-1' => true, + 'eu-west-2' => true, + 'eu-west-3' => true, + 'il-central-1' => true, + 'me-south-1' => true, + 'sa-east-1' => true, + 'us-east-1' => true, + 'us-east-2' => true, + 'us-gov-east-1' => true, + 'us-gov-west-1' => true, + 'us-west-1' => true, + 'us-west-2' => true + , + 'awsglobalaccelerator' => true, + 'siiites' => true, + 'appspacehosted' => true, + 'appspaceusercontent' => true, + 'on-aptible' => true, + 'myasustor' => true, + 'balena-devices' => true, + 'betainabox' => true, + 'boutir' => true, + 'bplaced' => true, + 'cafjs' => true, + 'canva-apps' => true, + 'br' => true, + 'cn' => true, + 'de' => true, + 'eu' => true, + 'jpn' => true, + 'mex' => true, + 'ru' => true, + 'sa' => true, + 'uk' => true, + 'us' => true, + 'za' => true, + 'ar' => true, + 'hu' => true, + 'kr' => true, + 'no' => true, + 'qc' => true, + 'uy' => true, + 'africa' => true, + 'gr' => true, + 'co' => true, + 'jdevcloud' => true, + 'wpdevcloud' => true, + 'cloudcontrolled' => true, + 'cloudcontrolapp' => true, + 'cf-ipfs' => true, + 'cloudflare-ipfs' => true, + 'trycloudflare' => true, + 'customer-oci' => + '*' => true, + 'oci' => + '*' => true + , + 'ocp' => + '*' => true + , + 'ocs' => + '*' => true + + , + 'dattolocal' => true, + 'dattorelay' => true, + 'dattoweb' => true, + 'mydatto' => true, + 'builtwithdark' => true, + 'datadetect' => + 'demo' => true, + 'instance' => true + , + 'ddns5' => true, + 'discordsays' => true, + 'discordsez' => true, + 'drayddns' => true, + 'dreamhosters' => true, + 'mydrobo' => true, + 'dyndns-at-home' => true, + 'dyndns-at-work' => true, + 'dyndns-blog' => true, + 'dyndns-free' => true, + 'dyndns-home' => true, + 'dyndns-ip' => true, + 'dyndns-mail' => true, + 'dyndns-office' => true, + 'dyndns-pics' => true, + 'dyndns-remote' => true, + 'dyndns-server' => true, + 'dyndns-web' => true, + 'dyndns-wiki' => true, + 'dyndns-work' => true, + 'blogdns' => true, + 'cechire' => true, + 'dnsalias' => true, + 'dnsdojo' => true, + 'doesntexist' => true, + 'dontexist' => true, + 'doomdns' => true, + 'dyn-o-saur' => true, + 'dynalias' => true, + 'est-a-la-maison' => true, + 'est-a-la-masion' => true, + 'est-le-patron' => true, + 'est-mon-blogueur' => true, + 'from-ak' => true, + 'from-al' => true, + 'from-ar' => true, + 'from-ca' => true, + 'from-ct' => true, + 'from-dc' => true, + 'from-de' => true, + 'from-fl' => true, + 'from-ga' => true, + 'from-hi' => true, + 'from-ia' => true, + 'from-id' => true, + 'from-il' => true, + 'from-in' => true, + 'from-ks' => true, + 'from-ky' => true, + 'from-ma' => true, + 'from-md' => true, + 'from-mi' => true, + 'from-mn' => true, + 'from-mo' => true, + 'from-ms' => true, + 'from-mt' => true, + 'from-nc' => true, + 'from-nd' => true, + 'from-ne' => true, + 'from-nh' => true, + 'from-nj' => true, + 'from-nm' => true, + 'from-nv' => true, + 'from-oh' => true, + 'from-ok' => true, + 'from-or' => true, + 'from-pa' => true, + 'from-pr' => true, + 'from-ri' => true, + 'from-sc' => true, + 'from-sd' => true, + 'from-tn' => true, + 'from-tx' => true, + 'from-ut' => true, + 'from-va' => true, + 'from-vt' => true, + 'from-wa' => true, + 'from-wi' => true, + 'from-wv' => true, + 'from-wy' => true, + 'getmyip' => true, + 'gotdns' => true, + 'hobby-site' => true, + 'homelinux' => true, + 'homeunix' => true, + 'iamallama' => true, + 'is-a-anarchist' => true, + 'is-a-blogger' => true, + 'is-a-bookkeeper' => true, + 'is-a-bulls-fan' => true, + 'is-a-caterer' => true, + 'is-a-chef' => true, + 'is-a-conservative' => true, + 'is-a-cpa' => true, + 'is-a-cubicle-slave' => true, + 'is-a-democrat' => true, + 'is-a-designer' => true, + 'is-a-doctor' => true, + 'is-a-financialadvisor' => true, + 'is-a-geek' => true, + 'is-a-green' => true, + 'is-a-guru' => true, + 'is-a-hard-worker' => true, + 'is-a-hunter' => true, + 'is-a-landscaper' => true, + 'is-a-lawyer' => true, + 'is-a-liberal' => true, + 'is-a-libertarian' => true, + 'is-a-llama' => true, + 'is-a-musician' => true, + 'is-a-nascarfan' => true, + 'is-a-nurse' => true, + 'is-a-painter' => true, + 'is-a-personaltrainer' => true, + 'is-a-photographer' => true, + 'is-a-player' => true, + 'is-a-republican' => true, + 'is-a-rockstar' => true, + 'is-a-socialist' => true, + 'is-a-student' => true, + 'is-a-teacher' => true, + 'is-a-techie' => true, + 'is-a-therapist' => true, + 'is-an-accountant' => true, + 'is-an-actor' => true, + 'is-an-actress' => true, + 'is-an-anarchist' => true, + 'is-an-artist' => true, + 'is-an-engineer' => true, + 'is-an-entertainer' => true, + 'is-certified' => true, + 'is-gone' => true, + 'is-into-anime' => true, + 'is-into-cars' => true, + 'is-into-cartoons' => true, + 'is-into-games' => true, + 'is-leet' => true, + 'is-not-certified' => true, + 'is-slick' => true, + 'is-uberleet' => true, + 'is-with-theband' => true, + 'isa-geek' => true, + 'isa-hockeynut' => true, + 'issmarterthanyou' => true, + 'likes-pie' => true, + 'likescandy' => true, + 'neat-url' => true, + 'saves-the-whales' => true, + 'selfip' => true, + 'sells-for-less' => true, + 'sells-for-u' => true, + 'servebbs' => true, + 'simple-url' => true, + 'space-to-rent' => true, + 'teaches-yoga' => true, + 'writesthisblog' => true, + 'digitaloceanspaces' => + '*' => true + , + 'ddnsfree' => true, + 'ddnsgeek' => true, + 'giize' => true, + 'gleeze' => true, + 'kozow' => true, + 'loseyourip' => true, + 'ooguy' => true, + 'theworkpc' => true, + 'mytuleap' => true, + 'tuleap-partners' => true, + 'encoreapi' => true, + 'evennode' => + 'eu-1' => true, + 'eu-2' => true, + 'eu-3' => true, + 'eu-4' => true, + 'us-1' => true, + 'us-2' => true, + 'us-3' => true, + 'us-4' => true + , + 'onfabrica' => true, + 'fbsbx' => + 'apps' => true + , + 'fastly-edge' => true, + 'fastly-terrarium' => true, + 'fastvps-server' => true, + 'mydobiss' => true, + 'firebaseapp' => true, + 'fldrv' => true, + 'forgeblocks' => true, + 'framercanvas' => true, + 'freebox-os' => true, + 'freeboxos' => true, + 'freemyip' => true, + 'gentapps' => true, + 'gentlentapis' => true, + 'githubusercontent' => true, + '0emm' => + '*' => true + , + 'appspot' => + 'r' => + '*' => true + + , + 'codespot' => true, + 'googleapis' => true, + 'googlecode' => true, + 'pagespeedmobilizer' => true, + 'publishproxy' => true, + 'withgoogle' => true, + 'withyoutube' => true, + 'blogspot' => true, + 'awsmppl' => true, + 'herokuapp' => true, + 'herokussl' => true, + 'impertrixcdn' => true, + 'impertrix' => true, + 'smushcdn' => true, + 'wphostedmail' => true, + 'wpmucdn' => true, + 'pixolino' => true, + 'amscompute' => true, + 'dopaas' => true, + 'hosted-by-previder' => + 'paas' => true + , + 'hosteur' => + 'rag-cloud' => true, + 'rag-cloud-ch' => true + , + 'ik-server' => + 'jcloud' => true, + 'jcloud-ver-jpc' => true + , + 'jelastic' => + 'demo' => true + , + 'kilatiron' => true, + 'massivegrid' => + 'paas' => true + , + 'wafaicloud' => + 'jed' => true, + 'lon' => true, + 'ryd' => true + , + 'joyent' => + 'cns' => + '*' => true + + , + 'ktistory' => true, + 'lpusercontent' => true, + 'lmpm' => + 'app' => true + , + 'linode' => + 'members' => true, + 'nodebalancer' => + '*' => true + + , + 'linodeobjects' => + '*' => true + , + 'linodeusercontent' => + 'ip' => true + , + 'barsycenter' => true, + 'barsyonline' => true, + 'mazeplay' => true, + 'miniserver' => true, + 'meteorapp' => + 'eu' => true + , + 'hostedpi' => true, + 'mythic-beasts' => + 'customer' => true, + 'caracal' => true, + 'fentiger' => true, + 'lynx' => true, + 'ocelot' => true, + 'oncilla' => true, + 'onza' => true, + 'sphinx' => true, + 'vs' => true, + 'x' => true, + 'yali' => true + , + 'nospamproxy' => + 'cloud' => true + , + '4u' => true, + 'nfshost' => true, + '001www' => true, + 'ddnslive' => true, + 'myiphost' => true, + 'blogsyte' => true, + 'ciscofreak' => true, + 'damnserver' => true, + 'ditchyourip' => true, + 'dnsiskinky' => true, + 'dynns' => true, + 'geekgalaxy' => true, + 'health-carereform' => true, + 'homesecuritymac' => true, + 'homesecuritypc' => true, + 'myactivedirectory' => true, + 'mysecuritycamera' => true, + 'net-freaks' => true, + 'onthewifi' => true, + 'point2this' => true, + 'quicksytes' => true, + 'securitytactics' => true, + 'serveexchange' => true, + 'servehumour' => true, + 'servep2p' => true, + 'servesarcasm' => true, + 'stufftoread' => true, + 'unusualperson' => true, + 'workisboring' => true, + '3utilities' => true, + 'ddnsking' => true, + 'myvnc' => true, + 'servebeer' => true, + 'servecounterstrike' => true, + 'serveftp' => true, + 'servegame' => true, + 'servehalflife' => true, + 'servehttp' => true, + 'serveirc' => true, + 'servemp3' => true, + 'servepics' => true, + 'servequake' => true, + 'observableusercontent' => + 'static' => true + , + 'simplesite' => true, + 'orsites' => true, + 'operaunite' => true, + 'authgear-staging' => true, + 'authgearapps' => true, + 'skygearapp' => true, + 'outsystemscloud' => true, + 'ownprovider' => true, + 'pgfog' => true, + 'pagefrontapp' => true, + 'pagexl' => true, + 'paywhirl' => + '*' => true + , + 'gotpantheon' => true, + 'platter-app' => true, + 'pleskns' => true, + 'postman-echo' => true, + 'prgmr' => + 'xen' => true + , + 'pythonanywhere' => + 'eu' => true + , + 'qualifioapp' => true, + 'ladesk' => true, + 'qbuser' => true, + 'qa2' => true, + 'dev-myqnapcloud' => true, + 'alpha-myqnapcloud' => true, + 'myqnapcloud' => true, + 'quipelements' => + '*' => true + , + 'rackmaze' => true, + 'rhcloud' => true, + 'render' => + 'app' => true + , + 'onrender' => true, + '180r' => true, + 'dojin' => true, + 'sakuratan' => true, + 'sakuraweb' => true, + 'x0' => true, + 'code' => + 'builder' => + '*' => true + , + 'dev-builder' => + '*' => true + , + 'stg-builder' => + '*' => true + + , + 'logoip' => true, + 'scrysec' => true, + 'firewall-gateway' => true, + 'myshopblocks' => true, + 'myshopify' => true, + 'shopitsite' => true, + '1kapp' => true, + 'appchizi' => true, + 'applinzi' => true, + 'sinaapp' => true, + 'vipsinaapp' => true, + 'bounty-full' => + 'alpha' => true, + 'beta' => true + , + 'streamlitapp' => true, + 'try-snowplow' => true, + 'stackhero-network' => true, + 'playstation-cloud' => true, + 'myspreadshop' => true, + 'stdlib' => + 'api' => true + , + 'temp-dns' => true, + 'dsmynas' => true, + 'familyds' => true, + 'mytabit' => true, + 'tb-hosting' => + 'site' => true + , + 'reservd' => true, + 'thingdustdata' => true, + 'bloxcms' => true, + 'townnews-staging' => true, + 'typeform' => + 'pro' => true + , + 'hk' => true, + 'it' => true, + 'vultrobjects' => + '*' => true + , + 'wafflecell' => true, + 'reserve-online' => true, + 'hotelwithflight' => true, + 'remotewd' => true, + 'wiardweb' => + 'pages' => true + , + 'messwithdns' => true, + 'woltlab-demo' => true, + 'wpenginepowered' => + 'js' => true + , + 'wixsite' => true, + 'xnbay' => + 'u2' => true, + 'u2-local' => true + , + 'yolasite' => true + , + 'coop' => true, + 'cr' => + 'ac' => true, + 'co' => true, + 'ed' => true, + 'fi' => true, + 'go' => true, + 'or' => true, + 'sa' => true + , + 'cu' => + 'com' => true, + 'edu' => true, + 'org' => true, + 'net' => true, + 'gov' => true, + 'inf' => true + , + 'cv' => + 'com' => true, + 'edu' => true, + 'int' => true, + 'nome' => true, + 'org' => true, + 'blogspot' => true + , + 'cw' => + 'com' => true, + 'edu' => true, + 'net' => true, + 'org' => true + , + 'cx' => + 'gov' => true, + 'ath' => true, + 'info' => true + , + 'cy' => + 'ac' => true, + 'biz' => true, + 'com' => + 'blogspot' => true, + 'scaleforce' => + 'j' => true + + , + 'ekloges' => true, + 'gov' => true, + 'ltd' => true, + 'mil' => true, + 'net' => true, + 'org' => true, + 'press' => true, + 'pro' => true, + 'tm' => true + , + 'cz' => + 'co' => true, + 'realm' => true, + 'e4' => true, + 'blogspot' => true, + 'metacentrum' => + 'cloud' => + '*' => true + , + 'custom' => true + , + 'muni' => + 'cloud' => + 'flt' => true, + 'usr' => true + + + , + 'de' => + 'bplaced' => true, + 'square7' => true, + 'com' => true, + 'cosidns' => + 'dyn' => true + , + 'dynamisches-dns' => true, + 'dnsupdater' => true, + 'internet-dns' => true, + 'l-o-g-i-n' => true, + 'dnshome' => true, + 'fuettertdasnetz' => true, + 'isteingeek' => true, + 'istmein' => true, + 'lebtimnetz' => true, + 'leitungsen' => true, + 'traeumtgerade' => true, + 'ddnss' => + 'dyn' => true, + 'dyndns' => true + , + 'dyndns1' => true, + 'dyn-ip24' => true, + 'home-webserver' => + 'dyn' => true + , + 'myhome-server' => true, + 'frusky' => + '*' => true + , + 'goip' => true, + 'blogspot' => true, + 'günstigbestellen' => true, + 'günstigliefern' => true, + 'hs-heilbronn' => + 'it' => + 'pages' => true + + , + 'dyn-berlin' => true, + 'in-berlin' => true, + 'in-brb' => true, + 'in-butter' => true, + 'in-dsl' => true, + 'in-vpn' => true, + 'iservschule' => true, + 'mein-iserv' => true, + 'schulplattform' => true, + 'schulserver' => true, + 'test-iserv' => true, + 'keymachine' => true, + 'git-repos' => true, + 'lcube-server' => true, + 'svn-repos' => true, + 'barsy' => true, + '123webseite' => true, + 'logoip' => true, + 'firewall-gateway' => true, + 'my-gateway' => true, + 'my-router' => true, + 'spdns' => true, + 'speedpartner' => + 'customer' => true + , + 'myspreadshop' => true, + 'taifun-dns' => true, + '12hp' => true, + '2ix' => true, + '4lima' => true, + 'lima-city' => true, + 'dd-dns' => true, + 'dray-dns' => true, + 'draydns' => true, + 'dyn-vpn' => true, + 'dynvpn' => true, + 'mein-vigor' => true, + 'my-vigor' => true, + 'my-wan' => true, + 'syno-ds' => true, + 'synology-diskstation' => true, + 'synology-ds' => true, + 'uberspace' => + '*' => true + , + 'virtualuser' => true, + 'virtual-user' => true, + 'community-pro' => true, + 'diskussionsbereich' => true + , + 'dj' => true, + 'dk' => + 'biz' => true, + 'co' => true, + 'firm' => true, + 'reg' => true, + 'store' => true, + 'blogspot' => true, + '123hjemmeside' => true, + 'myspreadshop' => true + , + 'dm' => + 'com' => true, + 'net' => true, + 'org' => true, + 'edu' => true, + 'gov' => true + , + 'do' => + 'art' => true, + 'com' => true, + 'edu' => true, + 'gob' => true, + 'gov' => true, + 'mil' => true, + 'net' => true, + 'org' => true, + 'sld' => true, + 'web' => true + , + 'dz' => + 'art' => true, + 'asso' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'org' => true, + 'net' => true, + 'pol' => true, + 'soc' => true, + 'tm' => true + , + 'ec' => + 'com' => true, + 'info' => true, + 'net' => true, + 'fin' => true, + 'k12' => true, + 'med' => true, + 'pro' => true, + 'org' => true, + 'edu' => true, + 'gov' => true, + 'gob' => true, + 'mil' => true, + 'base' => true, + 'official' => true + , + 'edu' => + 'rit' => + 'git-pages' => true + + , + 'ee' => + 'edu' => true, + 'gov' => true, + 'riik' => true, + 'lib' => true, + 'med' => true, + 'com' => + 'blogspot' => true + , + 'pri' => true, + 'aip' => true, + 'org' => true, + 'fie' => true + , + 'eg' => + 'com' => + 'blogspot' => true + , + 'edu' => true, + 'eun' => true, + 'gov' => true, + 'mil' => true, + 'name' => true, + 'net' => true, + 'org' => true, + 'sci' => true + , + 'er' => + '*' => true + , + 'es' => + 'com' => + 'blogspot' => true + , + 'nom' => true, + 'org' => true, + 'gob' => true, + 'edu' => true, + '123miweb' => true, + 'myspreadshop' => true + , + 'et' => + 'com' => true, + 'gov' => true, + 'org' => true, + 'edu' => true, + 'biz' => true, + 'name' => true, + 'info' => true, + 'net' => true + , + 'eu' => + 'airkitapps' => true, + 'mycd' => true, + 'cloudns' => true, + 'dogado' => + 'jelastic' => true + , + 'barsy' => true, + 'wellbeingzone' => true, + 'spdns' => true, + 'transurl' => + '*' => true + , + 'diskstation' => true + , + 'fi' => + 'aland' => true, + 'dy' => true, + 'blogspot' => true, + 'häkkinen' => true, + 'iki' => true, + 'cloudplatform' => + 'fi' => true + , + 'datacenter' => + 'demo' => true, + 'paas' => true + , + 'kapsi' => true, + '123kotisivu' => true, + 'myspreadshop' => true + , + 'fj' => + 'ac' => true, + 'biz' => true, + 'com' => true, + 'gov' => true, + 'info' => true, + 'mil' => true, + 'name' => true, + 'net' => true, + 'org' => true, + 'pro' => true + , + 'fk' => + '*' => true + , + 'fm' => + 'com' => true, + 'edu' => true, + 'net' => true, + 'org' => true, + 'radio' => true, + 'user' => + '*' => true + + , + 'fo' => true, + 'fr' => + 'asso' => true, + 'com' => true, + 'gouv' => true, + 'nom' => true, + 'prd' => true, + 'tm' => true, + 'avoues' => true, + 'cci' => true, + 'greta' => true, + 'huissier-justice' => true, + 'en-root' => true, + 'fbx-os' => true, + 'fbxos' => true, + 'freebox-os' => true, + 'freeboxos' => true, + 'blogspot' => true, + 'goupile' => true, + '123siteweb' => true, + 'on-web' => true, + 'chirurgiens-dentistes-en-france' => true, + 'dedibox' => true, + 'aeroport' => true, + 'avocat' => true, + 'chambagri' => true, + 'chirurgiens-dentistes' => true, + 'experts-comptables' => true, + 'medecin' => true, + 'notaires' => true, + 'pharmacien' => true, + 'port' => true, + 'veterinaire' => true, + 'myspreadshop' => true, + 'ynh' => true + , + 'ga' => true, + 'gb' => true, + 'gd' => + 'edu' => true, + 'gov' => true + , + 'ge' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'org' => true, + 'mil' => true, + 'net' => true, + 'pvt' => true + , + 'gf' => true, + 'gg' => + 'co' => true, + 'net' => true, + 'org' => true, + 'kaas' => true, + 'cya' => true, + 'panel' => + 'daemon' => true + + , + 'gh' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'org' => true, + 'mil' => true + , + 'gi' => + 'com' => true, + 'ltd' => true, + 'gov' => true, + 'mod' => true, + 'edu' => true, + 'org' => true + , + 'gl' => + 'co' => true, + 'com' => true, + 'edu' => true, + 'net' => true, + 'org' => true, + 'biz' => true, + 'xx' => true + , + 'gm' => true, + 'gn' => + 'ac' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'org' => true, + 'net' => true + , + 'gov' => true, + 'gp' => + 'com' => true, + 'net' => true, + 'mobi' => true, + 'edu' => true, + 'org' => true, + 'asso' => true, + 'app' => true + , + 'gq' => true, + 'gr' => + 'com' => true, + 'edu' => true, + 'net' => true, + 'org' => true, + 'gov' => true, + 'blogspot' => true, + 'simplesite' => true + , + 'gs' => true, + 'gt' => + 'com' => true, + 'edu' => true, + 'gob' => true, + 'ind' => true, + 'mil' => true, + 'net' => true, + 'org' => true, + 'blog' => true, + 'de' => true, + 'to' => true + , + 'gu' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'guam' => true, + 'info' => true, + 'net' => true, + 'org' => true, + 'web' => true + , + 'gw' => true, + 'gy' => + 'co' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'net' => true, + 'org' => true, + 'be' => true + , + 'hk' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'idv' => true, + 'net' => true, + 'org' => true, + '公司' => true, + '教育' => true, + '敎育' => true, + '政府' => true, + '個人' => true, + '个人' => true, + '箇人' => true, + '網络' => true, + '网络' => true, + '组織' => true, + '網絡' => true, + '网絡' => true, + '组织' => true, + '組織' => true, + '組织' => true, + 'blogspot' => true, + 'secaas' => true, + 'ltd' => true, + 'inc' => true + , + 'hm' => true, + 'hn' => + 'com' => true, + 'edu' => true, + 'org' => true, + 'net' => true, + 'mil' => true, + 'gob' => true, + 'cc' => true + , + 'hr' => + 'iz' => true, + 'from' => true, + 'name' => true, + 'com' => true, + 'blogspot' => true, + 'free' => true + , + 'ht' => + 'com' => true, + 'shop' => true, + 'firm' => true, + 'info' => true, + 'adult' => true, + 'net' => true, + 'pro' => true, + 'org' => true, + 'med' => true, + 'art' => true, + 'coop' => true, + 'pol' => true, + 'asso' => true, + 'edu' => true, + 'rel' => true, + 'gouv' => true, + 'perso' => true + , + 'hu' => + 'co' => true, + 'info' => true, + 'org' => true, + 'priv' => true, + 'sport' => true, + 'tm' => true, + '2000' => true, + 'agrar' => true, + 'bolt' => true, + 'casino' => true, + 'city' => true, + 'erotica' => true, + 'erotika' => true, + 'film' => true, + 'forum' => true, + 'games' => true, + 'hotel' => true, + 'ingatlan' => true, + 'jogasz' => true, + 'konyvelo' => true, + 'lakas' => true, + 'media' => true, + 'news' => true, + 'reklam' => true, + 'sex' => true, + 'shop' => true, + 'suli' => true, + 'szex' => true, + 'tozsde' => true, + 'utazas' => true, + 'video' => true, + 'blogspot' => true + , + 'id' => + 'ac' => true, + 'biz' => true, + 'co' => + 'blogspot' => true + , + 'desa' => true, + 'go' => true, + 'mil' => true, + 'my' => + 'rss' => + '*' => true + + , + 'net' => true, + 'or' => true, + 'ponpes' => true, + 'sch' => true, + 'web' => true, + 'flap' => true, + 'forte' => true + , + 'ie' => + 'gov' => true, + 'blogspot' => true, + 'myspreadshop' => true + , + 'il' => + 'ac' => true, + 'co' => + 'ravpage' => true, + 'blogspot' => true, + 'tabitorder' => true, + 'mytabit' => true + , + 'gov' => true, + 'idf' => true, + 'k12' => true, + 'muni' => true, + 'net' => true, + 'org' => true + , + 'ישראל' => + 'אקדמיה' => true, + 'ישוב' => true, + 'צהל' => true, + 'ממשל' => true + , + 'im' => + 'ac' => true, + 'co' => + 'ltd' => true, + 'plc' => true + , + 'com' => true, + 'net' => true, + 'org' => true, + 'tt' => true, + 'tv' => true, + 'ro' => true + , + 'in' => + '5g' => true, + '6g' => true, + 'ac' => true, + 'ai' => true, + 'am' => true, + 'bihar' => true, + 'biz' => true, + 'business' => true, + 'ca' => true, + 'cn' => true, + 'co' => true, + 'com' => true, + 'coop' => true, + 'cs' => true, + 'delhi' => true, + 'dr' => true, + 'edu' => true, + 'er' => true, + 'firm' => true, + 'gen' => true, + 'gov' => true, + 'gujarat' => true, + 'ind' => true, + 'info' => true, + 'int' => true, + 'internet' => true, + 'io' => true, + 'me' => true, + 'mil' => true, + 'net' => true, + 'nic' => true, + 'org' => true, + 'pg' => true, + 'post' => true, + 'pro' => true, + 'res' => true, + 'travel' => true, + 'tv' => true, + 'uk' => true, + 'up' => true, + 'us' => true, + 'web' => true, + 'cloudns' => true, + 'blogspot' => true, + 'barsy' => true, + 'supabase' => true + , + 'info' => + 'cloudns' => true, + 'dynamic-dns' => true, + 'dyndns' => true, + 'barrel-of-knowledge' => true, + 'barrell-of-knowledge' => true, + 'for-our' => true, + 'groks-the' => true, + 'groks-this' => true, + 'here-for-more' => true, + 'knowsitall' => true, + 'selfip' => true, + 'webhop' => true, + 'barsy' => true, + 'mayfirst' => true, + 'forumz' => true, + 'nsupdate' => true, + 'dvrcam' => true, + 'ilovecollege' => true, + 'no-ip' => true, + 'dnsupdate' => true, + 'v-info' => true + , + 'int' => + 'eu' => true + , + 'io' => + 'com' => true, + 'on-acorn' => + '*' => true + , + 'apigee' => true, + 'b-data' => true, + 'backplaneapp' => true, + 'banzaicloud' => + 'app' => true, + 'backyards' => + '*' => true + + , + 'beagleboard' => true, + 'bitbucket' => true, + 'bluebite' => true, + 'boxfuse' => true, + 'browsersafetymark' => true, + 'bigv' => + 'uk0' => true + , + 'cleverapps' => true, + 'dappnode' => + 'dyndns' => true + , + 'dedyn' => true, + 'drud' => true, + 'definima' => true, + 'fh-muenster' => true, + 'shw' => true, + 'forgerock' => + 'id' => true + , + 'ghost' => true, + 'github' => true, + 'gitlab' => true, + 'lolipop' => true, + 'hasura-app' => true, + 'hostyhosting' => true, + 'moonscale' => + '*' => true + , + 'beebyte' => + 'paas' => true + , + 'beebyteapp' => + 'sekd1' => true + , + 'jele' => true, + 'unispace' => + 'cloud-fr1' => true + , + 'webthings' => true, + 'loginline' => true, + 'barsy' => true, + 'azurecontainer' => + '*' => true + , + 'ngrok' => + 'ap' => true, + 'au' => true, + 'eu' => true, + 'in' => true, + 'jp' => true, + 'sa' => true, + 'us' => true + , + 'nodeart' => + 'stage' => true + , + 'nid' => true, + 'pantheonsite' => true, + 'dyn53' => true, + 'pstmn' => + 'mock' => true + , + 'protonet' => true, + 'qoto' => true, + 'qcx' => + 'sys' => + '*' => true + + , + 'vaporcloud' => true, + 'vbrplsbx' => + 'g' => true + , + 'on-k3s' => + '*' => true + , + 'on-rio' => + '*' => true + , + 'readthedocs' => true, + 'resindevice' => true, + 'resinstaging' => + 'devices' => true + , + 'hzc' => true, + 'sandcats' => true, + 'shiftcrypto' => true, + 'shiftedit' => true, + 'mo-siemens' => true, + 'musician' => true, + 'lair' => + 'apps' => true + , + 'stolos' => + '*' => true + , + 'spacekit' => true, + 'utwente' => true, + 's5y' => + '*' => true + , + 'edugit' => true, + 'telebit' => true, + 'thingdust' => + 'dev' => + 'cust' => true, + 'reservd' => true + , + 'disrec' => + 'cust' => true, + 'reservd' => true + , + 'prod' => + 'cust' => true + , + 'testing' => + 'cust' => true, + 'reservd' => true + + , + 'tickets' => true, + 'upli' => true, + '2038' => true, + 'wedeploy' => true, + 'editorx' => true, + 'wixstudio' => true, + 'basicserver' => true, + 'virtualserver' => true + , + 'iq' => + 'gov' => true, + 'edu' => true, + 'mil' => true, + 'com' => true, + 'org' => true, + 'net' => true + , + 'ir' => + 'ac' => true, + 'co' => true, + 'gov' => true, + 'id' => true, + 'net' => true, + 'org' => true, + 'sch' => true, + 'ایران' => true, + 'ايران' => true + , + 'is' => + 'net' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'org' => true, + 'int' => true, + 'cupcake' => true, + 'blogspot' => true + , + 'it' => + 'gov' => true, + 'edu' => true, + 'abr' => true, + 'abruzzo' => true, + 'aosta-valley' => true, + 'aostavalley' => true, + 'bas' => true, + 'basilicata' => true, + 'cal' => true, + 'calabria' => true, + 'cam' => true, + 'campania' => true, + 'emilia-romagna' => true, + 'emiliaromagna' => true, + 'emr' => true, + 'friuli-v-giulia' => true, + 'friuli-ve-giulia' => true, + 'friuli-vegiulia' => true, + 'friuli-venezia-giulia' => true, + 'friuli-veneziagiulia' => true, + 'friuli-vgiulia' => true, + 'friuliv-giulia' => true, + 'friulive-giulia' => true, + 'friulivegiulia' => true, + 'friulivenezia-giulia' => true, + 'friuliveneziagiulia' => true, + 'friulivgiulia' => true, + 'fvg' => true, + 'laz' => true, + 'lazio' => true, + 'lig' => true, + 'liguria' => true, + 'lom' => true, + 'lombardia' => true, + 'lombardy' => true, + 'lucania' => true, + 'mar' => true, + 'marche' => true, + 'mol' => true, + 'molise' => true, + 'piedmont' => true, + 'piemonte' => true, + 'pmn' => true, + 'pug' => true, + 'puglia' => true, + 'sar' => true, + 'sardegna' => true, + 'sardinia' => true, + 'sic' => true, + 'sicilia' => true, + 'sicily' => true, + 'taa' => true, + 'tos' => true, + 'toscana' => true, + 'trentin-sud-tirol' => true, + 'trentin-süd-tirol' => true, + 'trentin-sudtirol' => true, + 'trentin-südtirol' => true, + 'trentin-sued-tirol' => true, + 'trentin-suedtirol' => true, + 'trentino-a-adige' => true, + 'trentino-aadige' => true, + 'trentino-alto-adige' => true, + 'trentino-altoadige' => true, + 'trentino-s-tirol' => true, + 'trentino-stirol' => true, + 'trentino-sud-tirol' => true, + 'trentino-süd-tirol' => true, + 'trentino-sudtirol' => true, + 'trentino-südtirol' => true, + 'trentino-sued-tirol' => true, + 'trentino-suedtirol' => true, + 'trentino' => true, + 'trentinoa-adige' => true, + 'trentinoaadige' => true, + 'trentinoalto-adige' => true, + 'trentinoaltoadige' => true, + 'trentinos-tirol' => true, + 'trentinostirol' => true, + 'trentinosud-tirol' => true, + 'trentinosüd-tirol' => true, + 'trentinosudtirol' => true, + 'trentinosüdtirol' => true, + 'trentinosued-tirol' => true, + 'trentinosuedtirol' => true, + 'trentinsud-tirol' => true, + 'trentinsüd-tirol' => true, + 'trentinsudtirol' => true, + 'trentinsüdtirol' => true, + 'trentinsued-tirol' => true, + 'trentinsuedtirol' => true, + 'tuscany' => true, + 'umb' => true, + 'umbria' => true, + 'val-d-aosta' => true, + 'val-daosta' => true, + 'vald-aosta' => true, + 'valdaosta' => true, + 'valle-aosta' => true, + 'valle-d-aosta' => true, + 'valle-daosta' => true, + 'valleaosta' => true, + 'valled-aosta' => true, + 'valledaosta' => true, + 'vallee-aoste' => true, + 'vallée-aoste' => true, + 'vallee-d-aoste' => true, + 'vallée-d-aoste' => true, + 'valleeaoste' => true, + 'valléeaoste' => true, + 'valleedaoste' => true, + 'valléedaoste' => true, + 'vao' => true, + 'vda' => true, + 'ven' => true, + 'veneto' => true, + 'ag' => true, + 'agrigento' => true, + 'al' => true, + 'alessandria' => true, + 'alto-adige' => true, + 'altoadige' => true, + 'an' => true, + 'ancona' => true, + 'andria-barletta-trani' => true, + 'andria-trani-barletta' => true, + 'andriabarlettatrani' => true, + 'andriatranibarletta' => true, + 'ao' => true, + 'aosta' => true, + 'aoste' => true, + 'ap' => true, + 'aq' => true, + 'aquila' => true, + 'ar' => true, + 'arezzo' => true, + 'ascoli-piceno' => true, + 'ascolipiceno' => true, + 'asti' => true, + 'at' => true, + 'av' => true, + 'avellino' => true, + 'ba' => true, + 'balsan-sudtirol' => true, + 'balsan-südtirol' => true, + 'balsan-suedtirol' => true, + 'balsan' => true, + 'bari' => true, + 'barletta-trani-andria' => true, + 'barlettatraniandria' => true, + 'belluno' => true, + 'benevento' => true, + 'bergamo' => true, + 'bg' => true, + 'bi' => true, + 'biella' => true, + 'bl' => true, + 'bn' => true, + 'bo' => true, + 'bologna' => true, + 'bolzano-altoadige' => true, + 'bolzano' => true, + 'bozen-sudtirol' => true, + 'bozen-südtirol' => true, + 'bozen-suedtirol' => true, + 'bozen' => true, + 'br' => true, + 'brescia' => true, + 'brindisi' => true, + 'bs' => true, + 'bt' => true, + 'bulsan-sudtirol' => true, + 'bulsan-südtirol' => true, + 'bulsan-suedtirol' => true, + 'bulsan' => true, + 'bz' => true, + 'ca' => true, + 'cagliari' => true, + 'caltanissetta' => true, + 'campidano-medio' => true, + 'campidanomedio' => true, + 'campobasso' => true, + 'carbonia-iglesias' => true, + 'carboniaiglesias' => true, + 'carrara-massa' => true, + 'carraramassa' => true, + 'caserta' => true, + 'catania' => true, + 'catanzaro' => true, + 'cb' => true, + 'ce' => true, + 'cesena-forli' => true, + 'cesena-forlì' => true, + 'cesenaforli' => true, + 'cesenaforlì' => true, + 'ch' => true, + 'chieti' => true, + 'ci' => true, + 'cl' => true, + 'cn' => true, + 'co' => true, + 'como' => true, + 'cosenza' => true, + 'cr' => true, + 'cremona' => true, + 'crotone' => true, + 'cs' => true, + 'ct' => true, + 'cuneo' => true, + 'cz' => true, + 'dell-ogliastra' => true, + 'dellogliastra' => true, + 'en' => true, + 'enna' => true, + 'fc' => true, + 'fe' => true, + 'fermo' => true, + 'ferrara' => true, + 'fg' => true, + 'fi' => true, + 'firenze' => true, + 'florence' => true, + 'fm' => true, + 'foggia' => true, + 'forli-cesena' => true, + 'forlì-cesena' => true, + 'forlicesena' => true, + 'forlìcesena' => true, + 'fr' => true, + 'frosinone' => true, + 'ge' => true, + 'genoa' => true, + 'genova' => true, + 'go' => true, + 'gorizia' => true, + 'gr' => true, + 'grosseto' => true, + 'iglesias-carbonia' => true, + 'iglesiascarbonia' => true, + 'im' => true, + 'imperia' => true, + 'is' => true, + 'isernia' => true, + 'kr' => true, + 'la-spezia' => true, + 'laquila' => true, + 'laspezia' => true, + 'latina' => true, + 'lc' => true, + 'le' => true, + 'lecce' => true, + 'lecco' => true, + 'li' => true, + 'livorno' => true, + 'lo' => true, + 'lodi' => true, + 'lt' => true, + 'lu' => true, + 'lucca' => true, + 'macerata' => true, + 'mantova' => true, + 'massa-carrara' => true, + 'massacarrara' => true, + 'matera' => true, + 'mb' => true, + 'mc' => true, + 'me' => true, + 'medio-campidano' => true, + 'mediocampidano' => true, + 'messina' => true, + 'mi' => true, + 'milan' => true, + 'milano' => true, + 'mn' => true, + 'mo' => true, + 'modena' => true, + 'monza-brianza' => true, + 'monza-e-della-brianza' => true, + 'monza' => true, + 'monzabrianza' => true, + 'monzaebrianza' => true, + 'monzaedellabrianza' => true, + 'ms' => true, + 'mt' => true, + 'na' => true, + 'naples' => true, + 'napoli' => true, + 'no' => true, + 'novara' => true, + 'nu' => true, + 'nuoro' => true, + 'og' => true, + 'ogliastra' => true, + 'olbia-tempio' => true, + 'olbiatempio' => true, + 'or' => true, + 'oristano' => true, + 'ot' => true, + 'pa' => true, + 'padova' => true, + 'padua' => true, + 'palermo' => true, + 'parma' => true, + 'pavia' => true, + 'pc' => true, + 'pd' => true, + 'pe' => true, + 'perugia' => true, + 'pesaro-urbino' => true, + 'pesarourbino' => true, + 'pescara' => true, + 'pg' => true, + 'pi' => true, + 'piacenza' => true, + 'pisa' => true, + 'pistoia' => true, + 'pn' => true, + 'po' => true, + 'pordenone' => true, + 'potenza' => true, + 'pr' => true, + 'prato' => true, + 'pt' => true, + 'pu' => true, + 'pv' => true, + 'pz' => true, + 'ra' => true, + 'ragusa' => true, + 'ravenna' => true, + 'rc' => true, + 're' => true, + 'reggio-calabria' => true, + 'reggio-emilia' => true, + 'reggiocalabria' => true, + 'reggioemilia' => true, + 'rg' => true, + 'ri' => true, + 'rieti' => true, + 'rimini' => true, + 'rm' => true, + 'rn' => true, + 'ro' => true, + 'roma' => true, + 'rome' => true, + 'rovigo' => true, + 'sa' => true, + 'salerno' => true, + 'sassari' => true, + 'savona' => true, + 'si' => true, + 'siena' => true, + 'siracusa' => true, + 'so' => true, + 'sondrio' => true, + 'sp' => true, + 'sr' => true, + 'ss' => true, + 'suedtirol' => true, + 'südtirol' => true, + 'sv' => true, + 'ta' => true, + 'taranto' => true, + 'te' => true, + 'tempio-olbia' => true, + 'tempioolbia' => true, + 'teramo' => true, + 'terni' => true, + 'tn' => true, + 'to' => true, + 'torino' => true, + 'tp' => true, + 'tr' => true, + 'trani-andria-barletta' => true, + 'trani-barletta-andria' => true, + 'traniandriabarletta' => true, + 'tranibarlettaandria' => true, + 'trapani' => true, + 'trento' => true, + 'treviso' => true, + 'trieste' => true, + 'ts' => true, + 'turin' => true, + 'tv' => true, + 'ud' => true, + 'udine' => true, + 'urbino-pesaro' => true, + 'urbinopesaro' => true, + 'va' => true, + 'varese' => true, + 'vb' => true, + 'vc' => true, + 've' => true, + 'venezia' => true, + 'venice' => true, + 'verbania' => true, + 'vercelli' => true, + 'verona' => true, + 'vi' => true, + 'vibo-valentia' => true, + 'vibovalentia' => true, + 'vicenza' => true, + 'viterbo' => true, + 'vr' => true, + 'vs' => true, + 'vt' => true, + 'vv' => true, + 'blogspot' => true, + 'ibxos' => true, + 'iliadboxos' => true, + 'neen' => + 'jc' => true + , + 'tim' => + 'open' => + 'jelastic' => + 'cloud' => true + + + , + '16-b' => true, + '32-b' => true, + '64-b' => true, + '123homepage' => true, + 'myspreadshop' => true, + 'syncloud' => true + , + 'je' => + 'co' => true, + 'net' => true, + 'org' => true, + 'of' => true + , + 'jm' => + '*' => true + , + 'jo' => + 'com' => true, + 'org' => true, + 'net' => true, + 'edu' => true, + 'sch' => true, + 'gov' => true, + 'mil' => true, + 'name' => true + , + 'jobs' => true, + 'jp' => + 'ac' => true, + 'ad' => true, + 'co' => true, + 'ed' => true, + 'go' => true, + 'gr' => true, + 'lg' => true, + 'ne' => + 'aseinet' => + 'user' => true + , + 'gehirn' => true, + 'ivory' => true, + 'mail-box' => true, + 'mints' => true, + 'mokuren' => true, + 'opal' => true, + 'sakura' => true, + 'sumomo' => true, + 'topaz' => true + , + 'or' => true, + 'aichi' => + 'aisai' => true, + 'ama' => true, + 'anjo' => true, + 'asuke' => true, + 'chiryu' => true, + 'chita' => true, + 'fuso' => true, + 'gamagori' => true, + 'handa' => true, + 'hazu' => true, + 'hekinan' => true, + 'higashiura' => true, + 'ichinomiya' => true, + 'inazawa' => true, + 'inuyama' => true, + 'isshiki' => true, + 'iwakura' => true, + 'kanie' => true, + 'kariya' => true, + 'kasugai' => true, + 'kira' => true, + 'kiyosu' => true, + 'komaki' => true, + 'konan' => true, + 'kota' => true, + 'mihama' => true, + 'miyoshi' => true, + 'nishio' => true, + 'nisshin' => true, + 'obu' => true, + 'oguchi' => true, + 'oharu' => true, + 'okazaki' => true, + 'owariasahi' => true, + 'seto' => true, + 'shikatsu' => true, + 'shinshiro' => true, + 'shitara' => true, + 'tahara' => true, + 'takahama' => true, + 'tobishima' => true, + 'toei' => true, + 'togo' => true, + 'tokai' => true, + 'tokoname' => true, + 'toyoake' => true, + 'toyohashi' => true, + 'toyokawa' => true, + 'toyone' => true, + 'toyota' => true, + 'tsushima' => true, + 'yatomi' => true + , + 'akita' => + 'akita' => true, + 'daisen' => true, + 'fujisato' => true, + 'gojome' => true, + 'hachirogata' => true, + 'happou' => true, + 'higashinaruse' => true, + 'honjo' => true, + 'honjyo' => true, + 'ikawa' => true, + 'kamikoani' => true, + 'kamioka' => true, + 'katagami' => true, + 'kazuno' => true, + 'kitaakita' => true, + 'kosaka' => true, + 'kyowa' => true, + 'misato' => true, + 'mitane' => true, + 'moriyoshi' => true, + 'nikaho' => true, + 'noshiro' => true, + 'odate' => true, + 'oga' => true, + 'ogata' => true, + 'semboku' => true, + 'yokote' => true, + 'yurihonjo' => true + , + 'aomori' => + 'aomori' => true, + 'gonohe' => true, + 'hachinohe' => true, + 'hashikami' => true, + 'hiranai' => true, + 'hirosaki' => true, + 'itayanagi' => true, + 'kuroishi' => true, + 'misawa' => true, + 'mutsu' => true, + 'nakadomari' => true, + 'noheji' => true, + 'oirase' => true, + 'owani' => true, + 'rokunohe' => true, + 'sannohe' => true, + 'shichinohe' => true, + 'shingo' => true, + 'takko' => true, + 'towada' => true, + 'tsugaru' => true, + 'tsuruta' => true + , + 'chiba' => + 'abiko' => true, + 'asahi' => true, + 'chonan' => true, + 'chosei' => true, + 'choshi' => true, + 'chuo' => true, + 'funabashi' => true, + 'futtsu' => true, + 'hanamigawa' => true, + 'ichihara' => true, + 'ichikawa' => true, + 'ichinomiya' => true, + 'inzai' => true, + 'isumi' => true, + 'kamagaya' => true, + 'kamogawa' => true, + 'kashiwa' => true, + 'katori' => true, + 'katsuura' => true, + 'kimitsu' => true, + 'kisarazu' => true, + 'kozaki' => true, + 'kujukuri' => true, + 'kyonan' => true, + 'matsudo' => true, + 'midori' => true, + 'mihama' => true, + 'minamiboso' => true, + 'mobara' => true, + 'mutsuzawa' => true, + 'nagara' => true, + 'nagareyama' => true, + 'narashino' => true, + 'narita' => true, + 'noda' => true, + 'oamishirasato' => true, + 'omigawa' => true, + 'onjuku' => true, + 'otaki' => true, + 'sakae' => true, + 'sakura' => true, + 'shimofusa' => true, + 'shirako' => true, + 'shiroi' => true, + 'shisui' => true, + 'sodegaura' => true, + 'sosa' => true, + 'tako' => true, + 'tateyama' => true, + 'togane' => true, + 'tohnosho' => true, + 'tomisato' => true, + 'urayasu' => true, + 'yachimata' => true, + 'yachiyo' => true, + 'yokaichiba' => true, + 'yokoshibahikari' => true, + 'yotsukaido' => true + , + 'ehime' => + 'ainan' => true, + 'honai' => true, + 'ikata' => true, + 'imabari' => true, + 'iyo' => true, + 'kamijima' => true, + 'kihoku' => true, + 'kumakogen' => true, + 'masaki' => true, + 'matsuno' => true, + 'matsuyama' => true, + 'namikata' => true, + 'niihama' => true, + 'ozu' => true, + 'saijo' => true, + 'seiyo' => true, + 'shikokuchuo' => true, + 'tobe' => true, + 'toon' => true, + 'uchiko' => true, + 'uwajima' => true, + 'yawatahama' => true + , + 'fukui' => + 'echizen' => true, + 'eiheiji' => true, + 'fukui' => true, + 'ikeda' => true, + 'katsuyama' => true, + 'mihama' => true, + 'minamiechizen' => true, + 'obama' => true, + 'ohi' => true, + 'ono' => true, + 'sabae' => true, + 'sakai' => true, + 'takahama' => true, + 'tsuruga' => true, + 'wakasa' => true + , + 'fukuoka' => + 'ashiya' => true, + 'buzen' => true, + 'chikugo' => true, + 'chikuho' => true, + 'chikujo' => true, + 'chikushino' => true, + 'chikuzen' => true, + 'chuo' => true, + 'dazaifu' => true, + 'fukuchi' => true, + 'hakata' => true, + 'higashi' => true, + 'hirokawa' => true, + 'hisayama' => true, + 'iizuka' => true, + 'inatsuki' => true, + 'kaho' => true, + 'kasuga' => true, + 'kasuya' => true, + 'kawara' => true, + 'keisen' => true, + 'koga' => true, + 'kurate' => true, + 'kurogi' => true, + 'kurume' => true, + 'minami' => true, + 'miyako' => true, + 'miyama' => true, + 'miyawaka' => true, + 'mizumaki' => true, + 'munakata' => true, + 'nakagawa' => true, + 'nakama' => true, + 'nishi' => true, + 'nogata' => true, + 'ogori' => true, + 'okagaki' => true, + 'okawa' => true, + 'oki' => true, + 'omuta' => true, + 'onga' => true, + 'onojo' => true, + 'oto' => true, + 'saigawa' => true, + 'sasaguri' => true, + 'shingu' => true, + 'shinyoshitomi' => true, + 'shonai' => true, + 'soeda' => true, + 'sue' => true, + 'tachiarai' => true, + 'tagawa' => true, + 'takata' => true, + 'toho' => true, + 'toyotsu' => true, + 'tsuiki' => true, + 'ukiha' => true, + 'umi' => true, + 'usui' => true, + 'yamada' => true, + 'yame' => true, + 'yanagawa' => true, + 'yukuhashi' => true + , + 'fukushima' => + 'aizubange' => true, + 'aizumisato' => true, + 'aizuwakamatsu' => true, + 'asakawa' => true, + 'bandai' => true, + 'date' => true, + 'fukushima' => true, + 'furudono' => true, + 'futaba' => true, + 'hanawa' => true, + 'higashi' => true, + 'hirata' => true, + 'hirono' => true, + 'iitate' => true, + 'inawashiro' => true, + 'ishikawa' => true, + 'iwaki' => true, + 'izumizaki' => true, + 'kagamiishi' => true, + 'kaneyama' => true, + 'kawamata' => true, + 'kitakata' => true, + 'kitashiobara' => true, + 'koori' => true, + 'koriyama' => true, + 'kunimi' => true, + 'miharu' => true, + 'mishima' => true, + 'namie' => true, + 'nango' => true, + 'nishiaizu' => true, + 'nishigo' => true, + 'okuma' => true, + 'omotego' => true, + 'ono' => true, + 'otama' => true, + 'samegawa' => true, + 'shimogo' => true, + 'shirakawa' => true, + 'showa' => true, + 'soma' => true, + 'sukagawa' => true, + 'taishin' => true, + 'tamakawa' => true, + 'tanagura' => true, + 'tenei' => true, + 'yabuki' => true, + 'yamato' => true, + 'yamatsuri' => true, + 'yanaizu' => true, + 'yugawa' => true + , + 'gifu' => + 'anpachi' => true, + 'ena' => true, + 'gifu' => true, + 'ginan' => true, + 'godo' => true, + 'gujo' => true, + 'hashima' => true, + 'hichiso' => true, + 'hida' => true, + 'higashishirakawa' => true, + 'ibigawa' => true, + 'ikeda' => true, + 'kakamigahara' => true, + 'kani' => true, + 'kasahara' => true, + 'kasamatsu' => true, + 'kawaue' => true, + 'kitagata' => true, + 'mino' => true, + 'minokamo' => true, + 'mitake' => true, + 'mizunami' => true, + 'motosu' => true, + 'nakatsugawa' => true, + 'ogaki' => true, + 'sakahogi' => true, + 'seki' => true, + 'sekigahara' => true, + 'shirakawa' => true, + 'tajimi' => true, + 'takayama' => true, + 'tarui' => true, + 'toki' => true, + 'tomika' => true, + 'wanouchi' => true, + 'yamagata' => true, + 'yaotsu' => true, + 'yoro' => true + , + 'gunma' => + 'annaka' => true, + 'chiyoda' => true, + 'fujioka' => true, + 'higashiagatsuma' => true, + 'isesaki' => true, + 'itakura' => true, + 'kanna' => true, + 'kanra' => true, + 'katashina' => true, + 'kawaba' => true, + 'kiryu' => true, + 'kusatsu' => true, + 'maebashi' => true, + 'meiwa' => true, + 'midori' => true, + 'minakami' => true, + 'naganohara' => true, + 'nakanojo' => true, + 'nanmoku' => true, + 'numata' => true, + 'oizumi' => true, + 'ora' => true, + 'ota' => true, + 'shibukawa' => true, + 'shimonita' => true, + 'shinto' => true, + 'showa' => true, + 'takasaki' => true, + 'takayama' => true, + 'tamamura' => true, + 'tatebayashi' => true, + 'tomioka' => true, + 'tsukiyono' => true, + 'tsumagoi' => true, + 'ueno' => true, + 'yoshioka' => true + , + 'hiroshima' => + 'asaminami' => true, + 'daiwa' => true, + 'etajima' => true, + 'fuchu' => true, + 'fukuyama' => true, + 'hatsukaichi' => true, + 'higashihiroshima' => true, + 'hongo' => true, + 'jinsekikogen' => true, + 'kaita' => true, + 'kui' => true, + 'kumano' => true, + 'kure' => true, + 'mihara' => true, + 'miyoshi' => true, + 'naka' => true, + 'onomichi' => true, + 'osakikamijima' => true, + 'otake' => true, + 'saka' => true, + 'sera' => true, + 'seranishi' => true, + 'shinichi' => true, + 'shobara' => true, + 'takehara' => true + , + 'hokkaido' => + 'abashiri' => true, + 'abira' => true, + 'aibetsu' => true, + 'akabira' => true, + 'akkeshi' => true, + 'asahikawa' => true, + 'ashibetsu' => true, + 'ashoro' => true, + 'assabu' => true, + 'atsuma' => true, + 'bibai' => true, + 'biei' => true, + 'bifuka' => true, + 'bihoro' => true, + 'biratori' => true, + 'chippubetsu' => true, + 'chitose' => true, + 'date' => true, + 'ebetsu' => true, + 'embetsu' => true, + 'eniwa' => true, + 'erimo' => true, + 'esan' => true, + 'esashi' => true, + 'fukagawa' => true, + 'fukushima' => true, + 'furano' => true, + 'furubira' => true, + 'haboro' => true, + 'hakodate' => true, + 'hamatonbetsu' => true, + 'hidaka' => true, + 'higashikagura' => true, + 'higashikawa' => true, + 'hiroo' => true, + 'hokuryu' => true, + 'hokuto' => true, + 'honbetsu' => true, + 'horokanai' => true, + 'horonobe' => true, + 'ikeda' => true, + 'imakane' => true, + 'ishikari' => true, + 'iwamizawa' => true, + 'iwanai' => true, + 'kamifurano' => true, + 'kamikawa' => true, + 'kamishihoro' => true, + 'kamisunagawa' => true, + 'kamoenai' => true, + 'kayabe' => true, + 'kembuchi' => true, + 'kikonai' => true, + 'kimobetsu' => true, + 'kitahiroshima' => true, + 'kitami' => true, + 'kiyosato' => true, + 'koshimizu' => true, + 'kunneppu' => true, + 'kuriyama' => true, + 'kuromatsunai' => true, + 'kushiro' => true, + 'kutchan' => true, + 'kyowa' => true, + 'mashike' => true, + 'matsumae' => true, + 'mikasa' => true, + 'minamifurano' => true, + 'mombetsu' => true, + 'moseushi' => true, + 'mukawa' => true, + 'muroran' => true, + 'naie' => true, + 'nakagawa' => true, + 'nakasatsunai' => true, + 'nakatombetsu' => true, + 'nanae' => true, + 'nanporo' => true, + 'nayoro' => true, + 'nemuro' => true, + 'niikappu' => true, + 'niki' => true, + 'nishiokoppe' => true, + 'noboribetsu' => true, + 'numata' => true, + 'obihiro' => true, + 'obira' => true, + 'oketo' => true, + 'okoppe' => true, + 'otaru' => true, + 'otobe' => true, + 'otofuke' => true, + 'otoineppu' => true, + 'oumu' => true, + 'ozora' => true, + 'pippu' => true, + 'rankoshi' => true, + 'rebun' => true, + 'rikubetsu' => true, + 'rishiri' => true, + 'rishirifuji' => true, + 'saroma' => true, + 'sarufutsu' => true, + 'shakotan' => true, + 'shari' => true, + 'shibecha' => true, + 'shibetsu' => true, + 'shikabe' => true, + 'shikaoi' => true, + 'shimamaki' => true, + 'shimizu' => true, + 'shimokawa' => true, + 'shinshinotsu' => true, + 'shintoku' => true, + 'shiranuka' => true, + 'shiraoi' => true, + 'shiriuchi' => true, + 'sobetsu' => true, + 'sunagawa' => true, + 'taiki' => true, + 'takasu' => true, + 'takikawa' => true, + 'takinoue' => true, + 'teshikaga' => true, + 'tobetsu' => true, + 'tohma' => true, + 'tomakomai' => true, + 'tomari' => true, + 'toya' => true, + 'toyako' => true, + 'toyotomi' => true, + 'toyoura' => true, + 'tsubetsu' => true, + 'tsukigata' => true, + 'urakawa' => true, + 'urausu' => true, + 'uryu' => true, + 'utashinai' => true, + 'wakkanai' => true, + 'wassamu' => true, + 'yakumo' => true, + 'yoichi' => true + , + 'hyogo' => + 'aioi' => true, + 'akashi' => true, + 'ako' => true, + 'amagasaki' => true, + 'aogaki' => true, + 'asago' => true, + 'ashiya' => true, + 'awaji' => true, + 'fukusaki' => true, + 'goshiki' => true, + 'harima' => true, + 'himeji' => true, + 'ichikawa' => true, + 'inagawa' => true, + 'itami' => true, + 'kakogawa' => true, + 'kamigori' => true, + 'kamikawa' => true, + 'kasai' => true, + 'kasuga' => true, + 'kawanishi' => true, + 'miki' => true, + 'minamiawaji' => true, + 'nishinomiya' => true, + 'nishiwaki' => true, + 'ono' => true, + 'sanda' => true, + 'sannan' => true, + 'sasayama' => true, + 'sayo' => true, + 'shingu' => true, + 'shinonsen' => true, + 'shiso' => true, + 'sumoto' => true, + 'taishi' => true, + 'taka' => true, + 'takarazuka' => true, + 'takasago' => true, + 'takino' => true, + 'tamba' => true, + 'tatsuno' => true, + 'toyooka' => true, + 'yabu' => true, + 'yashiro' => true, + 'yoka' => true, + 'yokawa' => true + , + 'ibaraki' => + 'ami' => true, + 'asahi' => true, + 'bando' => true, + 'chikusei' => true, + 'daigo' => true, + 'fujishiro' => true, + 'hitachi' => true, + 'hitachinaka' => true, + 'hitachiomiya' => true, + 'hitachiota' => true, + 'ibaraki' => true, + 'ina' => true, + 'inashiki' => true, + 'itako' => true, + 'iwama' => true, + 'joso' => true, + 'kamisu' => true, + 'kasama' => true, + 'kashima' => true, + 'kasumigaura' => true, + 'koga' => true, + 'miho' => true, + 'mito' => true, + 'moriya' => true, + 'naka' => true, + 'namegata' => true, + 'oarai' => true, + 'ogawa' => true, + 'omitama' => true, + 'ryugasaki' => true, + 'sakai' => true, + 'sakuragawa' => true, + 'shimodate' => true, + 'shimotsuma' => true, + 'shirosato' => true, + 'sowa' => true, + 'suifu' => true, + 'takahagi' => true, + 'tamatsukuri' => true, + 'tokai' => true, + 'tomobe' => true, + 'tone' => true, + 'toride' => true, + 'tsuchiura' => true, + 'tsukuba' => true, + 'uchihara' => true, + 'ushiku' => true, + 'yachiyo' => true, + 'yamagata' => true, + 'yawara' => true, + 'yuki' => true + , + 'ishikawa' => + 'anamizu' => true, + 'hakui' => true, + 'hakusan' => true, + 'kaga' => true, + 'kahoku' => true, + 'kanazawa' => true, + 'kawakita' => true, + 'komatsu' => true, + 'nakanoto' => true, + 'nanao' => true, + 'nomi' => true, + 'nonoichi' => true, + 'noto' => true, + 'shika' => true, + 'suzu' => true, + 'tsubata' => true, + 'tsurugi' => true, + 'uchinada' => true, + 'wajima' => true + , + 'iwate' => + 'fudai' => true, + 'fujisawa' => true, + 'hanamaki' => true, + 'hiraizumi' => true, + 'hirono' => true, + 'ichinohe' => true, + 'ichinoseki' => true, + 'iwaizumi' => true, + 'iwate' => true, + 'joboji' => true, + 'kamaishi' => true, + 'kanegasaki' => true, + 'karumai' => true, + 'kawai' => true, + 'kitakami' => true, + 'kuji' => true, + 'kunohe' => true, + 'kuzumaki' => true, + 'miyako' => true, + 'mizusawa' => true, + 'morioka' => true, + 'ninohe' => true, + 'noda' => true, + 'ofunato' => true, + 'oshu' => true, + 'otsuchi' => true, + 'rikuzentakata' => true, + 'shiwa' => true, + 'shizukuishi' => true, + 'sumita' => true, + 'tanohata' => true, + 'tono' => true, + 'yahaba' => true, + 'yamada' => true + , + 'kagawa' => + 'ayagawa' => true, + 'higashikagawa' => true, + 'kanonji' => true, + 'kotohira' => true, + 'manno' => true, + 'marugame' => true, + 'mitoyo' => true, + 'naoshima' => true, + 'sanuki' => true, + 'tadotsu' => true, + 'takamatsu' => true, + 'tonosho' => true, + 'uchinomi' => true, + 'utazu' => true, + 'zentsuji' => true + , + 'kagoshima' => + 'akune' => true, + 'amami' => true, + 'hioki' => true, + 'isa' => true, + 'isen' => true, + 'izumi' => true, + 'kagoshima' => true, + 'kanoya' => true, + 'kawanabe' => true, + 'kinko' => true, + 'kouyama' => true, + 'makurazaki' => true, + 'matsumoto' => true, + 'minamitane' => true, + 'nakatane' => true, + 'nishinoomote' => true, + 'satsumasendai' => true, + 'soo' => true, + 'tarumizu' => true, + 'yusui' => true + , + 'kanagawa' => + 'aikawa' => true, + 'atsugi' => true, + 'ayase' => true, + 'chigasaki' => true, + 'ebina' => true, + 'fujisawa' => true, + 'hadano' => true, + 'hakone' => true, + 'hiratsuka' => true, + 'isehara' => true, + 'kaisei' => true, + 'kamakura' => true, + 'kiyokawa' => true, + 'matsuda' => true, + 'minamiashigara' => true, + 'miura' => true, + 'nakai' => true, + 'ninomiya' => true, + 'odawara' => true, + 'oi' => true, + 'oiso' => true, + 'sagamihara' => true, + 'samukawa' => true, + 'tsukui' => true, + 'yamakita' => true, + 'yamato' => true, + 'yokosuka' => true, + 'yugawara' => true, + 'zama' => true, + 'zushi' => true + , + 'kochi' => + 'aki' => true, + 'geisei' => true, + 'hidaka' => true, + 'higashitsuno' => true, + 'ino' => true, + 'kagami' => true, + 'kami' => true, + 'kitagawa' => true, + 'kochi' => true, + 'mihara' => true, + 'motoyama' => true, + 'muroto' => true, + 'nahari' => true, + 'nakamura' => true, + 'nankoku' => true, + 'nishitosa' => true, + 'niyodogawa' => true, + 'ochi' => true, + 'okawa' => true, + 'otoyo' => true, + 'otsuki' => true, + 'sakawa' => true, + 'sukumo' => true, + 'susaki' => true, + 'tosa' => true, + 'tosashimizu' => true, + 'toyo' => true, + 'tsuno' => true, + 'umaji' => true, + 'yasuda' => true, + 'yusuhara' => true + , + 'kumamoto' => + 'amakusa' => true, + 'arao' => true, + 'aso' => true, + 'choyo' => true, + 'gyokuto' => true, + 'kamiamakusa' => true, + 'kikuchi' => true, + 'kumamoto' => true, + 'mashiki' => true, + 'mifune' => true, + 'minamata' => true, + 'minamioguni' => true, + 'nagasu' => true, + 'nishihara' => true, + 'oguni' => true, + 'ozu' => true, + 'sumoto' => true, + 'takamori' => true, + 'uki' => true, + 'uto' => true, + 'yamaga' => true, + 'yamato' => true, + 'yatsushiro' => true + , + 'kyoto' => + 'ayabe' => true, + 'fukuchiyama' => true, + 'higashiyama' => true, + 'ide' => true, + 'ine' => true, + 'joyo' => true, + 'kameoka' => true, + 'kamo' => true, + 'kita' => true, + 'kizu' => true, + 'kumiyama' => true, + 'kyotamba' => true, + 'kyotanabe' => true, + 'kyotango' => true, + 'maizuru' => true, + 'minami' => true, + 'minamiyamashiro' => true, + 'miyazu' => true, + 'muko' => true, + 'nagaokakyo' => true, + 'nakagyo' => true, + 'nantan' => true, + 'oyamazaki' => true, + 'sakyo' => true, + 'seika' => true, + 'tanabe' => true, + 'uji' => true, + 'ujitawara' => true, + 'wazuka' => true, + 'yamashina' => true, + 'yawata' => true + , + 'mie' => + 'asahi' => true, + 'inabe' => true, + 'ise' => true, + 'kameyama' => true, + 'kawagoe' => true, + 'kiho' => true, + 'kisosaki' => true, + 'kiwa' => true, + 'komono' => true, + 'kumano' => true, + 'kuwana' => true, + 'matsusaka' => true, + 'meiwa' => true, + 'mihama' => true, + 'minamiise' => true, + 'misugi' => true, + 'miyama' => true, + 'nabari' => true, + 'shima' => true, + 'suzuka' => true, + 'tado' => true, + 'taiki' => true, + 'taki' => true, + 'tamaki' => true, + 'toba' => true, + 'tsu' => true, + 'udono' => true, + 'ureshino' => true, + 'watarai' => true, + 'yokkaichi' => true + , + 'miyagi' => + 'furukawa' => true, + 'higashimatsushima' => true, + 'ishinomaki' => true, + 'iwanuma' => true, + 'kakuda' => true, + 'kami' => true, + 'kawasaki' => true, + 'marumori' => true, + 'matsushima' => true, + 'minamisanriku' => true, + 'misato' => true, + 'murata' => true, + 'natori' => true, + 'ogawara' => true, + 'ohira' => true, + 'onagawa' => true, + 'osaki' => true, + 'rifu' => true, + 'semine' => true, + 'shibata' => true, + 'shichikashuku' => true, + 'shikama' => true, + 'shiogama' => true, + 'shiroishi' => true, + 'tagajo' => true, + 'taiwa' => true, + 'tome' => true, + 'tomiya' => true, + 'wakuya' => true, + 'watari' => true, + 'yamamoto' => true, + 'zao' => true + , + 'miyazaki' => + 'aya' => true, + 'ebino' => true, + 'gokase' => true, + 'hyuga' => true, + 'kadogawa' => true, + 'kawaminami' => true, + 'kijo' => true, + 'kitagawa' => true, + 'kitakata' => true, + 'kitaura' => true, + 'kobayashi' => true, + 'kunitomi' => true, + 'kushima' => true, + 'mimata' => true, + 'miyakonojo' => true, + 'miyazaki' => true, + 'morotsuka' => true, + 'nichinan' => true, + 'nishimera' => true, + 'nobeoka' => true, + 'saito' => true, + 'shiiba' => true, + 'shintomi' => true, + 'takaharu' => true, + 'takanabe' => true, + 'takazaki' => true, + 'tsuno' => true + , + 'nagano' => + 'achi' => true, + 'agematsu' => true, + 'anan' => true, + 'aoki' => true, + 'asahi' => true, + 'azumino' => true, + 'chikuhoku' => true, + 'chikuma' => true, + 'chino' => true, + 'fujimi' => true, + 'hakuba' => true, + 'hara' => true, + 'hiraya' => true, + 'iida' => true, + 'iijima' => true, + 'iiyama' => true, + 'iizuna' => true, + 'ikeda' => true, + 'ikusaka' => true, + 'ina' => true, + 'karuizawa' => true, + 'kawakami' => true, + 'kiso' => true, + 'kisofukushima' => true, + 'kitaaiki' => true, + 'komagane' => true, + 'komoro' => true, + 'matsukawa' => true, + 'matsumoto' => true, + 'miasa' => true, + 'minamiaiki' => true, + 'minamimaki' => true, + 'minamiminowa' => true, + 'minowa' => true, + 'miyada' => true, + 'miyota' => true, + 'mochizuki' => true, + 'nagano' => true, + 'nagawa' => true, + 'nagiso' => true, + 'nakagawa' => true, + 'nakano' => true, + 'nozawaonsen' => true, + 'obuse' => true, + 'ogawa' => true, + 'okaya' => true, + 'omachi' => true, + 'omi' => true, + 'ookuwa' => true, + 'ooshika' => true, + 'otaki' => true, + 'otari' => true, + 'sakae' => true, + 'sakaki' => true, + 'saku' => true, + 'sakuho' => true, + 'shimosuwa' => true, + 'shinanomachi' => true, + 'shiojiri' => true, + 'suwa' => true, + 'suzaka' => true, + 'takagi' => true, + 'takamori' => true, + 'takayama' => true, + 'tateshina' => true, + 'tatsuno' => true, + 'togakushi' => true, + 'togura' => true, + 'tomi' => true, + 'ueda' => true, + 'wada' => true, + 'yamagata' => true, + 'yamanouchi' => true, + 'yasaka' => true, + 'yasuoka' => true + , + 'nagasaki' => + 'chijiwa' => true, + 'futsu' => true, + 'goto' => true, + 'hasami' => true, + 'hirado' => true, + 'iki' => true, + 'isahaya' => true, + 'kawatana' => true, + 'kuchinotsu' => true, + 'matsuura' => true, + 'nagasaki' => true, + 'obama' => true, + 'omura' => true, + 'oseto' => true, + 'saikai' => true, + 'sasebo' => true, + 'seihi' => true, + 'shimabara' => true, + 'shinkamigoto' => true, + 'togitsu' => true, + 'tsushima' => true, + 'unzen' => true + , + 'nara' => + 'ando' => true, + 'gose' => true, + 'heguri' => true, + 'higashiyoshino' => true, + 'ikaruga' => true, + 'ikoma' => true, + 'kamikitayama' => true, + 'kanmaki' => true, + 'kashiba' => true, + 'kashihara' => true, + 'katsuragi' => true, + 'kawai' => true, + 'kawakami' => true, + 'kawanishi' => true, + 'koryo' => true, + 'kurotaki' => true, + 'mitsue' => true, + 'miyake' => true, + 'nara' => true, + 'nosegawa' => true, + 'oji' => true, + 'ouda' => true, + 'oyodo' => true, + 'sakurai' => true, + 'sango' => true, + 'shimoichi' => true, + 'shimokitayama' => true, + 'shinjo' => true, + 'soni' => true, + 'takatori' => true, + 'tawaramoto' => true, + 'tenkawa' => true, + 'tenri' => true, + 'uda' => true, + 'yamatokoriyama' => true, + 'yamatotakada' => true, + 'yamazoe' => true, + 'yoshino' => true + , + 'niigata' => + 'aga' => true, + 'agano' => true, + 'gosen' => true, + 'itoigawa' => true, + 'izumozaki' => true, + 'joetsu' => true, + 'kamo' => true, + 'kariwa' => true, + 'kashiwazaki' => true, + 'minamiuonuma' => true, + 'mitsuke' => true, + 'muika' => true, + 'murakami' => true, + 'myoko' => true, + 'nagaoka' => true, + 'niigata' => true, + 'ojiya' => true, + 'omi' => true, + 'sado' => true, + 'sanjo' => true, + 'seiro' => true, + 'seirou' => true, + 'sekikawa' => true, + 'shibata' => true, + 'tagami' => true, + 'tainai' => true, + 'tochio' => true, + 'tokamachi' => true, + 'tsubame' => true, + 'tsunan' => true, + 'uonuma' => true, + 'yahiko' => true, + 'yoita' => true, + 'yuzawa' => true + , + 'oita' => + 'beppu' => true, + 'bungoono' => true, + 'bungotakada' => true, + 'hasama' => true, + 'hiji' => true, + 'himeshima' => true, + 'hita' => true, + 'kamitsue' => true, + 'kokonoe' => true, + 'kuju' => true, + 'kunisaki' => true, + 'kusu' => true, + 'oita' => true, + 'saiki' => true, + 'taketa' => true, + 'tsukumi' => true, + 'usa' => true, + 'usuki' => true, + 'yufu' => true + , + 'okayama' => + 'akaiwa' => true, + 'asakuchi' => true, + 'bizen' => true, + 'hayashima' => true, + 'ibara' => true, + 'kagamino' => true, + 'kasaoka' => true, + 'kibichuo' => true, + 'kumenan' => true, + 'kurashiki' => true, + 'maniwa' => true, + 'misaki' => true, + 'nagi' => true, + 'niimi' => true, + 'nishiawakura' => true, + 'okayama' => true, + 'satosho' => true, + 'setouchi' => true, + 'shinjo' => true, + 'shoo' => true, + 'soja' => true, + 'takahashi' => true, + 'tamano' => true, + 'tsuyama' => true, + 'wake' => true, + 'yakage' => true + , + 'okinawa' => + 'aguni' => true, + 'ginowan' => true, + 'ginoza' => true, + 'gushikami' => true, + 'haebaru' => true, + 'higashi' => true, + 'hirara' => true, + 'iheya' => true, + 'ishigaki' => true, + 'ishikawa' => true, + 'itoman' => true, + 'izena' => true, + 'kadena' => true, + 'kin' => true, + 'kitadaito' => true, + 'kitanakagusuku' => true, + 'kumejima' => true, + 'kunigami' => true, + 'minamidaito' => true, + 'motobu' => true, + 'nago' => true, + 'naha' => true, + 'nakagusuku' => true, + 'nakijin' => true, + 'nanjo' => true, + 'nishihara' => true, + 'ogimi' => true, + 'okinawa' => true, + 'onna' => true, + 'shimoji' => true, + 'taketomi' => true, + 'tarama' => true, + 'tokashiki' => true, + 'tomigusuku' => true, + 'tonaki' => true, + 'urasoe' => true, + 'uruma' => true, + 'yaese' => true, + 'yomitan' => true, + 'yonabaru' => true, + 'yonaguni' => true, + 'zamami' => true + , + 'osaka' => + 'abeno' => true, + 'chihayaakasaka' => true, + 'chuo' => true, + 'daito' => true, + 'fujiidera' => true, + 'habikino' => true, + 'hannan' => true, + 'higashiosaka' => true, + 'higashisumiyoshi' => true, + 'higashiyodogawa' => true, + 'hirakata' => true, + 'ibaraki' => true, + 'ikeda' => true, + 'izumi' => true, + 'izumiotsu' => true, + 'izumisano' => true, + 'kadoma' => true, + 'kaizuka' => true, + 'kanan' => true, + 'kashiwara' => true, + 'katano' => true, + 'kawachinagano' => true, + 'kishiwada' => true, + 'kita' => true, + 'kumatori' => true, + 'matsubara' => true, + 'minato' => true, + 'minoh' => true, + 'misaki' => true, + 'moriguchi' => true, + 'neyagawa' => true, + 'nishi' => true, + 'nose' => true, + 'osakasayama' => true, + 'sakai' => true, + 'sayama' => true, + 'sennan' => true, + 'settsu' => true, + 'shijonawate' => true, + 'shimamoto' => true, + 'suita' => true, + 'tadaoka' => true, + 'taishi' => true, + 'tajiri' => true, + 'takaishi' => true, + 'takatsuki' => true, + 'tondabayashi' => true, + 'toyonaka' => true, + 'toyono' => true, + 'yao' => true + , + 'saga' => + 'ariake' => true, + 'arita' => true, + 'fukudomi' => true, + 'genkai' => true, + 'hamatama' => true, + 'hizen' => true, + 'imari' => true, + 'kamimine' => true, + 'kanzaki' => true, + 'karatsu' => true, + 'kashima' => true, + 'kitagata' => true, + 'kitahata' => true, + 'kiyama' => true, + 'kouhoku' => true, + 'kyuragi' => true, + 'nishiarita' => true, + 'ogi' => true, + 'omachi' => true, + 'ouchi' => true, + 'saga' => true, + 'shiroishi' => true, + 'taku' => true, + 'tara' => true, + 'tosu' => true, + 'yoshinogari' => true + , + 'saitama' => + 'arakawa' => true, + 'asaka' => true, + 'chichibu' => true, + 'fujimi' => true, + 'fujimino' => true, + 'fukaya' => true, + 'hanno' => true, + 'hanyu' => true, + 'hasuda' => true, + 'hatogaya' => true, + 'hatoyama' => true, + 'hidaka' => true, + 'higashichichibu' => true, + 'higashimatsuyama' => true, + 'honjo' => true, + 'ina' => true, + 'iruma' => true, + 'iwatsuki' => true, + 'kamiizumi' => true, + 'kamikawa' => true, + 'kamisato' => true, + 'kasukabe' => true, + 'kawagoe' => true, + 'kawaguchi' => true, + 'kawajima' => true, + 'kazo' => true, + 'kitamoto' => true, + 'koshigaya' => true, + 'kounosu' => true, + 'kuki' => true, + 'kumagaya' => true, + 'matsubushi' => true, + 'minano' => true, + 'misato' => true, + 'miyashiro' => true, + 'miyoshi' => true, + 'moroyama' => true, + 'nagatoro' => true, + 'namegawa' => true, + 'niiza' => true, + 'ogano' => true, + 'ogawa' => true, + 'ogose' => true, + 'okegawa' => true, + 'omiya' => true, + 'otaki' => true, + 'ranzan' => true, + 'ryokami' => true, + 'saitama' => true, + 'sakado' => true, + 'satte' => true, + 'sayama' => true, + 'shiki' => true, + 'shiraoka' => true, + 'soka' => true, + 'sugito' => true, + 'toda' => true, + 'tokigawa' => true, + 'tokorozawa' => true, + 'tsurugashima' => true, + 'urawa' => true, + 'warabi' => true, + 'yashio' => true, + 'yokoze' => true, + 'yono' => true, + 'yorii' => true, + 'yoshida' => true, + 'yoshikawa' => true, + 'yoshimi' => true + , + 'shiga' => + 'aisho' => true, + 'gamo' => true, + 'higashiomi' => true, + 'hikone' => true, + 'koka' => true, + 'konan' => true, + 'kosei' => true, + 'koto' => true, + 'kusatsu' => true, + 'maibara' => true, + 'moriyama' => true, + 'nagahama' => true, + 'nishiazai' => true, + 'notogawa' => true, + 'omihachiman' => true, + 'otsu' => true, + 'ritto' => true, + 'ryuoh' => true, + 'takashima' => true, + 'takatsuki' => true, + 'torahime' => true, + 'toyosato' => true, + 'yasu' => true + , + 'shimane' => + 'akagi' => true, + 'ama' => true, + 'gotsu' => true, + 'hamada' => true, + 'higashiizumo' => true, + 'hikawa' => true, + 'hikimi' => true, + 'izumo' => true, + 'kakinoki' => true, + 'masuda' => true, + 'matsue' => true, + 'misato' => true, + 'nishinoshima' => true, + 'ohda' => true, + 'okinoshima' => true, + 'okuizumo' => true, + 'shimane' => true, + 'tamayu' => true, + 'tsuwano' => true, + 'unnan' => true, + 'yakumo' => true, + 'yasugi' => true, + 'yatsuka' => true + , + 'shizuoka' => + 'arai' => true, + 'atami' => true, + 'fuji' => true, + 'fujieda' => true, + 'fujikawa' => true, + 'fujinomiya' => true, + 'fukuroi' => true, + 'gotemba' => true, + 'haibara' => true, + 'hamamatsu' => true, + 'higashiizu' => true, + 'ito' => true, + 'iwata' => true, + 'izu' => true, + 'izunokuni' => true, + 'kakegawa' => true, + 'kannami' => true, + 'kawanehon' => true, + 'kawazu' => true, + 'kikugawa' => true, + 'kosai' => true, + 'makinohara' => true, + 'matsuzaki' => true, + 'minamiizu' => true, + 'mishima' => true, + 'morimachi' => true, + 'nishiizu' => true, + 'numazu' => true, + 'omaezaki' => true, + 'shimada' => true, + 'shimizu' => true, + 'shimoda' => true, + 'shizuoka' => true, + 'susono' => true, + 'yaizu' => true, + 'yoshida' => true + , + 'tochigi' => + 'ashikaga' => true, + 'bato' => true, + 'haga' => true, + 'ichikai' => true, + 'iwafune' => true, + 'kaminokawa' => true, + 'kanuma' => true, + 'karasuyama' => true, + 'kuroiso' => true, + 'mashiko' => true, + 'mibu' => true, + 'moka' => true, + 'motegi' => true, + 'nasu' => true, + 'nasushiobara' => true, + 'nikko' => true, + 'nishikata' => true, + 'nogi' => true, + 'ohira' => true, + 'ohtawara' => true, + 'oyama' => true, + 'sakura' => true, + 'sano' => true, + 'shimotsuke' => true, + 'shioya' => true, + 'takanezawa' => true, + 'tochigi' => true, + 'tsuga' => true, + 'ujiie' => true, + 'utsunomiya' => true, + 'yaita' => true + , + 'tokushima' => + 'aizumi' => true, + 'anan' => true, + 'ichiba' => true, + 'itano' => true, + 'kainan' => true, + 'komatsushima' => true, + 'matsushige' => true, + 'mima' => true, + 'minami' => true, + 'miyoshi' => true, + 'mugi' => true, + 'nakagawa' => true, + 'naruto' => true, + 'sanagochi' => true, + 'shishikui' => true, + 'tokushima' => true, + 'wajiki' => true + , + 'tokyo' => + 'adachi' => true, + 'akiruno' => true, + 'akishima' => true, + 'aogashima' => true, + 'arakawa' => true, + 'bunkyo' => true, + 'chiyoda' => true, + 'chofu' => true, + 'chuo' => true, + 'edogawa' => true, + 'fuchu' => true, + 'fussa' => true, + 'hachijo' => true, + 'hachioji' => true, + 'hamura' => true, + 'higashikurume' => true, + 'higashimurayama' => true, + 'higashiyamato' => true, + 'hino' => true, + 'hinode' => true, + 'hinohara' => true, + 'inagi' => true, + 'itabashi' => true, + 'katsushika' => true, + 'kita' => true, + 'kiyose' => true, + 'kodaira' => true, + 'koganei' => true, + 'kokubunji' => true, + 'komae' => true, + 'koto' => true, + 'kouzushima' => true, + 'kunitachi' => true, + 'machida' => true, + 'meguro' => true, + 'minato' => true, + 'mitaka' => true, + 'mizuho' => true, + 'musashimurayama' => true, + 'musashino' => true, + 'nakano' => true, + 'nerima' => true, + 'ogasawara' => true, + 'okutama' => true, + 'ome' => true, + 'oshima' => true, + 'ota' => true, + 'setagaya' => true, + 'shibuya' => true, + 'shinagawa' => true, + 'shinjuku' => true, + 'suginami' => true, + 'sumida' => true, + 'tachikawa' => true, + 'taito' => true, + 'tama' => true, + 'toshima' => true + , + 'tottori' => + 'chizu' => true, + 'hino' => true, + 'kawahara' => true, + 'koge' => true, + 'kotoura' => true, + 'misasa' => true, + 'nanbu' => true, + 'nichinan' => true, + 'sakaiminato' => true, + 'tottori' => true, + 'wakasa' => true, + 'yazu' => true, + 'yonago' => true + , + 'toyama' => + 'asahi' => true, + 'fuchu' => true, + 'fukumitsu' => true, + 'funahashi' => true, + 'himi' => true, + 'imizu' => true, + 'inami' => true, + 'johana' => true, + 'kamiichi' => true, + 'kurobe' => true, + 'nakaniikawa' => true, + 'namerikawa' => true, + 'nanto' => true, + 'nyuzen' => true, + 'oyabe' => true, + 'taira' => true, + 'takaoka' => true, + 'tateyama' => true, + 'toga' => true, + 'tonami' => true, + 'toyama' => true, + 'unazuki' => true, + 'uozu' => true, + 'yamada' => true + , + 'wakayama' => + 'arida' => true, + 'aridagawa' => true, + 'gobo' => true, + 'hashimoto' => true, + 'hidaka' => true, + 'hirogawa' => true, + 'inami' => true, + 'iwade' => true, + 'kainan' => true, + 'kamitonda' => true, + 'katsuragi' => true, + 'kimino' => true, + 'kinokawa' => true, + 'kitayama' => true, + 'koya' => true, + 'koza' => true, + 'kozagawa' => true, + 'kudoyama' => true, + 'kushimoto' => true, + 'mihama' => true, + 'misato' => true, + 'nachikatsuura' => true, + 'shingu' => true, + 'shirahama' => true, + 'taiji' => true, + 'tanabe' => true, + 'wakayama' => true, + 'yuasa' => true, + 'yura' => true + , + 'yamagata' => + 'asahi' => true, + 'funagata' => true, + 'higashine' => true, + 'iide' => true, + 'kahoku' => true, + 'kaminoyama' => true, + 'kaneyama' => true, + 'kawanishi' => true, + 'mamurogawa' => true, + 'mikawa' => true, + 'murayama' => true, + 'nagai' => true, + 'nakayama' => true, + 'nanyo' => true, + 'nishikawa' => true, + 'obanazawa' => true, + 'oe' => true, + 'oguni' => true, + 'ohkura' => true, + 'oishida' => true, + 'sagae' => true, + 'sakata' => true, + 'sakegawa' => true, + 'shinjo' => true, + 'shirataka' => true, + 'shonai' => true, + 'takahata' => true, + 'tendo' => true, + 'tozawa' => true, + 'tsuruoka' => true, + 'yamagata' => true, + 'yamanobe' => true, + 'yonezawa' => true, + 'yuza' => true + , + 'yamaguchi' => + 'abu' => true, + 'hagi' => true, + 'hikari' => true, + 'hofu' => true, + 'iwakuni' => true, + 'kudamatsu' => true, + 'mitou' => true, + 'nagato' => true, + 'oshima' => true, + 'shimonoseki' => true, + 'shunan' => true, + 'tabuse' => true, + 'tokuyama' => true, + 'toyota' => true, + 'ube' => true, + 'yuu' => true + , + 'yamanashi' => + 'chuo' => true, + 'doshi' => true, + 'fuefuki' => true, + 'fujikawa' => true, + 'fujikawaguchiko' => true, + 'fujiyoshida' => true, + 'hayakawa' => true, + 'hokuto' => true, + 'ichikawamisato' => true, + 'kai' => true, + 'kofu' => true, + 'koshu' => true, + 'kosuge' => true, + 'minami-alps' => true, + 'minobu' => true, + 'nakamichi' => true, + 'nanbu' => true, + 'narusawa' => true, + 'nirasaki' => true, + 'nishikatsura' => true, + 'oshino' => true, + 'otsuki' => true, + 'showa' => true, + 'tabayama' => true, + 'tsuru' => true, + 'uenohara' => true, + 'yamanakako' => true, + 'yamanashi' => true + , + '栃木' => true, + '愛知' => true, + '愛媛' => true, + '兵庫' => true, + '熊本' => true, + '茨城' => true, + '北海道' => true, + '千葉' => true, + '和歌山' => true, + '長崎' => true, + '長野' => true, + '新潟' => true, + '青森' => true, + '静岡' => true, + '東京' => true, + '石川' => true, + '埼玉' => true, + '三重' => true, + '京都' => true, + '佐賀' => true, + '大分' => true, + '大阪' => true, + '奈良' => true, + '宮城' => true, + '宮崎' => true, + '富山' => true, + '山口' => true, + '山形' => true, + '山梨' => true, + '岩手' => true, + '岐阜' => true, + '岡山' => true, + '島根' => true, + '広島' => true, + '徳島' => true, + '沖縄' => true, + '滋賀' => true, + '神奈川' => true, + '福井' => true, + '福岡' => true, + '福島' => true, + '秋田' => true, + '群馬' => true, + '香川' => true, + '高知' => true, + '鳥取' => true, + '鹿児島' => true, + 'kawasaki' => + '*' => true, + '!city' => true + , + 'kitakyushu' => + '*' => true, + '!city' => true + , + 'kobe' => + '*' => true, + '!city' => true + , + 'nagoya' => + '*' => true, + '!city' => true + , + 'sapporo' => + '*' => true, + '!city' => true + , + 'sendai' => + '*' => true, + '!city' => true + , + 'yokohama' => + '*' => true, + '!city' => true + , + 'buyshop' => true, + 'fashionstore' => true, + 'handcrafted' => true, + 'kawaiishop' => true, + 'supersale' => true, + 'theshop' => true, + 'usercontent' => true, + 'angry' => true, + 'babyblue' => true, + 'babymilk' => true, + 'backdrop' => true, + 'bambina' => true, + 'bitter' => true, + 'blush' => true, + 'boo' => true, + 'boy' => true, + 'boyfriend' => true, + 'but' => true, + 'candypop' => true, + 'capoo' => true, + 'catfood' => true, + 'cheap' => true, + 'chicappa' => true, + 'chillout' => true, + 'chips' => true, + 'chowder' => true, + 'chu' => true, + 'ciao' => true, + 'cocotte' => true, + 'coolblog' => true, + 'cranky' => true, + 'cutegirl' => true, + 'daa' => true, + 'deca' => true, + 'deci' => true, + 'digick' => true, + 'egoism' => true, + 'fakefur' => true, + 'fem' => true, + 'flier' => true, + 'floppy' => true, + 'fool' => true, + 'frenchkiss' => true, + 'girlfriend' => true, + 'girly' => true, + 'gloomy' => true, + 'gonna' => true, + 'greater' => true, + 'hacca' => true, + 'heavy' => true, + 'her' => true, + 'hiho' => true, + 'hippy' => true, + 'holy' => true, + 'hungry' => true, + 'icurus' => true, + 'itigo' => true, + 'jellybean' => true, + 'kikirara' => true, + 'kill' => true, + 'kilo' => true, + 'kuron' => true, + 'littlestar' => true, + 'lolipopmc' => true, + 'lolitapunk' => true, + 'lomo' => true, + 'lovepop' => true, + 'lovesick' => true, + 'main' => true, + 'mods' => true, + 'mond' => true, + 'mongolian' => true, + 'moo' => true, + 'namaste' => true, + 'nikita' => true, + 'nobushi' => true, + 'noor' => true, + 'oops' => true, + 'parallel' => true, + 'parasite' => true, + 'pecori' => true, + 'peewee' => true, + 'penne' => true, + 'pepper' => true, + 'perma' => true, + 'pigboat' => true, + 'pinoko' => true, + 'punyu' => true, + 'pupu' => true, + 'pussycat' => true, + 'pya' => true, + 'raindrop' => true, + 'readymade' => true, + 'sadist' => true, + 'schoolbus' => true, + 'secret' => true, + 'staba' => true, + 'stripper' => true, + 'sub' => true, + 'sunnyday' => true, + 'thick' => true, + 'tonkotsu' => true, + 'under' => true, + 'upper' => true, + 'velvet' => true, + 'verse' => true, + 'versus' => true, + 'vivian' => true, + 'watson' => true, + 'weblike' => true, + 'whitesnow' => true, + 'zombie' => true, + 'blogspot' => true, + '2-d' => true, + 'bona' => true, + 'crap' => true, + 'daynight' => true, + 'eek' => true, + 'flop' => true, + 'halfmoon' => true, + 'jeez' => true, + 'matrix' => true, + 'mimoza' => true, + 'netgamers' => true, + 'nyanta' => true, + 'o0o0' => true, + 'rdy' => true, + 'rgr' => true, + 'rulez' => true, + 'sakurastorage' => + 'isk01' => + 's3' => true + , + 'isk02' => + 's3' => true + + , + 'saloon' => true, + 'sblo' => true, + 'skr' => true, + 'tank' => true, + 'uh-oh' => true, + 'undo' => true, + 'webaccel' => + 'rs' => true, + 'user' => true + , + 'websozai' => true, + 'xii' => true + , + 'ke' => + 'ac' => true, + 'co' => + 'blogspot' => true + , + 'go' => true, + 'info' => true, + 'me' => true, + 'mobi' => true, + 'ne' => true, + 'or' => true, + 'sc' => true + , + 'kg' => + 'org' => true, + 'net' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'mil' => true, + 'blog' => true, + 'io' => true, + 'jp' => true, + 'tv' => true, + 'uk' => true, + 'us' => true + , + 'kh' => + '*' => true + , + 'ki' => + 'edu' => true, + 'biz' => true, + 'net' => true, + 'org' => true, + 'gov' => true, + 'info' => true, + 'com' => true + , + 'km' => + 'org' => true, + 'nom' => true, + 'gov' => true, + 'prd' => true, + 'tm' => true, + 'edu' => true, + 'mil' => true, + 'ass' => true, + 'com' => true, + 'coop' => true, + 'asso' => true, + 'presse' => true, + 'medecin' => true, + 'notaires' => true, + 'pharmaciens' => true, + 'veterinaire' => true, + 'gouv' => true + , + 'kn' => + 'net' => true, + 'org' => true, + 'edu' => true, + 'gov' => true + , + 'kp' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'org' => true, + 'rep' => true, + 'tra' => true + , + 'kr' => + 'ac' => true, + 'co' => true, + 'es' => true, + 'go' => true, + 'hs' => true, + 'kg' => true, + 'mil' => true, + 'ms' => true, + 'ne' => true, + 'or' => true, + 'pe' => true, + 're' => true, + 'sc' => true, + 'busan' => true, + 'chungbuk' => true, + 'chungnam' => true, + 'daegu' => true, + 'daejeon' => true, + 'gangwon' => true, + 'gwangju' => true, + 'gyeongbuk' => true, + 'gyeonggi' => true, + 'gyeongnam' => true, + 'incheon' => true, + 'jeju' => true, + 'jeonbuk' => true, + 'jeonnam' => true, + 'seoul' => true, + 'ulsan' => true, + 'blogspot' => true + , + 'kw' => + 'com' => true, + 'edu' => true, + 'emb' => true, + 'gov' => true, + 'ind' => true, + 'net' => true, + 'org' => true + , + 'ky' => + 'com' => true, + 'edu' => true, + 'net' => true, + 'org' => true + , + 'kz' => + 'org' => true, + 'edu' => true, + 'net' => true, + 'gov' => true, + 'mil' => true, + 'com' => true, + 'jcloud' => true, + 'kazteleport' => + 'upaas' => true + + , + 'la' => + 'int' => true, + 'net' => true, + 'info' => true, + 'edu' => true, + 'gov' => true, + 'per' => true, + 'com' => true, + 'org' => true, + 'bnr' => true, + 'c' => true + , + 'lb' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'net' => true, + 'org' => true + , + 'lc' => + 'com' => true, + 'net' => true, + 'co' => true, + 'org' => true, + 'edu' => true, + 'gov' => true, + 'oy' => true + , + 'li' => + 'blogspot' => true, + 'caa' => true + , + 'lk' => + 'gov' => true, + 'sch' => true, + 'net' => true, + 'int' => true, + 'com' => true, + 'org' => true, + 'edu' => true, + 'ngo' => true, + 'soc' => true, + 'web' => true, + 'ltd' => true, + 'assn' => true, + 'grp' => true, + 'hotel' => true, + 'ac' => true + , + 'lr' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'org' => true, + 'net' => true + , + 'ls' => + 'ac' => true, + 'biz' => true, + 'co' => true, + 'edu' => true, + 'gov' => true, + 'info' => true, + 'net' => true, + 'org' => true, + 'sc' => true, + 'de' => true + , + 'lt' => + 'gov' => true, + 'blogspot' => true + , + 'lu' => + 'blogspot' => true, + '123website' => true + , + 'lv' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'org' => true, + 'mil' => true, + 'id' => true, + 'net' => true, + 'asn' => true, + 'conf' => true + , + 'ly' => + 'com' => true, + 'net' => true, + 'gov' => true, + 'plc' => true, + 'edu' => true, + 'sch' => true, + 'med' => true, + 'org' => true, + 'id' => true + , + 'ma' => + 'co' => true, + 'net' => true, + 'gov' => true, + 'org' => true, + 'ac' => true, + 'press' => true + , + 'mc' => + 'tm' => true, + 'asso' => true + , + 'md' => + 'blogspot' => true, + 'at' => true, + 'de' => true, + 'jp' => true, + 'to' => true + , + 'me' => + 'co' => true, + 'net' => true, + 'org' => true, + 'edu' => true, + 'ac' => true, + 'gov' => true, + 'its' => true, + 'priv' => true, + 'c66' => true, + 'daplie' => + 'localhost' => true + , + 'edgestack' => true, + 'filegear' => true, + 'filegear-au' => true, + 'filegear-de' => true, + 'filegear-gb' => true, + 'filegear-ie' => true, + 'filegear-jp' => true, + 'filegear-sg' => true, + 'glitch' => true, + 'ravendb' => true, + 'lohmus' => true, + 'barsy' => true, + 'mcpe' => true, + 'mcdir' => true, + 'soundcast' => true, + 'tcp4' => true, + 'brasilia' => true, + 'ddns' => true, + 'dnsfor' => true, + 'hopto' => true, + 'loginto' => true, + 'noip' => true, + 'webhop' => true, + 'vp4' => true, + 'diskstation' => true, + 'dscloud' => true, + 'i234' => true, + 'myds' => true, + 'synology' => true, + 'transip' => + 'site' => true + , + 'wedeploy' => true, + 'yombo' => true, + 'nohost' => true + , + 'mg' => + 'org' => true, + 'nom' => true, + 'gov' => true, + 'prd' => true, + 'tm' => true, + 'edu' => true, + 'mil' => true, + 'com' => true, + 'co' => true + , + 'mh' => true, + 'mil' => true, + 'mk' => + 'com' => true, + 'org' => true, + 'net' => true, + 'edu' => true, + 'gov' => true, + 'inf' => true, + 'name' => true, + 'blogspot' => true + , + 'ml' => + 'com' => true, + 'edu' => true, + 'gouv' => true, + 'gov' => true, + 'net' => true, + 'org' => true, + 'presse' => true + , + 'mm' => + '*' => true + , + 'mn' => + 'gov' => true, + 'edu' => true, + 'org' => true, + 'nyc' => true + , + 'mo' => + 'com' => true, + 'net' => true, + 'org' => true, + 'edu' => true, + 'gov' => true + , + 'mobi' => + 'barsy' => true, + 'dscloud' => true + , + 'mp' => + 'ju' => true + , + 'mq' => true, + 'mr' => + 'gov' => true, + 'blogspot' => true + , + 'ms' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'net' => true, + 'org' => true, + 'lab' => true, + 'minisite' => true + , + 'mt' => + 'com' => + 'blogspot' => true + , + 'edu' => true, + 'net' => true, + 'org' => true + , + 'mu' => + 'com' => true, + 'net' => true, + 'org' => true, + 'gov' => true, + 'ac' => true, + 'co' => true, + 'or' => true + , + 'museum' => true, + 'mv' => + 'aero' => true, + 'biz' => true, + 'com' => true, + 'coop' => true, + 'edu' => true, + 'gov' => true, + 'info' => true, + 'int' => true, + 'mil' => true, + 'museum' => true, + 'name' => true, + 'net' => true, + 'org' => true, + 'pro' => true + , + 'mw' => + 'ac' => true, + 'biz' => true, + 'co' => true, + 'com' => true, + 'coop' => true, + 'edu' => true, + 'gov' => true, + 'int' => true, + 'museum' => true, + 'net' => true, + 'org' => true + , + 'mx' => + 'com' => true, + 'org' => true, + 'gob' => true, + 'edu' => true, + 'net' => true, + 'blogspot' => true + , + 'my' => + 'biz' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'mil' => true, + 'name' => true, + 'net' => true, + 'org' => true, + 'blogspot' => true + , + 'mz' => + 'ac' => true, + 'adv' => true, + 'co' => true, + 'edu' => true, + 'gov' => true, + 'mil' => true, + 'net' => true, + 'org' => true + , + 'na' => + 'info' => true, + 'pro' => true, + 'name' => true, + 'school' => true, + 'or' => true, + 'dr' => true, + 'us' => true, + 'mx' => true, + 'ca' => true, + 'in' => true, + 'cc' => true, + 'tv' => true, + 'ws' => true, + 'mobi' => true, + 'co' => true, + 'com' => true, + 'org' => true + , + 'name' => + 'her' => + 'forgot' => true + , + 'his' => + 'forgot' => true + + , + 'nc' => + 'asso' => true, + 'nom' => true + , + 'ne' => true, + 'net' => + 'adobeaemcloud' => true, + 'adobeio-static' => true, + 'adobeioruntime' => true, + 'akadns' => true, + 'akamai' => true, + 'akamai-staging' => true, + 'akamaiedge' => true, + 'akamaiedge-staging' => true, + 'akamaihd' => true, + 'akamaihd-staging' => true, + 'akamaiorigin' => true, + 'akamaiorigin-staging' => true, + 'akamaized' => true, + 'akamaized-staging' => true, + 'edgekey' => true, + 'edgekey-staging' => true, + 'edgesuite' => true, + 'edgesuite-staging' => true, + 'alwaysdata' => true, + 'myamaze' => true, + 'cloudfront' => true, + 't3l3p0rt' => true, + 'appudo' => true, + 'atlassian-dev' => + 'prod' => + 'cdn' => true + + , + 'myfritz' => true, + 'onavstack' => true, + 'shopselect' => true, + 'blackbaudcdn' => true, + 'boomla' => true, + 'bplaced' => true, + 'square7' => true, + 'gb' => true, + 'hu' => true, + 'jp' => true, + 'se' => true, + 'uk' => true, + 'in' => true, + 'clickrising' => true, + 'cloudaccess' => true, + 'cdn77-ssl' => true, + 'cdn77' => + 'r' => true + , + 'feste-ip' => true, + 'knx-server' => true, + 'static-access' => true, + 'cryptonomic' => + '*' => true + , + 'dattolocal' => true, + 'mydatto' => true, + 'debian' => true, + 'bitbridge' => true, + 'at-band-camp' => true, + 'blogdns' => true, + 'broke-it' => true, + 'buyshouses' => true, + 'dnsalias' => true, + 'dnsdojo' => true, + 'does-it' => true, + 'dontexist' => true, + 'dynalias' => true, + 'dynathome' => true, + 'endofinternet' => true, + 'from-az' => true, + 'from-co' => true, + 'from-la' => true, + 'from-ny' => true, + 'gets-it' => true, + 'ham-radio-op' => true, + 'homeftp' => true, + 'homeip' => true, + 'homelinux' => true, + 'homeunix' => true, + 'in-the-band' => true, + 'is-a-chef' => true, + 'is-a-geek' => true, + 'isa-geek' => true, + 'kicks-ass' => true, + 'office-on-the' => true, + 'podzone' => true, + 'scrapper-site' => true, + 'selfip' => true, + 'sells-it' => true, + 'servebbs' => true, + 'serveftp' => true, + 'thruhere' => true, + 'webhop' => true, + 'definima' => true, + 'casacam' => true, + 'dynu' => true, + 'dynv6' => true, + 'twmail' => true, + 'ru' => true, + 'channelsdvr' => + 'u' => true + , + 'fastlylb' => + 'map' => true + , + 'fastly' => + 'freetls' => true, + 'map' => true, + 'prod' => + 'a' => true, + 'global' => true + , + 'ssl' => + 'a' => true, + 'b' => true, + 'global' => true + + , + 'edgeapp' => true, + 'flynnhosting' => true, + 'cdn-edges' => true, + 'heteml' => true, + 'cloudfunctions' => true, + 'moonscale' => true, + 'in-dsl' => true, + 'in-vpn' => true, + 'ipifony' => true, + 'iobb' => true, + 'cloudjiffy' => + 'fra1-de' => true, + 'west1-us' => true + , + 'elastx' => + 'jls-sto1' => true, + 'jls-sto2' => true, + 'jls-sto3' => true + , + 'faststacks' => true, + 'massivegrid' => + 'paas' => + 'fr-1' => true, + 'lon-1' => true, + 'lon-2' => true, + 'ny-1' => true, + 'ny-2' => true, + 'sg-1' => true + + , + 'saveincloud' => + 'jelastic' => true, + 'nordeste-idc' => true + , + 'scaleforce' => + 'j' => true + , + 'tsukaeru' => + 'jelastic' => true + , + 'kinghost' => true, + 'uni5' => true, + 'krellian' => true, + 'barsy' => true, + 'memset' => true, + 'azurewebsites' => true, + 'azure-mobile' => true, + 'cloudapp' => true, + 'azurestaticapps' => + '1' => true, + '2' => true, + '3' => true, + '4' => true, + '5' => true, + '6' => true, + '7' => true, + 'centralus' => true, + 'eastasia' => true, + 'eastus2' => true, + 'westeurope' => true, + 'westus2' => true + , + 'dnsup' => true, + 'hicam' => true, + 'now-dns' => true, + 'ownip' => true, + 'vpndns' => true, + 'eating-organic' => true, + 'mydissent' => true, + 'myeffect' => true, + 'mymediapc' => true, + 'mypsx' => true, + 'mysecuritycamera' => true, + 'nhlfan' => true, + 'no-ip' => true, + 'pgafan' => true, + 'privatizehealthinsurance' => true, + 'bounceme' => true, + 'ddns' => true, + 'redirectme' => true, + 'serveblog' => true, + 'serveminecraft' => true, + 'sytes' => true, + 'cloudycluster' => true, + 'ovh' => + 'webpaas' => + '*' => true + , + 'hosting' => + '*' => true + + , + 'bar0' => true, + 'bar1' => true, + 'bar2' => true, + 'rackmaze' => true, + 'squares' => true, + 'schokokeks' => true, + 'firewall-gateway' => true, + 'seidat' => true, + 'senseering' => true, + 'siteleaf' => true, + 'vps-host' => + 'jelastic' => + 'atl' => true, + 'njs' => true, + 'ric' => true + + , + 'myspreadshop' => true, + 'srcf' => + 'soc' => true, + 'user' => true + , + 'supabase' => true, + 'dsmynas' => true, + 'familyds' => true, + 'tailscale' => + 'beta' => true + , + 'ts' => true, + 'torproject' => + 'pages' => true + , + 'reserve-online' => true, + 'community-pro' => true, + 'meinforum' => true, + 'yandexcloud' => + 'storage' => true, + 'website' => true + , + 'za' => true + , + 'nf' => + 'com' => true, + 'net' => true, + 'per' => true, + 'rec' => true, + 'web' => true, + 'arts' => true, + 'firm' => true, + 'info' => true, + 'other' => true, + 'store' => true + , + 'ng' => + 'com' => + 'blogspot' => true + , + 'edu' => true, + 'gov' => true, + 'i' => true, + 'mil' => true, + 'mobi' => true, + 'name' => true, + 'net' => true, + 'org' => true, + 'sch' => true, + 'col' => true, + 'firm' => true, + 'gen' => true, + 'ltd' => true, + 'ngo' => true + , + 'ni' => + 'ac' => true, + 'biz' => true, + 'co' => true, + 'com' => true, + 'edu' => true, + 'gob' => true, + 'in' => true, + 'info' => true, + 'int' => true, + 'mil' => true, + 'net' => true, + 'nom' => true, + 'org' => true, + 'web' => true + , + 'nl' => + 'co' => true, + 'hosting-cluster' => true, + 'blogspot' => true, + 'gov' => true, + 'khplay' => true, + '123website' => true, + 'myspreadshop' => true, + 'transurl' => + '*' => true + , + 'cistron' => true, + 'demon' => true + , + 'no' => + 'fhs' => true, + 'vgs' => true, + 'fylkesbibl' => true, + 'folkebibl' => true, + 'museum' => true, + 'idrett' => true, + 'priv' => true, + 'mil' => true, + 'stat' => true, + 'dep' => true, + 'kommune' => true, + 'herad' => true, + 'aa' => + 'gs' => true + , + 'ah' => + 'gs' => true + , + 'bu' => + 'gs' => true + , + 'fm' => + 'gs' => true + , + 'hl' => + 'gs' => true + , + 'hm' => + 'gs' => true + , + 'jan-mayen' => + 'gs' => true + , + 'mr' => + 'gs' => true + , + 'nl' => + 'gs' => true + , + 'nt' => + 'gs' => true + , + 'of' => + 'gs' => true + , + 'ol' => + 'gs' => true + , + 'oslo' => + 'gs' => true + , + 'rl' => + 'gs' => true + , + 'sf' => + 'gs' => true + , + 'st' => + 'gs' => true + , + 'svalbard' => + 'gs' => true + , + 'tm' => + 'gs' => true + , + 'tr' => + 'gs' => true + , + 'va' => + 'gs' => true + , + 'vf' => + 'gs' => true + , + 'akrehamn' => true, + 'åkrehamn' => true, + 'algard' => true, + 'ålgård' => true, + 'arna' => true, + 'brumunddal' => true, + 'bryne' => true, + 'bronnoysund' => true, + 'brønnøysund' => true, + 'drobak' => true, + 'drøbak' => true, + 'egersund' => true, + 'fetsund' => true, + 'floro' => true, + 'florø' => true, + 'fredrikstad' => true, + 'hokksund' => true, + 'honefoss' => true, + 'hønefoss' => true, + 'jessheim' => true, + 'jorpeland' => true, + 'jørpeland' => true, + 'kirkenes' => true, + 'kopervik' => true, + 'krokstadelva' => true, + 'langevag' => true, + 'langevåg' => true, + 'leirvik' => true, + 'mjondalen' => true, + 'mjøndalen' => true, + 'mo-i-rana' => true, + 'mosjoen' => true, + 'mosjøen' => true, + 'nesoddtangen' => true, + 'orkanger' => true, + 'osoyro' => true, + 'osøyro' => true, + 'raholt' => true, + 'råholt' => true, + 'sandnessjoen' => true, + 'sandnessjøen' => true, + 'skedsmokorset' => true, + 'slattum' => true, + 'spjelkavik' => true, + 'stathelle' => true, + 'stavern' => true, + 'stjordalshalsen' => true, + 'stjørdalshalsen' => true, + 'tananger' => true, + 'tranby' => true, + 'vossevangen' => true, + 'afjord' => true, + 'åfjord' => true, + 'agdenes' => true, + 'al' => true, + 'ål' => true, + 'alesund' => true, + 'ålesund' => true, + 'alstahaug' => true, + 'alta' => true, + 'áltá' => true, + 'alaheadju' => true, + 'álaheadju' => true, + 'alvdal' => true, + 'amli' => true, + 'åmli' => true, + 'amot' => true, + 'åmot' => true, + 'andebu' => true, + 'andoy' => true, + 'andøy' => true, + 'andasuolo' => true, + 'ardal' => true, + 'årdal' => true, + 'aremark' => true, + 'arendal' => true, + 'ås' => true, + 'aseral' => true, + 'åseral' => true, + 'asker' => true, + 'askim' => true, + 'askvoll' => true, + 'askoy' => true, + 'askøy' => true, + 'asnes' => true, + 'åsnes' => true, + 'audnedaln' => true, + 'aukra' => true, + 'aure' => true, + 'aurland' => true, + 'aurskog-holand' => true, + 'aurskog-høland' => true, + 'austevoll' => true, + 'austrheim' => true, + 'averoy' => true, + 'averøy' => true, + 'balestrand' => true, + 'ballangen' => true, + 'balat' => true, + 'bálát' => true, + 'balsfjord' => true, + 'bahccavuotna' => true, + 'báhccavuotna' => true, + 'bamble' => true, + 'bardu' => true, + 'beardu' => true, + 'beiarn' => true, + 'bajddar' => true, + 'bájddar' => true, + 'baidar' => true, + 'báidár' => true, + 'berg' => true, + 'bergen' => true, + 'berlevag' => true, + 'berlevåg' => true, + 'bearalvahki' => true, + 'bearalváhki' => true, + 'bindal' => true, + 'birkenes' => true, + 'bjarkoy' => true, + 'bjarkøy' => true, + 'bjerkreim' => true, + 'bjugn' => true, + 'bodo' => true, + 'bodø' => true, + 'badaddja' => true, + 'bådåddjå' => true, + 'budejju' => true, + 'bokn' => true, + 'bremanger' => true, + 'bronnoy' => true, + 'brønnøy' => true, + 'bygland' => true, + 'bykle' => true, + 'barum' => true, + 'bærum' => true, + 'telemark' => + 'bo' => true, + 'bø' => true + , + 'nordland' => + 'bo' => true, + 'bø' => true, + 'heroy' => true, + 'herøy' => true + , + 'bievat' => true, + 'bievát' => true, + 'bomlo' => true, + 'bømlo' => true, + 'batsfjord' => true, + 'båtsfjord' => true, + 'bahcavuotna' => true, + 'báhcavuotna' => true, + 'dovre' => true, + 'drammen' => true, + 'drangedal' => true, + 'dyroy' => true, + 'dyrøy' => true, + 'donna' => true, + 'dønna' => true, + 'eid' => true, + 'eidfjord' => true, + 'eidsberg' => true, + 'eidskog' => true, + 'eidsvoll' => true, + 'eigersund' => true, + 'elverum' => true, + 'enebakk' => true, + 'engerdal' => true, + 'etne' => true, + 'etnedal' => true, + 'evenes' => true, + 'evenassi' => true, + 'evenášši' => true, + 'evje-og-hornnes' => true, + 'farsund' => true, + 'fauske' => true, + 'fuossko' => true, + 'fuoisku' => true, + 'fedje' => true, + 'fet' => true, + 'finnoy' => true, + 'finnøy' => true, + 'fitjar' => true, + 'fjaler' => true, + 'fjell' => true, + 'flakstad' => true, + 'flatanger' => true, + 'flekkefjord' => true, + 'flesberg' => true, + 'flora' => true, + 'fla' => true, + 'flå' => true, + 'folldal' => true, + 'forsand' => true, + 'fosnes' => true, + 'frei' => true, + 'frogn' => true, + 'froland' => true, + 'frosta' => true, + 'frana' => true, + 'fræna' => true, + 'froya' => true, + 'frøya' => true, + 'fusa' => true, + 'fyresdal' => true, + 'forde' => true, + 'førde' => true, + 'gamvik' => true, + 'gangaviika' => true, + 'gáŋgaviika' => true, + 'gaular' => true, + 'gausdal' => true, + 'gildeskal' => true, + 'gildeskål' => true, + 'giske' => true, + 'gjemnes' => true, + 'gjerdrum' => true, + 'gjerstad' => true, + 'gjesdal' => true, + 'gjovik' => true, + 'gjøvik' => true, + 'gloppen' => true, + 'gol' => true, + 'gran' => true, + 'grane' => true, + 'granvin' => true, + 'gratangen' => true, + 'grimstad' => true, + 'grong' => true, + 'kraanghke' => true, + 'kråanghke' => true, + 'grue' => true, + 'gulen' => true, + 'hadsel' => true, + 'halden' => true, + 'halsa' => true, + 'hamar' => true, + 'hamaroy' => true, + 'habmer' => true, + 'hábmer' => true, + 'hapmir' => true, + 'hápmir' => true, + 'hammerfest' => true, + 'hammarfeasta' => true, + 'hámmárfeasta' => true, + 'haram' => true, + 'hareid' => true, + 'harstad' => true, + 'hasvik' => true, + 'aknoluokta' => true, + 'ákŋoluokta' => true, + 'hattfjelldal' => true, + 'aarborte' => true, + 'haugesund' => true, + 'hemne' => true, + 'hemnes' => true, + 'hemsedal' => true, + 'more-og-romsdal' => + 'heroy' => true, + 'sande' => true + , + 'møre-og-romsdal' => + 'herøy' => true, + 'sande' => true + , + 'hitra' => true, + 'hjartdal' => true, + 'hjelmeland' => true, + 'hobol' => true, + 'hobøl' => true, + 'hof' => true, + 'hol' => true, + 'hole' => true, + 'holmestrand' => true, + 'holtalen' => true, + 'holtålen' => true, + 'hornindal' => true, + 'horten' => true, + 'hurdal' => true, + 'hurum' => true, + 'hvaler' => true, + 'hyllestad' => true, + 'hagebostad' => true, + 'hægebostad' => true, + 'hoyanger' => true, + 'høyanger' => true, + 'hoylandet' => true, + 'høylandet' => true, + 'ha' => true, + 'hå' => true, + 'ibestad' => true, + 'inderoy' => true, + 'inderøy' => true, + 'iveland' => true, + 'jevnaker' => true, + 'jondal' => true, + 'jolster' => true, + 'jølster' => true, + 'karasjok' => true, + 'karasjohka' => true, + 'kárášjohka' => true, + 'karlsoy' => true, + 'galsa' => true, + 'gálsá' => true, + 'karmoy' => true, + 'karmøy' => true, + 'kautokeino' => true, + 'guovdageaidnu' => true, + 'klepp' => true, + 'klabu' => true, + 'klæbu' => true, + 'kongsberg' => true, + 'kongsvinger' => true, + 'kragero' => true, + 'kragerø' => true, + 'kristiansand' => true, + 'kristiansund' => true, + 'krodsherad' => true, + 'krødsherad' => true, + 'kvalsund' => true, + 'rahkkeravju' => true, + 'ráhkkerávju' => true, + 'kvam' => true, + 'kvinesdal' => true, + 'kvinnherad' => true, + 'kviteseid' => true, + 'kvitsoy' => true, + 'kvitsøy' => true, + 'kvafjord' => true, + 'kvæfjord' => true, + 'giehtavuoatna' => true, + 'kvanangen' => true, + 'kvænangen' => true, + 'navuotna' => true, + 'návuotna' => true, + 'kafjord' => true, + 'kåfjord' => true, + 'gaivuotna' => true, + 'gáivuotna' => true, + 'larvik' => true, + 'lavangen' => true, + 'lavagis' => true, + 'loabat' => true, + 'loabát' => true, + 'lebesby' => true, + 'davvesiida' => true, + 'leikanger' => true, + 'leirfjord' => true, + 'leka' => true, + 'leksvik' => true, + 'lenvik' => true, + 'leangaviika' => true, + 'leaŋgaviika' => true, + 'lesja' => true, + 'levanger' => true, + 'lier' => true, + 'lierne' => true, + 'lillehammer' => true, + 'lillesand' => true, + 'lindesnes' => true, + 'lindas' => true, + 'lindås' => true, + 'lom' => true, + 'loppa' => true, + 'lahppi' => true, + 'láhppi' => true, + 'lund' => true, + 'lunner' => true, + 'luroy' => true, + 'lurøy' => true, + 'luster' => true, + 'lyngdal' => true, + 'lyngen' => true, + 'ivgu' => true, + 'lardal' => true, + 'lerdal' => true, + 'lærdal' => true, + 'lodingen' => true, + 'lødingen' => true, + 'lorenskog' => true, + 'lørenskog' => true, + 'loten' => true, + 'løten' => true, + 'malvik' => true, + 'masoy' => true, + 'måsøy' => true, + 'muosat' => true, + 'muosát' => true, + 'mandal' => true, + 'marker' => true, + 'marnardal' => true, + 'masfjorden' => true, + 'meland' => true, + 'meldal' => true, + 'melhus' => true, + 'meloy' => true, + 'meløy' => true, + 'meraker' => true, + 'meråker' => true, + 'moareke' => true, + 'moåreke' => true, + 'midsund' => true, + 'midtre-gauldal' => true, + 'modalen' => true, + 'modum' => true, + 'molde' => true, + 'moskenes' => true, + 'moss' => true, + 'mosvik' => true, + 'malselv' => true, + 'målselv' => true, + 'malatvuopmi' => true, + 'málatvuopmi' => true, + 'namdalseid' => true, + 'aejrie' => true, + 'namsos' => true, + 'namsskogan' => true, + 'naamesjevuemie' => true, + 'nååmesjevuemie' => true, + 'laakesvuemie' => true, + 'nannestad' => true, + 'narvik' => true, + 'narviika' => true, + 'naustdal' => true, + 'nedre-eiker' => true, + 'akershus' => + 'nes' => true + , + 'buskerud' => + 'nes' => true + , + 'nesna' => true, + 'nesodden' => true, + 'nesseby' => true, + 'unjarga' => true, + 'unjárga' => true, + 'nesset' => true, + 'nissedal' => true, + 'nittedal' => true, + 'nord-aurdal' => true, + 'nord-fron' => true, + 'nord-odal' => true, + 'norddal' => true, + 'nordkapp' => true, + 'davvenjarga' => true, + 'davvenjárga' => true, + 'nordre-land' => true, + 'nordreisa' => true, + 'raisa' => true, + 'ráisa' => true, + 'nore-og-uvdal' => true, + 'notodden' => true, + 'naroy' => true, + 'nærøy' => true, + 'notteroy' => true, + 'nøtterøy' => true, + 'odda' => true, + 'oksnes' => true, + 'øksnes' => true, + 'oppdal' => true, + 'oppegard' => true, + 'oppegård' => true, + 'orkdal' => true, + 'orland' => true, + 'ørland' => true, + 'orskog' => true, + 'ørskog' => true, + 'orsta' => true, + 'ørsta' => true, + 'hedmark' => + 'os' => true, + 'valer' => true, + 'våler' => true + , + 'hordaland' => + 'os' => true + , + 'osen' => true, + 'osteroy' => true, + 'osterøy' => true, + 'ostre-toten' => true, + 'østre-toten' => true, + 'overhalla' => true, + 'ovre-eiker' => true, + 'øvre-eiker' => true, + 'oyer' => true, + 'øyer' => true, + 'oygarden' => true, + 'øygarden' => true, + 'oystre-slidre' => true, + 'øystre-slidre' => true, + 'porsanger' => true, + 'porsangu' => true, + 'porsáŋgu' => true, + 'porsgrunn' => true, + 'radoy' => true, + 'radøy' => true, + 'rakkestad' => true, + 'rana' => true, + 'ruovat' => true, + 'randaberg' => true, + 'rauma' => true, + 'rendalen' => true, + 'rennebu' => true, + 'rennesoy' => true, + 'rennesøy' => true, + 'rindal' => true, + 'ringebu' => true, + 'ringerike' => true, + 'ringsaker' => true, + 'rissa' => true, + 'risor' => true, + 'risør' => true, + 'roan' => true, + 'rollag' => true, + 'rygge' => true, + 'ralingen' => true, + 'rælingen' => true, + 'rodoy' => true, + 'rødøy' => true, + 'romskog' => true, + 'rømskog' => true, + 'roros' => true, + 'røros' => true, + 'rost' => true, + 'røst' => true, + 'royken' => true, + 'røyken' => true, + 'royrvik' => true, + 'røyrvik' => true, + 'rade' => true, + 'råde' => true, + 'salangen' => true, + 'siellak' => true, + 'saltdal' => true, + 'salat' => true, + 'sálát' => true, + 'sálat' => true, + 'samnanger' => true, + 'vestfold' => + 'sande' => true + , + 'sandefjord' => true, + 'sandnes' => true, + 'sandoy' => true, + 'sandøy' => true, + 'sarpsborg' => true, + 'sauda' => true, + 'sauherad' => true, + 'sel' => true, + 'selbu' => true, + 'selje' => true, + 'seljord' => true, + 'sigdal' => true, + 'siljan' => true, + 'sirdal' => true, + 'skaun' => true, + 'skedsmo' => true, + 'ski' => true, + 'skien' => true, + 'skiptvet' => true, + 'skjervoy' => true, + 'skjervøy' => true, + 'skierva' => true, + 'skiervá' => true, + 'skjak' => true, + 'skjåk' => true, + 'skodje' => true, + 'skanland' => true, + 'skånland' => true, + 'skanit' => true, + 'skánit' => true, + 'smola' => true, + 'smøla' => true, + 'snillfjord' => true, + 'snasa' => true, + 'snåsa' => true, + 'snoasa' => true, + 'snaase' => true, + 'snåase' => true, + 'sogndal' => true, + 'sokndal' => true, + 'sola' => true, + 'solund' => true, + 'songdalen' => true, + 'sortland' => true, + 'spydeberg' => true, + 'stange' => true, + 'stavanger' => true, + 'steigen' => true, + 'steinkjer' => true, + 'stjordal' => true, + 'stjørdal' => true, + 'stokke' => true, + 'stor-elvdal' => true, + 'stord' => true, + 'stordal' => true, + 'storfjord' => true, + 'omasvuotna' => true, + 'strand' => true, + 'stranda' => true, + 'stryn' => true, + 'sula' => true, + 'suldal' => true, + 'sund' => true, + 'sunndal' => true, + 'surnadal' => true, + 'sveio' => true, + 'svelvik' => true, + 'sykkylven' => true, + 'sogne' => true, + 'søgne' => true, + 'somna' => true, + 'sømna' => true, + 'sondre-land' => true, + 'søndre-land' => true, + 'sor-aurdal' => true, + 'sør-aurdal' => true, + 'sor-fron' => true, + 'sør-fron' => true, + 'sor-odal' => true, + 'sør-odal' => true, + 'sor-varanger' => true, + 'sør-varanger' => true, + 'matta-varjjat' => true, + 'mátta-várjjat' => true, + 'sorfold' => true, + 'sørfold' => true, + 'sorreisa' => true, + 'sørreisa' => true, + 'sorum' => true, + 'sørum' => true, + 'tana' => true, + 'deatnu' => true, + 'time' => true, + 'tingvoll' => true, + 'tinn' => true, + 'tjeldsund' => true, + 'dielddanuorri' => true, + 'tjome' => true, + 'tjøme' => true, + 'tokke' => true, + 'tolga' => true, + 'torsken' => true, + 'tranoy' => true, + 'tranøy' => true, + 'tromso' => true, + 'tromsø' => true, + 'tromsa' => true, + 'romsa' => true, + 'trondheim' => true, + 'troandin' => true, + 'trysil' => true, + 'trana' => true, + 'træna' => true, + 'trogstad' => true, + 'trøgstad' => true, + 'tvedestrand' => true, + 'tydal' => true, + 'tynset' => true, + 'tysfjord' => true, + 'divtasvuodna' => true, + 'divttasvuotna' => true, + 'tysnes' => true, + 'tysvar' => true, + 'tysvær' => true, + 'tonsberg' => true, + 'tønsberg' => true, + 'ullensaker' => true, + 'ullensvang' => true, + 'ulvik' => true, + 'utsira' => true, + 'vadso' => true, + 'vadsø' => true, + 'cahcesuolo' => true, + 'čáhcesuolo' => true, + 'vaksdal' => true, + 'valle' => true, + 'vang' => true, + 'vanylven' => true, + 'vardo' => true, + 'vardø' => true, + 'varggat' => true, + 'várggát' => true, + 'vefsn' => true, + 'vaapste' => true, + 'vega' => true, + 'vegarshei' => true, + 'vegårshei' => true, + 'vennesla' => true, + 'verdal' => true, + 'verran' => true, + 'vestby' => true, + 'vestnes' => true, + 'vestre-slidre' => true, + 'vestre-toten' => true, + 'vestvagoy' => true, + 'vestvågøy' => true, + 'vevelstad' => true, + 'vik' => true, + 'vikna' => true, + 'vindafjord' => true, + 'volda' => true, + 'voss' => true, + 'varoy' => true, + 'værøy' => true, + 'vagan' => true, + 'vågan' => true, + 'voagat' => true, + 'vagsoy' => true, + 'vågsøy' => true, + 'vaga' => true, + 'vågå' => true, + 'ostfold' => + 'valer' => true + , + 'østfold' => + 'våler' => true + , + 'co' => true, + 'blogspot' => true, + '123hjemmeside' => true, + 'myspreadshop' => true + , + 'np' => + '*' => true + , + 'nr' => + 'biz' => true, + 'info' => true, + 'gov' => true, + 'edu' => true, + 'org' => true, + 'net' => true, + 'com' => true + , + 'nu' => + 'merseine' => true, + 'mine' => true, + 'shacknet' => true, + 'enterprisecloud' => true + , + 'nz' => + 'ac' => true, + 'co' => + 'blogspot' => true + , + 'cri' => true, + 'geek' => true, + 'gen' => true, + 'govt' => true, + 'health' => true, + 'iwi' => true, + 'kiwi' => true, + 'maori' => true, + 'mil' => true, + 'māori' => true, + 'net' => true, + 'org' => true, + 'parliament' => true, + 'school' => true + , + 'om' => + 'co' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'med' => true, + 'museum' => true, + 'net' => true, + 'org' => true, + 'pro' => true + , + 'onion' => true, + 'org' => + 'altervista' => true, + 'amune' => + 'tele' => true + , + 'pimienta' => true, + 'poivron' => true, + 'potager' => true, + 'sweetpepper' => true, + 'ae' => true, + 'us' => true, + 'certmgr' => true, + 'cdn77' => + 'c' => true, + 'rsc' => true + , + 'cdn77-secure' => + 'origin' => + 'ssl' => true + + , + 'cloudns' => true, + 'duckdns' => true, + 'tunk' => true, + 'dyndns' => + 'go' => true, + 'home' => true + , + 'blogdns' => true, + 'blogsite' => true, + 'boldlygoingnowhere' => true, + 'dnsalias' => true, + 'dnsdojo' => true, + 'doesntexist' => true, + 'dontexist' => true, + 'doomdns' => true, + 'dvrdns' => true, + 'dynalias' => true, + 'endofinternet' => true, + 'endoftheinternet' => true, + 'from-me' => true, + 'game-host' => true, + 'gotdns' => true, + 'hobby-site' => true, + 'homedns' => true, + 'homeftp' => true, + 'homelinux' => true, + 'homeunix' => true, + 'is-a-bruinsfan' => true, + 'is-a-candidate' => true, + 'is-a-celticsfan' => true, + 'is-a-chef' => true, + 'is-a-geek' => true, + 'is-a-knight' => true, + 'is-a-linux-user' => true, + 'is-a-patsfan' => true, + 'is-a-soxfan' => true, + 'is-found' => true, + 'is-lost' => true, + 'is-saved' => true, + 'is-very-bad' => true, + 'is-very-evil' => true, + 'is-very-good' => true, + 'is-very-nice' => true, + 'is-very-sweet' => true, + 'isa-geek' => true, + 'kicks-ass' => true, + 'misconfused' => true, + 'podzone' => true, + 'readmyblog' => true, + 'selfip' => true, + 'sellsyourhome' => true, + 'servebbs' => true, + 'serveftp' => true, + 'servegame' => true, + 'stuff-4-sale' => true, + 'webhop' => true, + 'ddnss' => true, + 'accesscam' => true, + 'camdvr' => true, + 'freeddns' => true, + 'mywire' => true, + 'webredirect' => true, + 'eu' => + 'al' => true, + 'asso' => true, + 'at' => true, + 'au' => true, + 'be' => true, + 'bg' => true, + 'ca' => true, + 'cd' => true, + 'ch' => true, + 'cn' => true, + 'cy' => true, + 'cz' => true, + 'de' => true, + 'dk' => true, + 'edu' => true, + 'ee' => true, + 'es' => true, + 'fi' => true, + 'fr' => true, + 'gr' => true, + 'hr' => true, + 'hu' => true, + 'ie' => true, + 'il' => true, + 'in' => true, + 'int' => true, + 'is' => true, + 'it' => true, + 'jp' => true, + 'kr' => true, + 'lt' => true, + 'lu' => true, + 'lv' => true, + 'mc' => true, + 'me' => true, + 'mk' => true, + 'mt' => true, + 'my' => true, + 'net' => true, + 'ng' => true, + 'nl' => true, + 'no' => true, + 'nz' => true, + 'paris' => true, + 'pl' => true, + 'pt' => true, + 'q-a' => true, + 'ro' => true, + 'ru' => true, + 'se' => true, + 'si' => true, + 'sk' => true, + 'tr' => true, + 'uk' => true, + 'us' => true + , + 'twmail' => true, + 'fedorainfracloud' => true, + 'fedorapeople' => true, + 'fedoraproject' => + 'cloud' => true, + 'os' => + 'app' => true + , + 'stg' => + 'os' => + 'app' => true + + + , + 'freedesktop' => true, + 'hepforge' => true, + 'in-dsl' => true, + 'in-vpn' => true, + 'js' => true, + 'barsy' => true, + 'mayfirst' => true, + 'mozilla-iot' => true, + 'bmoattachments' => true, + 'dynserv' => true, + 'now-dns' => true, + 'cable-modem' => true, + 'collegefan' => true, + 'couchpotatofries' => true, + 'mlbfan' => true, + 'mysecuritycamera' => true, + 'nflfan' => true, + 'read-books' => true, + 'ufcfan' => true, + 'hopto' => true, + 'myftp' => true, + 'no-ip' => true, + 'zapto' => true, + 'httpbin' => true, + 'pubtls' => true, + 'jpn' => true, + 'my-firewall' => true, + 'myfirewall' => true, + 'spdns' => true, + 'small-web' => true, + 'dsmynas' => true, + 'familyds' => true, + 'teckids' => + 's3' => true + , + 'tuxfamily' => true, + 'diskstation' => true, + 'hk' => true, + 'wmflabs' => true, + 'toolforge' => true, + 'wmcloud' => true, + 'za' => true + , + 'pa' => + 'ac' => true, + 'gob' => true, + 'com' => true, + 'org' => true, + 'sld' => true, + 'edu' => true, + 'net' => true, + 'ing' => true, + 'abo' => true, + 'med' => true, + 'nom' => true + , + 'pe' => + 'edu' => true, + 'gob' => true, + 'nom' => true, + 'mil' => true, + 'org' => true, + 'com' => true, + 'net' => true, + 'blogspot' => true + , + 'pf' => + 'com' => true, + 'org' => true, + 'edu' => true + , + 'pg' => + '*' => true + , + 'ph' => + 'com' => true, + 'net' => true, + 'org' => true, + 'gov' => true, + 'edu' => true, + 'ngo' => true, + 'mil' => true, + 'i' => true + , + 'pk' => + 'com' => true, + 'net' => true, + 'edu' => true, + 'org' => true, + 'fam' => true, + 'biz' => true, + 'web' => true, + 'gov' => true, + 'gob' => true, + 'gok' => true, + 'gon' => true, + 'gop' => true, + 'gos' => true, + 'info' => true + , + 'pl' => + 'com' => true, + 'net' => true, + 'org' => true, + 'aid' => true, + 'agro' => true, + 'atm' => true, + 'auto' => true, + 'biz' => true, + 'edu' => true, + 'gmina' => true, + 'gsm' => true, + 'info' => true, + 'mail' => true, + 'miasta' => true, + 'media' => true, + 'mil' => true, + 'nieruchomosci' => true, + 'nom' => true, + 'pc' => true, + 'powiat' => true, + 'priv' => true, + 'realestate' => true, + 'rel' => true, + 'sex' => true, + 'shop' => true, + 'sklep' => true, + 'sos' => true, + 'szkola' => true, + 'targi' => true, + 'tm' => true, + 'tourism' => true, + 'travel' => true, + 'turystyka' => true, + 'gov' => + 'ap' => true, + 'griw' => true, + 'ic' => true, + 'is' => true, + 'kmpsp' => true, + 'konsulat' => true, + 'kppsp' => true, + 'kwp' => true, + 'kwpsp' => true, + 'mup' => true, + 'mw' => true, + 'oia' => true, + 'oirm' => true, + 'oke' => true, + 'oow' => true, + 'oschr' => true, + 'oum' => true, + 'pa' => true, + 'pinb' => true, + 'piw' => true, + 'po' => true, + 'pr' => true, + 'psp' => true, + 'psse' => true, + 'pup' => true, + 'rzgw' => true, + 'sa' => true, + 'sdn' => true, + 'sko' => true, + 'so' => true, + 'sr' => true, + 'starostwo' => true, + 'ug' => true, + 'ugim' => true, + 'um' => true, + 'umig' => true, + 'upow' => true, + 'uppo' => true, + 'us' => true, + 'uw' => true, + 'uzs' => true, + 'wif' => true, + 'wiih' => true, + 'winb' => true, + 'wios' => true, + 'witd' => true, + 'wiw' => true, + 'wkz' => true, + 'wsa' => true, + 'wskr' => true, + 'wsse' => true, + 'wuoz' => true, + 'wzmiuw' => true, + 'zp' => true, + 'zpisdn' => true + , + 'augustow' => true, + 'babia-gora' => true, + 'bedzin' => true, + 'beskidy' => true, + 'bialowieza' => true, + 'bialystok' => true, + 'bielawa' => true, + 'bieszczady' => true, + 'boleslawiec' => true, + 'bydgoszcz' => true, + 'bytom' => true, + 'cieszyn' => true, + 'czeladz' => true, + 'czest' => true, + 'dlugoleka' => true, + 'elblag' => true, + 'elk' => true, + 'glogow' => true, + 'gniezno' => true, + 'gorlice' => true, + 'grajewo' => true, + 'ilawa' => true, + 'jaworzno' => true, + 'jelenia-gora' => true, + 'jgora' => true, + 'kalisz' => true, + 'kazimierz-dolny' => true, + 'karpacz' => true, + 'kartuzy' => true, + 'kaszuby' => true, + 'katowice' => true, + 'kepno' => true, + 'ketrzyn' => true, + 'klodzko' => true, + 'kobierzyce' => true, + 'kolobrzeg' => true, + 'konin' => true, + 'konskowola' => true, + 'kutno' => true, + 'lapy' => true, + 'lebork' => true, + 'legnica' => true, + 'lezajsk' => true, + 'limanowa' => true, + 'lomza' => true, + 'lowicz' => true, + 'lubin' => true, + 'lukow' => true, + 'malbork' => true, + 'malopolska' => true, + 'mazowsze' => true, + 'mazury' => true, + 'mielec' => true, + 'mielno' => true, + 'mragowo' => true, + 'naklo' => true, + 'nowaruda' => true, + 'nysa' => true, + 'olawa' => true, + 'olecko' => true, + 'olkusz' => true, + 'olsztyn' => true, + 'opoczno' => true, + 'opole' => true, + 'ostroda' => true, + 'ostroleka' => true, + 'ostrowiec' => true, + 'ostrowwlkp' => true, + 'pila' => true, + 'pisz' => true, + 'podhale' => true, + 'podlasie' => true, + 'polkowice' => true, + 'pomorze' => true, + 'pomorskie' => true, + 'prochowice' => true, + 'pruszkow' => true, + 'przeworsk' => true, + 'pulawy' => true, + 'radom' => true, + 'rawa-maz' => true, + 'rybnik' => true, + 'rzeszow' => true, + 'sanok' => true, + 'sejny' => true, + 'slask' => true, + 'slupsk' => true, + 'sosnowiec' => true, + 'stalowa-wola' => true, + 'skoczow' => true, + 'starachowice' => true, + 'stargard' => true, + 'suwalki' => true, + 'swidnica' => true, + 'swiebodzin' => true, + 'swinoujscie' => true, + 'szczecin' => true, + 'szczytno' => true, + 'tarnobrzeg' => true, + 'tgory' => true, + 'turek' => true, + 'tychy' => true, + 'ustka' => true, + 'walbrzych' => true, + 'warmia' => true, + 'warszawa' => true, + 'waw' => true, + 'wegrow' => true, + 'wielun' => true, + 'wlocl' => true, + 'wloclawek' => true, + 'wodzislaw' => true, + 'wolomin' => true, + 'wroclaw' => true, + 'zachpomor' => true, + 'zagan' => true, + 'zarow' => true, + 'zgora' => true, + 'zgorzelec' => true, + 'beep' => true, + 'ecommerce-shop' => true, + 'shoparena' => true, + 'homesklep' => true, + 'sdscloud' => true, + 'unicloud' => true, + 'krasnik' => true, + 'leczna' => true, + 'lubartow' => true, + 'lublin' => true, + 'poniatowa' => true, + 'swidnik' => true, + 'co' => true, + 'simplesite' => true, + 'art' => true, + 'gliwice' => true, + 'krakow' => true, + 'poznan' => true, + 'wroc' => true, + 'zakopane' => true, + 'myspreadshop' => true, + 'gda' => true, + 'gdansk' => true, + 'gdynia' => true, + 'med' => true, + 'sopot' => true + , + 'pm' => + 'own' => true, + 'name' => true + , + 'pn' => + 'gov' => true, + 'co' => true, + 'org' => true, + 'edu' => true, + 'net' => true + , + 'post' => true, + 'pr' => + 'com' => true, + 'net' => true, + 'org' => true, + 'gov' => true, + 'edu' => true, + 'isla' => true, + 'pro' => true, + 'biz' => true, + 'info' => true, + 'name' => true, + 'est' => true, + 'prof' => true, + 'ac' => true + , + 'pro' => + 'aaa' => true, + 'aca' => true, + 'acct' => true, + 'avocat' => true, + 'bar' => true, + 'cpa' => true, + 'eng' => true, + 'jur' => true, + 'law' => true, + 'med' => true, + 'recht' => true, + 'cloudns' => true, + 'dnstrace' => + 'bci' => true + , + 'barsy' => true + , + 'ps' => + 'edu' => true, + 'gov' => true, + 'sec' => true, + 'plo' => true, + 'com' => true, + 'org' => true, + 'net' => true + , + 'pt' => + 'net' => true, + 'gov' => true, + 'org' => true, + 'edu' => true, + 'int' => true, + 'publ' => true, + 'com' => true, + 'nome' => true, + 'blogspot' => true, + '123paginaweb' => true + , + 'pw' => + 'co' => true, + 'ne' => true, + 'or' => true, + 'ed' => true, + 'go' => true, + 'belau' => true, + 'cloudns' => true, + 'x443' => true + , + 'py' => + 'com' => true, + 'coop' => true, + 'edu' => true, + 'gov' => true, + 'mil' => true, + 'net' => true, + 'org' => true + , + 'qa' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'mil' => true, + 'name' => true, + 'net' => true, + 'org' => true, + 'sch' => true, + 'blogspot' => true + , + 're' => + 'asso' => true, + 'com' => true, + 'nom' => true, + 'blogspot' => true + , + 'ro' => + 'arts' => true, + 'com' => true, + 'firm' => true, + 'info' => true, + 'nom' => true, + 'nt' => true, + 'org' => true, + 'rec' => true, + 'store' => true, + 'tm' => true, + 'www' => true, + 'co' => true, + 'shop' => true, + 'blogspot' => true, + 'barsy' => true + , + 'rs' => + 'ac' => true, + 'co' => true, + 'edu' => true, + 'gov' => true, + 'in' => true, + 'org' => true, + 'brendly' => + 'shop' => true + , + 'blogspot' => true, + 'ua' => true, + 'ox' => true + , + 'ru' => + 'ac' => true, + 'edu' => true, + 'gov' => true, + 'int' => true, + 'mil' => true, + 'test' => true, + 'eurodir' => true, + 'adygeya' => true, + 'bashkiria' => true, + 'bir' => true, + 'cbg' => true, + 'com' => true, + 'dagestan' => true, + 'grozny' => true, + 'kalmykia' => true, + 'kustanai' => true, + 'marine' => true, + 'mordovia' => true, + 'msk' => true, + 'mytis' => true, + 'nalchik' => true, + 'nov' => true, + 'pyatigorsk' => true, + 'spb' => true, + 'vladikavkaz' => true, + 'vladimir' => true, + 'blogspot' => true, + 'na4u' => true, + 'mircloud' => true, + 'regruhosting' => + 'jelastic' => true + , + 'myjino' => + 'hosting' => + '*' => true + , + 'landing' => + '*' => true + , + 'spectrum' => + '*' => true + , + 'vps' => + '*' => true + + , + 'cldmail' => + 'hb' => true + , + 'mcdir' => + 'vps' => true + , + 'mcpre' => true, + 'net' => true, + 'org' => true, + 'pp' => true, + '123sait' => true, + 'lk3' => true, + 'ras' => true + , + 'rw' => + 'ac' => true, + 'co' => true, + 'coop' => true, + 'gov' => true, + 'mil' => true, + 'net' => true, + 'org' => true + , + 'sa' => + 'com' => true, + 'net' => true, + 'org' => true, + 'gov' => true, + 'med' => true, + 'pub' => true, + 'edu' => true, + 'sch' => true + , + 'sb' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'net' => true, + 'org' => true + , + 'sc' => + 'com' => true, + 'gov' => true, + 'net' => true, + 'org' => true, + 'edu' => true + , + 'sd' => + 'com' => true, + 'net' => true, + 'org' => true, + 'edu' => true, + 'med' => true, + 'tv' => true, + 'gov' => true, + 'info' => true + , + 'se' => + 'a' => true, + 'ac' => true, + 'b' => true, + 'bd' => true, + 'brand' => true, + 'c' => true, + 'd' => true, + 'e' => true, + 'f' => true, + 'fh' => true, + 'fhsk' => true, + 'fhv' => true, + 'g' => true, + 'h' => true, + 'i' => true, + 'k' => true, + 'komforb' => true, + 'kommunalforbund' => true, + 'komvux' => true, + 'l' => true, + 'lanbib' => true, + 'm' => true, + 'n' => true, + 'naturbruksgymn' => true, + 'o' => true, + 'org' => true, + 'p' => true, + 'parti' => true, + 'pp' => true, + 'press' => true, + 'r' => true, + 's' => true, + 't' => true, + 'tm' => true, + 'u' => true, + 'w' => true, + 'x' => true, + 'y' => true, + 'z' => true, + 'com' => true, + 'blogspot' => true, + 'conf' => true, + 'iopsys' => true, + '123minsida' => true, + 'itcouldbewor' => true, + 'myspreadshop' => true, + 'paba' => + 'su' => true + + , + 'sg' => + 'com' => true, + 'net' => true, + 'org' => true, + 'gov' => true, + 'edu' => true, + 'per' => true, + 'blogspot' => true, + 'enscaled' => true + , + 'sh' => + 'com' => true, + 'net' => true, + 'gov' => true, + 'org' => true, + 'mil' => true, + 'bip' => true, + 'hashbang' => true, + 'platform' => + 'bc' => true, + 'ent' => true, + 'eu' => true, + 'us' => true + , + 'now' => true, + 'vxl' => true, + 'wedeploy' => true + , + 'si' => + 'gitapp' => true, + 'gitpage' => true, + 'blogspot' => true + , + 'sj' => true, + 'sk' => + 'blogspot' => true + , + 'sl' => + 'com' => true, + 'net' => true, + 'edu' => true, + 'gov' => true, + 'org' => true + , + 'sm' => true, + 'sn' => + 'art' => true, + 'com' => true, + 'edu' => true, + 'gouv' => true, + 'org' => true, + 'perso' => true, + 'univ' => true, + 'blogspot' => true + , + 'so' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'me' => true, + 'net' => true, + 'org' => true, + 'sch' => true + , + 'sr' => true, + 'ss' => + 'biz' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'me' => true, + 'net' => true, + 'org' => true, + 'sch' => true + , + 'st' => + 'co' => true, + 'com' => true, + 'consulado' => true, + 'edu' => true, + 'embaixada' => true, + 'mil' => true, + 'net' => true, + 'org' => true, + 'principe' => true, + 'saotome' => true, + 'store' => true, + 'kirara' => true, + 'noho' => true + , + 'su' => + 'abkhazia' => true, + 'adygeya' => true, + 'aktyubinsk' => true, + 'arkhangelsk' => true, + 'armenia' => true, + 'ashgabad' => true, + 'azerbaijan' => true, + 'balashov' => true, + 'bashkiria' => true, + 'bryansk' => true, + 'bukhara' => true, + 'chimkent' => true, + 'dagestan' => true, + 'east-kazakhstan' => true, + 'exnet' => true, + 'georgia' => true, + 'grozny' => true, + 'ivanovo' => true, + 'jambyl' => true, + 'kalmykia' => true, + 'kaluga' => true, + 'karacol' => true, + 'karaganda' => true, + 'karelia' => true, + 'khakassia' => true, + 'krasnodar' => true, + 'kurgan' => true, + 'kustanai' => true, + 'lenug' => true, + 'mangyshlak' => true, + 'mordovia' => true, + 'msk' => true, + 'murmansk' => true, + 'nalchik' => true, + 'navoi' => true, + 'north-kazakhstan' => true, + 'nov' => true, + 'obninsk' => true, + 'penza' => true, + 'pokrovsk' => true, + 'sochi' => true, + 'spb' => true, + 'tashkent' => true, + 'termez' => true, + 'togliatti' => true, + 'troitsk' => true, + 'tselinograd' => true, + 'tula' => true, + 'tuva' => true, + 'vladikavkaz' => true, + 'vladimir' => true, + 'vologda' => true + , + 'sv' => + 'com' => true, + 'edu' => true, + 'gob' => true, + 'org' => true, + 'red' => true + , + 'sx' => + 'gov' => true + , + 'sy' => + 'edu' => true, + 'gov' => true, + 'net' => true, + 'mil' => true, + 'com' => true, + 'org' => true + , + 'sz' => + 'co' => true, + 'ac' => true, + 'org' => true + , + 'tc' => + 'ch' => true, + 'me' => true, + 'we' => true + , + 'td' => + 'blogspot' => true + , + 'tel' => true, + 'tf' => + 'sch' => true + , + 'tg' => true, + 'th' => + 'ac' => true, + 'co' => true, + 'go' => true, + 'in' => true, + 'mi' => true, + 'net' => true, + 'or' => true, + 'online' => true, + 'shop' => true + , + 'tj' => + 'ac' => true, + 'biz' => true, + 'co' => true, + 'com' => true, + 'edu' => true, + 'go' => true, + 'gov' => true, + 'int' => true, + 'mil' => true, + 'name' => true, + 'net' => true, + 'nic' => true, + 'org' => true, + 'test' => true, + 'web' => true + , + 'tk' => true, + 'tl' => + 'gov' => true + , + 'tm' => + 'com' => true, + 'co' => true, + 'org' => true, + 'net' => true, + 'nom' => true, + 'gov' => true, + 'mil' => true, + 'edu' => true + , + 'tn' => + 'com' => true, + 'ens' => true, + 'fin' => true, + 'gov' => true, + 'ind' => true, + 'info' => true, + 'intl' => true, + 'mincom' => true, + 'nat' => true, + 'net' => true, + 'org' => true, + 'perso' => true, + 'tourism' => true, + 'orangecloud' => true + , + 'to' => + 'com' => true, + 'gov' => true, + 'net' => true, + 'org' => true, + 'edu' => true, + 'mil' => true, + '611' => true, + 'oya' => true, + 'rdv' => true, + 'x0' => true, + 'vpnplus' => true, + 'quickconnect' => + 'direct' => true + , + 'nyan' => true + , + 'tr' => + 'av' => true, + 'bbs' => true, + 'bel' => true, + 'biz' => true, + 'com' => + 'blogspot' => true + , + 'dr' => true, + 'edu' => true, + 'gen' => true, + 'gov' => true, + 'info' => true, + 'mil' => true, + 'k12' => true, + 'kep' => true, + 'name' => true, + 'net' => true, + 'org' => true, + 'pol' => true, + 'tel' => true, + 'tsk' => true, + 'tv' => true, + 'web' => true, + 'nc' => + 'gov' => true + + , + 'tt' => + 'co' => true, + 'com' => true, + 'org' => true, + 'net' => true, + 'biz' => true, + 'info' => true, + 'pro' => true, + 'int' => true, + 'coop' => true, + 'jobs' => true, + 'mobi' => true, + 'travel' => true, + 'museum' => true, + 'aero' => true, + 'name' => true, + 'gov' => true, + 'edu' => true + , + 'tv' => + 'dyndns' => true, + 'better-than' => true, + 'on-the-web' => true, + 'worse-than' => true, + 'from' => true, + 'sakura' => true + , + 'tw' => + 'edu' => true, + 'gov' => true, + 'mil' => true, + 'com' => + 'mymailer' => true + , + 'net' => true, + 'org' => true, + 'idv' => true, + 'game' => true, + 'ebiz' => true, + 'club' => true, + '網路' => true, + '組織' => true, + '商業' => true, + 'url' => true, + 'blogspot' => true + , + 'tz' => + 'ac' => true, + 'co' => true, + 'go' => true, + 'hotel' => true, + 'info' => true, + 'me' => true, + 'mil' => true, + 'mobi' => true, + 'ne' => true, + 'or' => true, + 'sc' => true, + 'tv' => true + , + 'ua' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'in' => true, + 'net' => true, + 'org' => true, + 'cherkassy' => true, + 'cherkasy' => true, + 'chernigov' => true, + 'chernihiv' => true, + 'chernivtsi' => true, + 'chernovtsy' => true, + 'ck' => true, + 'cn' => true, + 'cr' => true, + 'crimea' => true, + 'cv' => true, + 'dn' => true, + 'dnepropetrovsk' => true, + 'dnipropetrovsk' => true, + 'donetsk' => true, + 'dp' => true, + 'if' => true, + 'ivano-frankivsk' => true, + 'kh' => true, + 'kharkiv' => true, + 'kharkov' => true, + 'kherson' => true, + 'khmelnitskiy' => true, + 'khmelnytskyi' => true, + 'kiev' => true, + 'kirovograd' => true, + 'km' => true, + 'kr' => true, + 'kropyvnytskyi' => true, + 'krym' => true, + 'ks' => true, + 'kv' => true, + 'kyiv' => true, + 'lg' => true, + 'lt' => true, + 'lugansk' => true, + 'luhansk' => true, + 'lutsk' => true, + 'lv' => true, + 'lviv' => true, + 'mk' => true, + 'mykolaiv' => true, + 'nikolaev' => true, + 'od' => true, + 'odesa' => true, + 'odessa' => true, + 'pl' => true, + 'poltava' => true, + 'rivne' => true, + 'rovno' => true, + 'rv' => true, + 'sb' => true, + 'sebastopol' => true, + 'sevastopol' => true, + 'sm' => true, + 'sumy' => true, + 'te' => true, + 'ternopil' => true, + 'uz' => true, + 'uzhgorod' => true, + 'uzhhorod' => true, + 'vinnica' => true, + 'vinnytsia' => true, + 'vn' => true, + 'volyn' => true, + 'yalta' => true, + 'zakarpattia' => true, + 'zaporizhzhe' => true, + 'zaporizhzhia' => true, + 'zhitomir' => true, + 'zhytomyr' => true, + 'zp' => true, + 'zt' => true, + 'cc' => true, + 'inf' => true, + 'ltd' => true, + 'cx' => true, + 'ie' => true, + 'biz' => true, + 'co' => true, + 'pp' => true, + 'v' => true + , + 'ug' => + 'co' => true, + 'or' => true, + 'ac' => true, + 'sc' => true, + 'go' => true, + 'ne' => true, + 'com' => true, + 'org' => true, + 'blogspot' => true + , + 'uk' => + 'ac' => true, + 'co' => + 'bytemark' => + 'dh' => true, + 'vm' => true + , + 'blogspot' => true, + 'layershift' => + 'j' => true + , + 'barsy' => true, + 'barsyonline' => true, + 'retrosnub' => + 'cust' => true + , + 'nh-serv' => true, + 'no-ip' => true, + 'wellbeingzone' => true, + 'adimo' => true, + 'myspreadshop' => true + , + 'gov' => + 'campaign' => true, + 'service' => true, + 'api' => true, + 'homeoffice' => true + , + 'ltd' => true, + 'me' => true, + 'net' => true, + 'nhs' => true, + 'org' => + 'glug' => true, + 'lug' => true, + 'lugs' => true, + 'affinitylottery' => true, + 'raffleentry' => true, + 'weeklylottery' => true + , + 'plc' => true, + 'police' => true, + 'sch' => + '*' => true + , + 'conn' => true, + 'copro' => true, + 'hosp' => true, + 'independent-commission' => true, + 'independent-inquest' => true, + 'independent-inquiry' => true, + 'independent-panel' => true, + 'independent-review' => true, + 'public-inquiry' => true, + 'royal-commission' => true, + 'pymnt' => true, + 'barsy' => true + , + 'us' => + 'dni' => true, + 'fed' => true, + 'isa' => true, + 'kids' => true, + 'nsn' => true, + 'ak' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'al' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ar' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'as' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'az' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ca' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'co' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ct' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'dc' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'de' => + 'cc' => true, + 'lib' => true + , + 'fl' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ga' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'gu' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'hi' => + 'cc' => true, + 'lib' => true + , + 'ia' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'id' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'il' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'in' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ks' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ky' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'la' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ma' => + 'k12' => + 'pvt' => true, + 'chtr' => true, + 'paroch' => true + , + 'cc' => true, + 'lib' => true + , + 'md' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'me' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'mi' => + 'k12' => true, + 'cc' => true, + 'lib' => true, + 'ann-arbor' => true, + 'cog' => true, + 'dst' => true, + 'eaton' => true, + 'gen' => true, + 'mus' => true, + 'tec' => true, + 'washtenaw' => true + , + 'mn' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'mo' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ms' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'mt' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'nc' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'nd' => + 'cc' => true, + 'lib' => true + , + 'ne' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'nh' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'nj' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'nm' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'nv' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ny' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'oh' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ok' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'or' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'pa' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'pr' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ri' => + 'cc' => true, + 'lib' => true + , + 'sc' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'sd' => + 'cc' => true, + 'lib' => true + , + 'tn' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'tx' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'ut' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'vi' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'vt' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'va' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'wa' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'wi' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'wv' => + 'cc' => true + , + 'wy' => + 'k12' => true, + 'cc' => true, + 'lib' => true + , + 'graphox' => true, + 'cloudns' => true, + 'drud' => true, + 'is-by' => true, + 'land-4-sale' => true, + 'stuff-4-sale' => true, + 'enscaled' => + 'phx' => true + , + 'mircloud' => true, + 'freeddns' => true, + 'golffan' => true, + 'noip' => true, + 'pointto' => true, + 'platterp' => true + , + 'uy' => + 'com' => + 'blogspot' => true + , + 'edu' => true, + 'gub' => true, + 'mil' => true, + 'net' => true, + 'org' => true + , + 'uz' => + 'co' => true, + 'com' => true, + 'net' => true, + 'org' => true + , + 'va' => true, + 'vc' => + 'com' => true, + 'net' => true, + 'org' => true, + 'gov' => true, + 'mil' => true, + 'edu' => true, + 'gv' => + 'd' => true + , + '0e' => true + , + 've' => + 'arts' => true, + 'bib' => true, + 'co' => true, + 'com' => true, + 'e12' => true, + 'edu' => true, + 'firm' => true, + 'gob' => true, + 'gov' => true, + 'info' => true, + 'int' => true, + 'mil' => true, + 'net' => true, + 'nom' => true, + 'org' => true, + 'rar' => true, + 'rec' => true, + 'store' => true, + 'tec' => true, + 'web' => true + , + 'vg' => + 'at' => true + , + 'vi' => + 'co' => true, + 'com' => true, + 'k12' => true, + 'net' => true, + 'org' => true + , + 'vn' => + 'ac' => true, + 'ai' => true, + 'biz' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'health' => true, + 'id' => true, + 'info' => true, + 'int' => true, + 'io' => true, + 'name' => true, + 'net' => true, + 'org' => true, + 'pro' => true, + 'angiang' => true, + 'bacgiang' => true, + 'backan' => true, + 'baclieu' => true, + 'bacninh' => true, + 'baria-vungtau' => true, + 'bentre' => true, + 'binhdinh' => true, + 'binhduong' => true, + 'binhphuoc' => true, + 'binhthuan' => true, + 'camau' => true, + 'cantho' => true, + 'caobang' => true, + 'daklak' => true, + 'daknong' => true, + 'danang' => true, + 'dienbien' => true, + 'dongnai' => true, + 'dongthap' => true, + 'gialai' => true, + 'hagiang' => true, + 'haiduong' => true, + 'haiphong' => true, + 'hanam' => true, + 'hanoi' => true, + 'hatinh' => true, + 'haugiang' => true, + 'hoabinh' => true, + 'hungyen' => true, + 'khanhhoa' => true, + 'kiengiang' => true, + 'kontum' => true, + 'laichau' => true, + 'lamdong' => true, + 'langson' => true, + 'laocai' => true, + 'longan' => true, + 'namdinh' => true, + 'nghean' => true, + 'ninhbinh' => true, + 'ninhthuan' => true, + 'phutho' => true, + 'phuyen' => true, + 'quangbinh' => true, + 'quangnam' => true, + 'quangngai' => true, + 'quangninh' => true, + 'quangtri' => true, + 'soctrang' => true, + 'sonla' => true, + 'tayninh' => true, + 'thaibinh' => true, + 'thainguyen' => true, + 'thanhhoa' => true, + 'thanhphohochiminh' => true, + 'thuathienhue' => true, + 'tiengiang' => true, + 'travinh' => true, + 'tuyenquang' => true, + 'vinhlong' => true, + 'vinhphuc' => true, + 'yenbai' => true, + 'blogspot' => true + , + 'vu' => + 'com' => true, + 'edu' => true, + 'net' => true, + 'org' => true, + 'cn' => true, + 'blog' => true, + 'dev' => true, + 'me' => true + , + 'wf' => + 'biz' => true, + 'sch' => true + , + 'ws' => + 'com' => true, + 'net' => true, + 'org' => true, + 'gov' => true, + 'edu' => true, + 'advisor' => + '*' => true + , + 'cloud66' => true, + 'dyndns' => true, + 'mypets' => true + , + 'yt' => + 'org' => true + , + 'امارات' => true, + 'հայ' => true, + 'বাংলা' => true, + 'бг' => true, + 'البحرين' => true, + 'бел' => true, + '中国' => true, + '中國' => true, + 'الجزائر' => true, + 'مصر' => true, + 'ею' => true, + 'ευ' => true, + 'موريتانيا' => true, + 'გე' => true, + 'ελ' => true, + '香港' => + '公司' => true, + '教育' => true, + '政府' => true, + '個人' => true, + '網絡' => true, + '組織' => true + , + 'ಭಾರತ' => true, + 'ଭାରତ' => true, + 'ভাৰত' => true, + 'भारतम्' => true, + 'भारोत' => true, + 'ڀارت' => true, + 'ഭാരതം' => true, + 'भारत' => true, + 'بارت' => true, + 'بھارت' => true, + 'భారత్' => true, + 'ભારત' => true, + 'ਭਾਰਤ' => true, + 'ভারত' => true, + 'இந்தியா' => true, + 'ایران' => true, + 'ايران' => true, + 'عراق' => true, + 'الاردن' => true, + '한국' => true, + 'қаз' => true, + 'ລາວ' => true, + 'ලංකා' => true, + 'இலங்கை' => true, + 'المغرب' => true, + 'мкд' => true, + 'мон' => true, + '澳門' => true, + '澳门' => true, + 'مليسيا' => true, + 'عمان' => true, + 'پاکستان' => true, + 'پاكستان' => true, + 'فلسطين' => true, + 'срб' => + 'пр' => true, + 'орг' => true, + 'обр' => true, + 'од' => true, + 'упр' => true, + 'ак' => true + , + 'рф' => true, + 'قطر' => true, + 'السعودية' => true, + 'السعودیة' => true, + 'السعودیۃ' => true, + 'السعوديه' => true, + 'سودان' => true, + '新加坡' => true, + 'சிங்கப்பூர்' => true, + 'سورية' => true, + 'سوريا' => true, + 'ไทย' => + 'ศึกษา' => true, + 'ธุรกิจ' => true, + 'รัฐบาล' => true, + 'ทหาร' => true, + 'เน็ต' => true, + 'องค์กร' => true + , + 'تونس' => true, + '台灣' => true, + '台湾' => true, + '臺灣' => true, + 'укр' => true, + 'اليمن' => true, + 'xxx' => true, + 'ye' => + 'com' => true, + 'edu' => true, + 'gov' => true, + 'net' => true, + 'mil' => true, + 'org' => true + , + 'za' => + 'ac' => true, + 'agric' => true, + 'alt' => true, + 'co' => + 'blogspot' => true + , + 'edu' => true, + 'gov' => true, + 'grondar' => true, + 'law' => true, + 'mil' => true, + 'net' => true, + 'ngo' => true, + 'nic' => true, + 'nis' => true, + 'nom' => true, + 'org' => true, + 'school' => true, + 'tm' => true, + 'web' => true + , + 'zm' => + 'ac' => true, + 'biz' => true, + 'co' => true, + 'com' => true, + 'edu' => true, + 'gov' => true, + 'info' => true, + 'mil' => true, + 'net' => true, + 'org' => true, + 'sch' => true + , + 'zw' => + 'ac' => true, + 'co' => true, + 'gov' => true, + 'mil' => true, + 'org' => true + , + 'aaa' => true, + 'aarp' => true, + 'abb' => true, + 'abbott' => true, + 'abbvie' => true, + 'abc' => true, + 'able' => true, + 'abogado' => true, + 'abudhabi' => true, + 'academy' => + 'official' => true + , + 'accenture' => true, + 'accountant' => true, + 'accountants' => true, + 'aco' => true, + 'actor' => true, + 'ads' => true, + 'adult' => true, + 'aeg' => true, + 'aetna' => true, + 'afl' => true, + 'africa' => true, + 'agakhan' => true, + 'agency' => true, + 'aig' => true, + 'airbus' => true, + 'airforce' => true, + 'airtel' => true, + 'akdn' => true, + 'alibaba' => true, + 'alipay' => true, + 'allfinanz' => true, + 'allstate' => true, + 'ally' => true, + 'alsace' => true, + 'alstom' => true, + 'amazon' => true, + 'americanexpress' => true, + 'americanfamily' => true, + 'amex' => true, + 'amfam' => true, + 'amica' => true, + 'amsterdam' => true, + 'analytics' => true, + 'android' => true, + 'anquan' => true, + 'anz' => true, + 'aol' => true, + 'apartments' => true, + 'app' => + 'beget' => + '*' => true + , + 'clerk' => true, + 'clerkstage' => true, + 'wnext' => true, + 'platform0' => true, + 'deta' => true, + 'ondigitalocean' => true, + 'easypanel' => true, + 'encr' => true, + 'edgecompute' => true, + 'fireweb' => true, + 'onflashdrive' => true, + 'framer' => true, + 'run' => + 'a' => true + , + 'web' => true, + 'hasura' => true, + 'loginline' => true, + 'messerli' => true, + 'netlify' => true, + 'ngrok' => true, + 'ngrok-free' => true, + 'developer' => + '*' => true + , + 'noop' => true, + 'northflank' => + '*' => true + , + 'snowflake' => + 'privatelink' => true + , + 'streamlit' => true, + 'storipress' => true, + 'telebit' => true, + 'typedream' => true, + 'vercel' => true, + 'bookonline' => true + , + 'apple' => true, + 'aquarelle' => true, + 'arab' => true, + 'aramco' => true, + 'archi' => true, + 'army' => true, + 'art' => true, + 'arte' => true, + 'asda' => true, + 'associates' => true, + 'athleta' => true, + 'attorney' => true, + 'auction' => true, + 'audi' => true, + 'audible' => true, + 'audio' => true, + 'auspost' => true, + 'author' => true, + 'auto' => true, + 'autos' => true, + 'avianca' => true, + 'aws' => + 'sagemaker' => + 'af-south-1' => + 'notebook' => true, + 'studio' => true + , + 'ap-east-1' => + 'notebook' => true, + 'studio' => true + , + 'ap-northeast-1' => + 'notebook' => true, + 'studio' => true + , + 'ap-northeast-2' => + 'notebook' => true, + 'studio' => true + , + 'ap-northeast-3' => + 'notebook' => true, + 'studio' => true + , + 'ap-south-1' => + 'notebook' => true, + 'studio' => true + , + 'ap-south-2' => + 'notebook' => true + , + 'ap-southeast-1' => + 'notebook' => true, + 'studio' => true + , + 'ap-southeast-2' => + 'notebook' => true, + 'studio' => true + , + 'ap-southeast-3' => + 'notebook' => true, + 'studio' => true + , + 'ap-southeast-4' => + 'notebook' => true + , + 'ca-central-1' => + 'notebook' => true, + 'studio' => true + , + 'eu-central-1' => + 'notebook' => true, + 'studio' => true + , + 'eu-central-2' => + 'notebook' => true + , + 'eu-north-1' => + 'notebook' => true, + 'studio' => true + , + 'eu-south-1' => + 'notebook' => true, + 'studio' => true + , + 'eu-south-2' => + 'notebook' => true + , + 'eu-west-1' => + 'notebook' => true, + 'studio' => true + , + 'eu-west-2' => + 'notebook' => true, + 'studio' => true + , + 'eu-west-3' => + 'notebook' => true, + 'studio' => true + , + 'il-central-1' => + 'notebook' => true, + 'studio' => true + , + 'me-central-1' => + 'notebook' => true, + 'studio' => true + , + 'me-south-1' => + 'notebook' => true, + 'studio' => true + , + 'sa-east-1' => + 'notebook' => true, + 'studio' => true + , + 'us-east-1' => + 'notebook' => true, + 'notebook-fips' => true, + 'studio' => true + , + 'us-east-2' => + 'notebook' => true, + 'notebook-fips' => true, + 'studio' => true + , + 'us-gov-east-1' => + 'notebook' => true, + 'notebook-fips' => true, + 'studio' => true, + 'studio-fips' => true + , + 'us-gov-west-1' => + 'notebook' => true, + 'notebook-fips' => true, + 'studio' => true, + 'studio-fips' => true + , + 'us-west-1' => + 'notebook' => true, + 'studio' => true + , + 'us-west-2' => + 'notebook' => true, + 'notebook-fips' => true, + 'studio' => true + + + , + 'axa' => true, + 'azure' => true, + 'baby' => true, + 'baidu' => true, + 'banamex' => true, + 'bananarepublic' => true, + 'band' => true, + 'bank' => true, + 'bar' => true, + 'barcelona' => true, + 'barclaycard' => true, + 'barclays' => true, + 'barefoot' => true, + 'bargains' => true, + 'baseball' => true, + 'basketball' => + 'aus' => true, + 'nz' => true + , + 'bauhaus' => true, + 'bayern' => true, + 'bbc' => true, + 'bbt' => true, + 'bbva' => true, + 'bcg' => true, + 'bcn' => true, + 'beats' => true, + 'beauty' => true, + 'beer' => true, + 'bentley' => true, + 'berlin' => true, + 'best' => true, + 'bestbuy' => true, + 'bet' => true, + 'bharti' => true, + 'bible' => true, + 'bid' => true, + 'bike' => true, + 'bing' => true, + 'bingo' => true, + 'bio' => true, + 'black' => true, + 'blackfriday' => true, + 'blockbuster' => true, + 'blog' => true, + 'bloomberg' => true, + 'blue' => true, + 'bms' => true, + 'bmw' => true, + 'bnpparibas' => true, + 'boats' => true, + 'boehringer' => true, + 'bofa' => true, + 'bom' => true, + 'bond' => true, + 'boo' => true, + 'book' => true, + 'booking' => true, + 'bosch' => true, + 'bostik' => true, + 'boston' => true, + 'bot' => true, + 'boutique' => true, + 'box' => true, + 'bradesco' => true, + 'bridgestone' => true, + 'broadway' => true, + 'broker' => true, + 'brother' => true, + 'brussels' => true, + 'build' => true, + 'builders' => + 'cloudsite' => true + , + 'business' => + 'co' => true + , + 'buy' => true, + 'buzz' => true, + 'bzh' => true, + 'cab' => true, + 'cafe' => true, + 'cal' => true, + 'call' => true, + 'calvinklein' => true, + 'cam' => true, + 'camera' => true, + 'camp' => true, + 'canon' => true, + 'capetown' => true, + 'capital' => true, + 'capitalone' => true, + 'car' => true, + 'caravan' => true, + 'cards' => true, + 'care' => true, + 'career' => true, + 'careers' => true, + 'cars' => true, + 'casa' => + 'nabu' => + 'ui' => true + + , + 'case' => true, + 'cash' => true, + 'casino' => true, + 'catering' => true, + 'catholic' => true, + 'cba' => true, + 'cbn' => true, + 'cbre' => true, + 'center' => true, + 'ceo' => true, + 'cern' => true, + 'cfa' => true, + 'cfd' => true, + 'chanel' => true, + 'channel' => true, + 'charity' => true, + 'chase' => true, + 'chat' => true, + 'cheap' => true, + 'chintai' => true, + 'christmas' => true, + 'chrome' => true, + 'church' => true, + 'cipriani' => true, + 'circle' => true, + 'cisco' => true, + 'citadel' => true, + 'citi' => true, + 'citic' => true, + 'city' => true, + 'claims' => true, + 'cleaning' => true, + 'click' => true, + 'clinic' => true, + 'clinique' => true, + 'clothing' => true, + 'cloud' => + 'banzai' => + '*' => true + , + 'elementor' => true, + 'encoway' => + 'eu' => true + , + 'statics' => + '*' => true + , + 'ravendb' => true, + 'axarnet' => + 'es-1' => true + , + 'diadem' => true, + 'jelastic' => + 'vip' => true + , + 'jele' => true, + 'jenv-aruba' => + 'aruba' => + 'eur' => + 'it1' => true + + , + 'it1' => true + , + 'keliweb' => + 'cs' => true + , + 'oxa' => + 'tn' => true, + 'uk' => true + , + 'primetel' => + 'uk' => true + , + 'reclaim' => + 'ca' => true, + 'uk' => true, + 'us' => true + , + 'trendhosting' => + 'ch' => true, + 'de' => true + , + 'jotelulu' => true, + 'kuleuven' => true, + 'linkyard' => true, + 'magentosite' => + '*' => true + , + 'perspecta' => true, + 'vapor' => true, + 'on-rancher' => + '*' => true + , + 'scw' => + 'baremetal' => + 'fr-par-1' => true, + 'fr-par-2' => true, + 'nl-ams-1' => true + , + 'fr-par' => + 'fnc' => + 'functions' => true + , + 'k8s' => + 'nodes' => true + , + 's3' => true, + 's3-website' => true, + 'whm' => true + , + 'instances' => + 'priv' => true, + 'pub' => true + , + 'k8s' => true, + 'nl-ams' => + 'k8s' => + 'nodes' => true + , + 's3' => true, + 's3-website' => true, + 'whm' => true + , + 'pl-waw' => + 'k8s' => + 'nodes' => true + , + 's3' => true, + 's3-website' => true + , + 'scalebook' => true, + 'smartlabeling' => true + , + 'sensiosite' => + '*' => true + , + 'trafficplex' => true, + 'urown' => true, + 'voorloper' => true + , + 'club' => + 'cloudns' => true, + 'jele' => true, + 'barsy' => true + , + 'clubmed' => true, + 'coach' => true, + 'codes' => + 'owo' => + '*' => true + + , + 'coffee' => true, + 'college' => true, + 'cologne' => true, + 'comcast' => true, + 'commbank' => true, + 'community' => + 'nog' => true, + 'ravendb' => true, + 'myforum' => true + , + 'company' => true, + 'compare' => true, + 'computer' => true, + 'comsec' => true, + 'condos' => true, + 'construction' => true, + 'consulting' => true, + 'contact' => true, + 'contractors' => true, + 'cooking' => true, + 'cool' => + 'elementor' => true, + 'de' => true + , + 'corsica' => true, + 'country' => true, + 'coupon' => true, + 'coupons' => true, + 'courses' => true, + 'cpa' => true, + 'credit' => true, + 'creditcard' => true, + 'creditunion' => true, + 'cricket' => true, + 'crown' => true, + 'crs' => true, + 'cruise' => true, + 'cruises' => true, + 'cuisinella' => true, + 'cymru' => true, + 'cyou' => true, + 'dabur' => true, + 'dad' => true, + 'dance' => true, + 'data' => true, + 'date' => true, + 'dating' => true, + 'datsun' => true, + 'day' => true, + 'dclk' => true, + 'dds' => true, + 'deal' => true, + 'dealer' => true, + 'deals' => true, + 'degree' => true, + 'delivery' => true, + 'dell' => true, + 'deloitte' => true, + 'delta' => true, + 'democrat' => true, + 'dental' => true, + 'dentist' => true, + 'design' => + 'bss' => true + , + 'dev' => + 'autocode' => true, + 'lcl' => + '*' => true + , + 'lclstage' => + '*' => true + , + 'stg' => + '*' => true + , + 'stgstage' => + '*' => true + , + 'pages' => true, + 'r2' => true, + 'workers' => true, + 'curv' => true, + 'deno' => true, + 'deno-staging' => true, + 'deta' => true, + 'fly' => true, + 'githubpreview' => true, + 'gateway' => + '*' => true + , + 'iserv' => true, + 'localcert' => + 'user' => + '*' => true + + , + 'loginline' => true, + 'mediatech' => true, + 'ngrok' => true, + 'ngrok-free' => true, + 'platter-app' => true, + 'shiftcrypto' => true, + 'vercel' => true, + 'webhare' => + '*' => true + + , + 'dhl' => true, + 'diamonds' => true, + 'diet' => true, + 'digital' => + 'cloudapps' => + 'london' => true + + , + 'direct' => true, + 'directory' => true, + 'discount' => true, + 'discover' => true, + 'dish' => true, + 'diy' => true, + 'dnp' => true, + 'docs' => true, + 'doctor' => true, + 'dog' => true, + 'domains' => true, + 'dot' => true, + 'download' => true, + 'drive' => true, + 'dtv' => true, + 'dubai' => true, + 'dunlop' => true, + 'dupont' => true, + 'durban' => true, + 'dvag' => true, + 'dvr' => true, + 'earth' => + 'dapps' => + '*' => true, + 'bzz' => + '*' => true + + + , + 'eat' => true, + 'eco' => true, + 'edeka' => true, + 'education' => + 'co' => true + , + 'email' => true, + 'emerck' => true, + 'energy' => true, + 'engineer' => true, + 'engineering' => true, + 'enterprises' => true, + 'epson' => true, + 'equipment' => true, + 'ericsson' => true, + 'erni' => true, + 'esq' => true, + 'estate' => + 'compute' => + '*' => true + + , + 'etisalat' => true, + 'eurovision' => true, + 'eus' => + 'party' => + 'user' => true + + , + 'events' => + 'koobin' => true, + 'co' => true + , + 'exchange' => true, + 'expert' => true, + 'exposed' => true, + 'express' => true, + 'extraspace' => true, + 'fage' => true, + 'fail' => true, + 'fairwinds' => true, + 'faith' => + 'ybo' => true + , + 'family' => true, + 'fan' => true, + 'fans' => true, + 'farm' => + 'storj' => true + , + 'farmers' => true, + 'fashion' => true, + 'fast' => true, + 'fedex' => true, + 'feedback' => true, + 'ferrari' => true, + 'ferrero' => true, + 'fidelity' => true, + 'fido' => true, + 'film' => true, + 'final' => true, + 'finance' => true, + 'financial' => + 'co' => true + , + 'fire' => true, + 'firestone' => true, + 'firmdale' => true, + 'fish' => true, + 'fishing' => true, + 'fit' => true, + 'fitness' => true, + 'flickr' => true, + 'flights' => true, + 'flir' => true, + 'florist' => true, + 'flowers' => true, + 'fly' => true, + 'foo' => true, + 'food' => true, + 'football' => true, + 'ford' => true, + 'forex' => true, + 'forsale' => true, + 'forum' => true, + 'foundation' => true, + 'fox' => true, + 'free' => true, + 'fresenius' => true, + 'frl' => true, + 'frogans' => true, + 'frontier' => true, + 'ftr' => true, + 'fujitsu' => true, + 'fun' => true, + 'fund' => true, + 'furniture' => true, + 'futbol' => true, + 'fyi' => true, + 'gal' => true, + 'gallery' => true, + 'gallo' => true, + 'gallup' => true, + 'game' => true, + 'games' => true, + 'gap' => true, + 'garden' => true, + 'gay' => true, + 'gbiz' => true, + 'gdn' => + 'cnpy' => true + , + 'gea' => true, + 'gent' => true, + 'genting' => true, + 'george' => true, + 'ggee' => true, + 'gift' => true, + 'gifts' => true, + 'gives' => true, + 'giving' => true, + 'glass' => true, + 'gle' => true, + 'global' => true, + 'globo' => true, + 'gmail' => true, + 'gmbh' => true, + 'gmo' => true, + 'gmx' => true, + 'godaddy' => true, + 'gold' => true, + 'goldpoint' => true, + 'golf' => true, + 'goo' => true, + 'goodyear' => true, + 'goog' => + 'cloud' => true, + 'translate' => true, + 'usercontent' => + '*' => true + + , + 'google' => true, + 'gop' => true, + 'got' => true, + 'grainger' => true, + 'graphics' => true, + 'gratis' => true, + 'green' => true, + 'gripe' => true, + 'grocery' => true, + 'group' => + 'discourse' => true + , + 'guardian' => true, + 'gucci' => true, + 'guge' => true, + 'guide' => true, + 'guitars' => true, + 'guru' => true, + 'hair' => true, + 'hamburg' => true, + 'hangout' => true, + 'haus' => true, + 'hbo' => true, + 'hdfc' => true, + 'hdfcbank' => true, + 'health' => + 'hra' => true + , + 'healthcare' => true, + 'help' => true, + 'helsinki' => true, + 'here' => true, + 'hermes' => true, + 'hiphop' => true, + 'hisamitsu' => true, + 'hitachi' => true, + 'hiv' => true, + 'hkt' => true, + 'hockey' => true, + 'holdings' => true, + 'holiday' => true, + 'homedepot' => true, + 'homegoods' => true, + 'homes' => true, + 'homesense' => true, + 'honda' => true, + 'horse' => true, + 'hospital' => true, + 'host' => + 'cloudaccess' => true, + 'freesite' => true, + 'easypanel' => true, + 'fastvps' => true, + 'myfast' => true, + 'tempurl' => true, + 'wpmudev' => true, + 'jele' => true, + 'mircloud' => true, + 'pcloud' => true, + 'half' => true + , + 'hosting' => + 'opencraft' => true + , + 'hot' => true, + 'hotels' => true, + 'hotmail' => true, + 'house' => true, + 'how' => true, + 'hsbc' => true, + 'hughes' => true, + 'hyatt' => true, + 'hyundai' => true, + 'ibm' => true, + 'icbc' => true, + 'ice' => true, + 'icu' => true, + 'ieee' => true, + 'ifm' => true, + 'ikano' => true, + 'imamat' => true, + 'imdb' => true, + 'immo' => true, + 'immobilien' => true, + 'inc' => true, + 'industries' => true, + 'infiniti' => true, + 'ing' => true, + 'ink' => true, + 'institute' => true, + 'insurance' => true, + 'insure' => true, + 'international' => true, + 'intuit' => true, + 'investments' => true, + 'ipiranga' => true, + 'irish' => true, + 'ismaili' => true, + 'ist' => true, + 'istanbul' => true, + 'itau' => true, + 'itv' => true, + 'jaguar' => true, + 'java' => true, + 'jcb' => true, + 'jeep' => true, + 'jetzt' => true, + 'jewelry' => true, + 'jio' => true, + 'jll' => true, + 'jmp' => true, + 'jnj' => true, + 'joburg' => true, + 'jot' => true, + 'joy' => true, + 'jpmorgan' => true, + 'jprs' => true, + 'juegos' => true, + 'juniper' => true, + 'kaufen' => true, + 'kddi' => true, + 'kerryhotels' => true, + 'kerrylogistics' => true, + 'kerryproperties' => true, + 'kfh' => true, + 'kia' => true, + 'kids' => true, + 'kim' => true, + 'kinder' => true, + 'kindle' => true, + 'kitchen' => true, + 'kiwi' => true, + 'koeln' => true, + 'komatsu' => true, + 'kosher' => true, + 'kpmg' => true, + 'kpn' => true, + 'krd' => + 'co' => true, + 'edu' => true + , + 'kred' => true, + 'kuokgroup' => true, + 'kyoto' => true, + 'lacaixa' => true, + 'lamborghini' => true, + 'lamer' => true, + 'lancaster' => true, + 'land' => + 'static' => + 'dev' => true, + 'sites' => true + + , + 'landrover' => true, + 'lanxess' => true, + 'lasalle' => true, + 'lat' => true, + 'latino' => true, + 'latrobe' => true, + 'law' => true, + 'lawyer' => true, + 'lds' => true, + 'lease' => true, + 'leclerc' => true, + 'lefrak' => true, + 'legal' => true, + 'lego' => true, + 'lexus' => true, + 'lgbt' => true, + 'lidl' => true, + 'life' => true, + 'lifeinsurance' => true, + 'lifestyle' => true, + 'lighting' => true, + 'like' => true, + 'lilly' => true, + 'limited' => true, + 'limo' => true, + 'lincoln' => true, + 'link' => + 'cyon' => true, + 'mypep' => true, + 'dweb' => + '*' => true + + , + 'lipsy' => true, + 'live' => + 'hlx' => true + , + 'living' => true, + 'llc' => true, + 'llp' => true, + 'loan' => true, + 'loans' => true, + 'locker' => true, + 'locus' => true, + 'lol' => + 'omg' => true + , + 'london' => true, + 'lotte' => true, + 'lotto' => true, + 'love' => true, + 'lpl' => true, + 'lplfinancial' => true, + 'ltd' => true, + 'ltda' => true, + 'lundbeck' => true, + 'luxe' => true, + 'luxury' => true, + 'madrid' => true, + 'maif' => true, + 'maison' => true, + 'makeup' => true, + 'man' => true, + 'management' => + 'router' => true + , + 'mango' => true, + 'map' => true, + 'market' => true, + 'marketing' => true, + 'markets' => true, + 'marriott' => true, + 'marshalls' => true, + 'mattel' => true, + 'mba' => true, + 'mckinsey' => true, + 'med' => true, + 'media' => + 'framer' => true + , + 'meet' => true, + 'melbourne' => true, + 'meme' => true, + 'memorial' => true, + 'men' => true, + 'menu' => + 'barsy' => true + , + 'merckmsd' => true, + 'miami' => true, + 'microsoft' => true, + 'mini' => true, + 'mint' => true, + 'mit' => true, + 'mitsubishi' => true, + 'mlb' => true, + 'mls' => true, + 'mma' => true, + 'mobile' => true, + 'moda' => true, + 'moe' => true, + 'moi' => true, + 'mom' => true, + 'monash' => true, + 'money' => true, + 'monster' => true, + 'mormon' => true, + 'mortgage' => true, + 'moscow' => true, + 'moto' => true, + 'motorcycles' => true, + 'mov' => true, + 'movie' => true, + 'msd' => true, + 'mtn' => true, + 'mtr' => true, + 'music' => true, + 'nab' => true, + 'nagoya' => true, + 'natura' => true, + 'navy' => true, + 'nba' => true, + 'nec' => true, + 'netbank' => true, + 'netflix' => true, + 'network' => + 'alces' => + '*' => true + , + 'co' => true, + 'arvo' => true, + 'azimuth' => true, + 'tlon' => true + , + 'neustar' => true, + 'new' => true, + 'news' => + 'noticeable' => true + , + 'next' => true, + 'nextdirect' => true, + 'nexus' => true, + 'nfl' => true, + 'ngo' => true, + 'nhk' => true, + 'nico' => true, + 'nike' => true, + 'nikon' => true, + 'ninja' => true, + 'nissan' => true, + 'nissay' => true, + 'nokia' => true, + 'norton' => true, + 'now' => true, + 'nowruz' => true, + 'nowtv' => true, + 'nra' => true, + 'nrw' => true, + 'ntt' => true, + 'nyc' => true, + 'obi' => true, + 'observer' => true, + 'office' => true, + 'okinawa' => true, + 'olayan' => true, + 'olayangroup' => true, + 'oldnavy' => true, + 'ollo' => true, + 'omega' => true, + 'one' => + 'onred' => + 'staging' => true + , + 'service' => true, + 'homelink' => true + , + 'ong' => true, + 'onl' => true, + 'online' => + 'eero' => true, + 'eero-stage' => true, + 'barsy' => true + , + 'ooo' => true, + 'open' => true, + 'oracle' => true, + 'orange' => + 'tech' => true + , + 'organic' => true, + 'origins' => true, + 'osaka' => true, + 'otsuka' => true, + 'ott' => true, + 'ovh' => + 'nerdpol' => true + , + 'page' => + 'hlx' => true, + 'hlx3' => true, + 'translated' => true, + 'codeberg' => true, + 'pdns' => true, + 'plesk' => true, + 'prvcy' => true, + 'rocky' => true, + 'magnet' => true + , + 'panasonic' => true, + 'paris' => true, + 'pars' => true, + 'partners' => true, + 'parts' => true, + 'party' => + 'ybo' => true + , + 'pay' => true, + 'pccw' => true, + 'pet' => true, + 'pfizer' => true, + 'pharmacy' => true, + 'phd' => true, + 'philips' => true, + 'phone' => true, + 'photo' => true, + 'photography' => true, + 'photos' => + 'framer' => true + , + 'physio' => true, + 'pics' => true, + 'pictet' => true, + 'pictures' => + '1337' => true + , + 'pid' => true, + 'pin' => true, + 'ping' => true, + 'pink' => true, + 'pioneer' => true, + 'pizza' => + 'ngrok' => true + , + 'place' => + 'co' => true + , + 'play' => true, + 'playstation' => true, + 'plumbing' => true, + 'plus' => true, + 'pnc' => true, + 'pohl' => true, + 'poker' => true, + 'politie' => true, + 'porn' => + 'indie' => true + , + 'pramerica' => true, + 'praxi' => true, + 'press' => true, + 'prime' => true, + 'prod' => true, + 'productions' => true, + 'prof' => true, + 'progressive' => true, + 'promo' => true, + 'properties' => true, + 'property' => true, + 'protection' => true, + 'pru' => true, + 'prudential' => true, + 'pub' => + 'barsy' => true + , + 'pwc' => true, + 'qpon' => true, + 'quebec' => true, + 'quest' => true, + 'racing' => true, + 'radio' => true, + 'read' => true, + 'realestate' => true, + 'realtor' => true, + 'realty' => true, + 'recipes' => true, + 'red' => true, + 'redstone' => true, + 'redumbrella' => true, + 'rehab' => true, + 'reise' => true, + 'reisen' => true, + 'reit' => true, + 'reliance' => true, + 'ren' => true, + 'rent' => true, + 'rentals' => true, + 'repair' => true, + 'report' => true, + 'republican' => true, + 'rest' => true, + 'restaurant' => true, + 'review' => + 'ybo' => true + , + 'reviews' => true, + 'rexroth' => true, + 'rich' => true, + 'richardli' => true, + 'ricoh' => true, + 'ril' => true, + 'rio' => true, + 'rip' => + 'clan' => true + , + 'rocher' => true, + 'rocks' => + 'myddns' => true, + 'lima-city' => true, + 'webspace' => true + , + 'rodeo' => true, + 'rogers' => true, + 'room' => true, + 'rsvp' => true, + 'rugby' => true, + 'ruhr' => true, + 'run' => + 'hs' => true, + 'development' => true, + 'ravendb' => true, + 'servers' => true, + 'build' => + '*' => true + , + 'code' => + '*' => true + , + 'database' => + '*' => true + , + 'migration' => + '*' => true + , + 'onporter' => true, + 'repl' => true, + 'wix' => true + , + 'rwe' => true, + 'ryukyu' => true, + 'saarland' => true, + 'safe' => true, + 'safety' => true, + 'sakura' => true, + 'sale' => true, + 'salon' => true, + 'samsclub' => true, + 'samsung' => true, + 'sandvik' => true, + 'sandvikcoromant' => true, + 'sanofi' => true, + 'sap' => true, + 'sarl' => true, + 'sas' => true, + 'save' => true, + 'saxo' => true, + 'sbi' => true, + 'sbs' => true, + 'sca' => true, + 'scb' => true, + 'schaeffler' => true, + 'schmidt' => true, + 'scholarships' => true, + 'school' => true, + 'schule' => true, + 'schwarz' => true, + 'science' => + 'ybo' => true + , + 'scot' => + 'edu' => true, + 'gov' => + 'service' => true + + , + 'search' => true, + 'seat' => true, + 'secure' => true, + 'security' => true, + 'seek' => true, + 'select' => true, + 'sener' => true, + 'services' => + 'loginline' => true + , + 'seven' => true, + 'sew' => true, + 'sex' => true, + 'sexy' => true, + 'sfr' => true, + 'shangrila' => true, + 'sharp' => true, + 'shaw' => true, + 'shell' => true, + 'shia' => true, + 'shiksha' => true, + 'shoes' => true, + 'shop' => + 'base' => true, + 'hoplix' => true, + 'barsy' => true + , + 'shopping' => true, + 'shouji' => true, + 'show' => true, + 'silk' => true, + 'sina' => true, + 'singles' => true, + 'site' => + 'cloudera' => + '*' => true + , + 'cyon' => true, + 'fnwk' => true, + 'folionetwork' => true, + 'fastvps' => true, + 'jele' => true, + 'lelux' => true, + 'loginline' => true, + 'barsy' => true, + 'mintere' => true, + 'omniwe' => true, + 'opensocial' => true, + 'platformsh' => + '*' => true + , + 'tst' => + '*' => true + , + 'byen' => true, + 'srht' => true, + 'novecore' => true + , + 'ski' => true, + 'skin' => true, + 'sky' => true, + 'skype' => true, + 'sling' => true, + 'smart' => true, + 'smile' => true, + 'sncf' => true, + 'soccer' => true, + 'social' => true, + 'softbank' => true, + 'software' => true, + 'sohu' => true, + 'solar' => true, + 'solutions' => + 'diher' => + '*' => true + + , + 'song' => true, + 'sony' => true, + 'soy' => true, + 'spa' => true, + 'space' => + 'myfast' => true, + 'uber' => true, + 'xs4all' => true + , + 'sport' => true, + 'spot' => true, + 'srl' => true, + 'stada' => true, + 'staples' => true, + 'star' => true, + 'statebank' => true, + 'statefarm' => true, + 'stc' => true, + 'stcgroup' => true, + 'stockholm' => true, + 'storage' => true, + 'store' => + 'sellfy' => true, + 'shopware' => true, + 'storebase' => true + , + 'stream' => true, + 'studio' => true, + 'study' => true, + 'style' => true, + 'sucks' => true, + 'supplies' => true, + 'supply' => true, + 'support' => + 'barsy' => true + , + 'surf' => true, + 'surgery' => true, + 'suzuki' => true, + 'swatch' => true, + 'swiss' => true, + 'sydney' => true, + 'systems' => + 'knightpoint' => true + , + 'tab' => true, + 'taipei' => true, + 'talk' => true, + 'taobao' => true, + 'target' => true, + 'tatamotors' => true, + 'tatar' => true, + 'tattoo' => true, + 'tax' => true, + 'taxi' => true, + 'tci' => true, + 'tdk' => true, + 'team' => + 'discourse' => true, + 'jelastic' => true + , + 'tech' => true, + 'technology' => + 'co' => true + , + 'temasek' => true, + 'tennis' => true, + 'teva' => true, + 'thd' => true, + 'theater' => true, + 'theatre' => true, + 'tiaa' => true, + 'tickets' => true, + 'tienda' => true, + 'tips' => true, + 'tires' => true, + 'tirol' => true, + 'tjmaxx' => true, + 'tjx' => true, + 'tkmaxx' => true, + 'tmall' => true, + 'today' => + 'prequalifyme' => true + , + 'tokyo' => true, + 'tools' => true, + 'top' => + 'now-dns' => true, + 'ntdll' => true + , + 'toray' => true, + 'toshiba' => true, + 'total' => true, + 'tours' => true, + 'town' => true, + 'toyota' => true, + 'toys' => true, + 'trade' => + 'ybo' => true + , + 'trading' => true, + 'training' => true, + 'travel' => true, + 'travelers' => true, + 'travelersinsurance' => true, + 'trust' => true, + 'trv' => true, + 'tube' => true, + 'tui' => true, + 'tunes' => true, + 'tushu' => true, + 'tvs' => true, + 'ubank' => true, + 'ubs' => true, + 'unicom' => true, + 'university' => true, + 'uno' => true, + 'uol' => true, + 'ups' => true, + 'vacations' => true, + 'vana' => true, + 'vanguard' => true, + 'vegas' => true, + 'ventures' => true, + 'verisign' => true, + 'versicherung' => true, + 'vet' => true, + 'viajes' => true, + 'video' => true, + 'vig' => true, + 'viking' => true, + 'villas' => true, + 'vin' => true, + 'vip' => true, + 'virgin' => true, + 'visa' => true, + 'vision' => true, + 'viva' => true, + 'vivo' => true, + 'vlaanderen' => true, + 'vodka' => true, + 'volkswagen' => true, + 'volvo' => true, + 'vote' => true, + 'voting' => true, + 'voto' => true, + 'voyage' => true, + 'wales' => true, + 'walmart' => true, + 'walter' => true, + 'wang' => true, + 'wanggou' => true, + 'watch' => true, + 'watches' => true, + 'weather' => true, + 'weatherchannel' => true, + 'webcam' => true, + 'weber' => true, + 'website' => + 'framer' => true + , + 'wedding' => true, + 'weibo' => true, + 'weir' => true, + 'whoswho' => true, + 'wien' => true, + 'wiki' => + 'framer' => true + , + 'williamhill' => true, + 'win' => true, + 'windows' => true, + 'wine' => true, + 'winners' => true, + 'wme' => true, + 'wolterskluwer' => true, + 'woodside' => true, + 'work' => true, + 'works' => true, + 'world' => true, + 'wow' => true, + 'wtc' => true, + 'wtf' => true, + 'xbox' => true, + 'xerox' => true, + 'xfinity' => true, + 'xihuan' => true, + 'xin' => true, + 'कॉम' => true, + 'セール' => true, + '佛山' => true, + '慈善' => true, + '集团' => true, + '在线' => true, + '点看' => true, + 'คอม' => true, + '八卦' => true, + 'موقع' => true, + '公益' => true, + '公司' => true, + '香格里拉' => true, + '网站' => true, + '移动' => true, + '我爱你' => true, + 'москва' => true, + 'католик' => true, + 'онлайн' => true, + 'сайт' => true, + '联通' => true, + 'קום' => true, + '时尚' => true, + '微博' => true, + '淡马锡' => true, + 'ファッション' => true, + 'орг' => true, + 'नेट' => true, + 'ストア' => true, + 'アマゾン' => true, + '삼성' => true, + '商标' => true, + '商店' => true, + '商城' => true, + 'дети' => true, + 'ポイント' => true, + '新闻' => true, + '家電' => true, + 'كوم' => true, + '中文网' => true, + '中信' => true, + '娱乐' => true, + '谷歌' => true, + '電訊盈科' => true, + '购物' => true, + 'クラウド' => true, + '通販' => true, + '网店' => true, + 'संगठन' => true, + '餐厅' => true, + '网络' => true, + 'ком' => true, + '亚马逊' => true, + '食品' => true, + '飞利浦' => true, + '手机' => true, + 'ارامكو' => true, + 'العليان' => true, + 'اتصالات' => true, + 'بازار' => true, + 'ابوظبي' => true, + 'كاثوليك' => true, + 'همراه' => true, + '닷컴' => true, + '政府' => true, + 'شبكة' => true, + 'بيتك' => true, + 'عرب' => true, + '机构' => true, + '组织机构' => true, + '健康' => true, + '招聘' => true, + 'рус' => + 'биз' => true, + 'ком' => true, + 'крым' => true, + 'мир' => true, + 'мск' => true, + 'орг' => true, + 'самара' => true, + 'сочи' => true, + 'спб' => true, + 'я' => true + , + '大拿' => true, + 'みんな' => true, + 'グーグル' => true, + '世界' => true, + '書籍' => true, + '网址' => true, + '닷넷' => true, + 'コム' => true, + '天主教' => true, + '游戏' => true, + 'vermögensberater' => true, + 'vermögensberatung' => true, + '企业' => true, + '信息' => true, + '嘉里大酒店' => true, + '嘉里' => true, + '广东' => true, + '政务' => true, + 'xyz' => + 'blogsite' => true, + 'localzone' => true, + 'crafting' => true, + 'zapto' => true, + 'telebit' => + '*' => true + + , + 'yachts' => true, + 'yahoo' => true, + 'yamaxun' => true, + 'yandex' => true, + 'yodobashi' => true, + 'yoga' => true, + 'yokohama' => true, + 'you' => true, + 'youtube' => true, + 'yun' => true, + 'zappos' => true, + 'zara' => true, + 'zero' => true, + 'zip' => true, + 'zone' => + 'cloud66' => true, + 'hs' => true, + 'triton' => + '*' => true + , + 'lima' => true + , + 'zuerich' => true +; +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/docs/LICENSE
Added
@@ -0,0 +1,31 @@ +HTTP_Request2 + +Copyright (c) 2008-2023, Alexey Borzov <avb@php.net> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of Alexey Borzov nor the names of his contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE.
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/docs/examples/upload-rapidshare.php
Added
@@ -0,0 +1,58 @@ +<?php +/** + * Usage example for HTTP_Request2 package: uploading a file to rapidshare.com + * + * Inspired by Perl usage example: http://images.rapidshare.com/software/rsapi.pl + * Rapidshare API description: http://rapidshare.com/dev.html + */ + +require_once 'HTTP/Request2.php'; + +// You'll probably want to change this +$filename = '/etc/passwd'; + +try { + // First step: get an available upload server + $request = new HTTP_Request2( + 'http://rapidshare.com/cgi-bin/rsapi.cgi?sub=nextuploadserver_v1' + ); + $server = $request->send()->getBody(); + if (!preg_match('/^(\\d+)$/', $server)) { + throw new Exception("Invalid upload server: {$server}"); + } + + // Calculate file hash, we'll use it later to check upload + if (false === ($hash = @md5_file($filename))) { + throw new Exception("Cannot calculate MD5 hash of '{$filename}'"); + } + + // Second step: upload a file to the available server + $uploader = new HTTP_Request2( + "http://rs{$server}l3.rapidshare.com/cgi-bin/upload.cgi", + HTTP_Request2::METHOD_POST + ); + // Adding the file + $uploader->addUpload('filecontent', $filename); + // This will tell server to return program-friendly output + $uploader->addPostParameter('rsapi_v1', '1'); + + $response = $uploader->send()->getBody(); + if (!preg_match_all('/^(File^=+)=(.+)$/m', $response, $m, PREG_SET_ORDER)) { + throw new Exception("Invalid response: {$response}"); + } + $rspAry = ; + foreach ($m as $item) { + $rspAry$item1 = $item2; + } + // Check that uploaded file has the same hash + if (empty($rspAry'File1.4')) { + throw new Exception("MD5 hash data not found in response"); + } elseif ($hash != strtolower($rspAry'File1.4')) { + throw new Exception("Upload failed, local MD5 is {$hash}, uploaded MD5 is {$rspAry'File1.4'}"); + } + echo "Upload succeeded\nDownload link: {$rspAry'File1.1'}\nDelete link: {$rspAry'File1.2'}\n"; + +} catch (Exception $e) { + echo "Error: " . $e->getMessage(); +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/MockObserver.php
Added
@@ -0,0 +1,37 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Mock observer + */ +class HTTP_Request2_MockObserver implements SplObserver +{ + public $calls = 0; + + public $event; + + #ReturnTypeWillChange + public function update (SplSubject $subject) + { + $this->calls++; + $this->event = $subject->getLastEvent(); + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/NetworkConfig.php.dist
Added
@@ -0,0 +1,58 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * This file contains configuration needed for running HTTP_Request2 tests + * that interact with the network. Do not edit this file, copy it to + * NetworkConfig.php and edit the copy instead. + */ + +/** + * Base URL for HTTP_Request2 Adapters tests + * + * To enable the tests that actually perform network interaction, you should + * copy the contents of _network directory to a directory under your web + * server's document root or create a symbolic link to _network directory + * there. Set this constant to point to the URL of that directory. + */ +define('HTTP_REQUEST2_TESTS_BASE_URL', null); + +/** + * URL that is protected by server digest authentication + * + * This is needed for testing of 100 Continue handling, we can't implement + * digest in PHP since it will kick in a bit later + */ +define('HTTP_REQUEST2_TESTS_DIGEST_URL', null); + +/**#@+ + * Proxy setup for Socket Adapter tests + * + * Set these constants to run additional tests for Socket Adapter using a HTTP + * proxy. If proxy host is not set then the tests will not be run. + */ +define('HTTP_REQUEST2_TESTS_PROXY_HOST', null); +define('HTTP_REQUEST2_TESTS_PROXY_PORT', 8080); +define('HTTP_REQUEST2_TESTS_PROXY_USER', ''); +define('HTTP_REQUEST2_TESTS_PROXY_PASSWORD', ''); +define('HTTP_REQUEST2_TESTS_PROXY_AUTH_SCHEME', 'basic'); +define('HTTP_REQUEST2_TESTS_PROXY_TYPE', 'http'); +/**#@-*/ +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/ObserverTest.php
Added
@@ -0,0 +1,78 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Sets up includes */ +require_once __DIR__ . '/TestHelper.php'; + +require_once __DIR__ . '/MockObserver.php'; + +use Yoast\PHPUnitPolyfills\TestCases\TestCase; + +/** + * Unit test for subject-observer pattern implementation in HTTP_Request2 + */ +class HTTP_Request2_ObserverTest extends TestCase +{ + public function testSetLastEvent() + { + $request = new HTTP_Request2(); + $observer = new HTTP_Request2_MockObserver(); + $request->attach($observer); + + $request->setLastEvent('foo', 'bar'); + $this->assertEquals(1, $observer->calls); + $this->assertEquals('name' => 'foo', 'data' => 'bar', $observer->event); + + $request->setLastEvent('baz'); + $this->assertEquals(2, $observer->calls); + $this->assertEquals('name' => 'baz', 'data' => null, $observer->event); + } + + public function testAttachOnlyOnce() + { + $request = new HTTP_Request2(); + $observer = new HTTP_Request2_MockObserver(); + $observer2 = new HTTP_Request2_MockObserver(); + $request->attach($observer); + $request->attach($observer2); + $request->attach($observer); + + $request->setLastEvent('event', 'data'); + $this->assertEquals(1, $observer->calls); + $this->assertEquals(1, $observer2->calls); + } + + public function testDetach() + { + $request = new HTTP_Request2(); + $observer = new HTTP_Request2_MockObserver(); + $observer2 = new HTTP_Request2_MockObserver(); + + $request->attach($observer); + $request->detach($observer2); // should not be a error + $request->setLastEvent('first'); + + $request->detach($observer); + $request->setLastEvent('second'); + $this->assertEquals(1, $observer->calls); + $this->assertEquals('name' => 'first', 'data' => null, $observer->event); + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/Adapter/CommonNetworkTest.php
Added
@@ -0,0 +1,450 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Sets up includes */ +require_once dirname(dirname(__DIR__)) . '/TestHelper.php'; + +require_once __DIR__ . '/SlowpokeBody.php'; +require_once __DIR__ . '/HeaderObserver.php'; +require_once __DIR__ . '/EventSequenceObserver.php'; + +use Yoast\PHPUnitPolyfills\TestCases\TestCase; + +/** + * Tests for HTTP_Request2 package that require a working webserver + * + * The class contains some common tests that should be run for all Adapters, + * it is extended by their unit tests. + * + * You need to properly set up this test suite, refer to NetworkConfig.php.dist + */ +abstract class HTTP_Request2_Adapter_CommonNetworkTest extends TestCase +{ + /** + * HTTP Request object + * @var HTTP_Request2 + */ + protected $request; + + /** + * Base URL for remote test files + * @var string + */ + protected $baseUrl; + + /** + * Configuration for HTTP Request object + * @var array + */ + protected $config = ; + + protected function set_up() + { + if (!HTTP_REQUEST2_TESTS_BASE_URL) { + $this->markTestSkipped('Base URL is not configured'); + + } else { + $this->baseUrl = rtrim(HTTP_REQUEST2_TESTS_BASE_URL, '/') . '/'; + $name = strtolower(preg_replace('/^test/i', '', $this->getName())) . '.php'; + + $this->request = new HTTP_Request2( + $this->baseUrl . $name, HTTP_Request2::METHOD_GET, $this->config + ); + } + } + + /** + * Tests possibility to send GET parameters + * + * NB: Currently there are problems with Net_URL2::setQueryVariables(), thus + * array structure is simple: http://pear.php.net/bugs/bug.php?id=18267 + */ + public function testGetParameters() + { + $data = + 'bar' => + 'key' => 'value' + , + 'foo' => 'some value', + 'numbered' => 'first', 'second' + ; + + $this->request->getUrl()->setQueryVariables($data); + $response = $this->request->send(); + $this->assertEquals(serialize($data), $response->getBody()); + } + + public function testPostParameters() + { + $data = + 'bar' => + 'key' => 'some other value' + , + 'baz' => + 'key1' => + 'key2' => 'yet another value' + + , + 'foo' => 'some value', + 'indexed' => 'first', 'second' + ; + $events = + 'sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders', 'receivedBodyPart', 'receivedBody' + ; + $observer = new HTTP_Request2_Adapter_EventSequenceObserver($events); + + $this->request->setMethod(HTTP_Request2::METHOD_POST) + ->setHeader('Accept-Encoding', 'identity') + ->addPostParameter($data) + ->attach($observer); + + $response = $this->request->send(); + $this->assertEquals(serialize($data), $response->getBody()); + $this->assertEquals($events, $observer->sequence); + } + + public function testUploads() + { + $this->request->setMethod(HTTP_Request2::METHOD_POST) + ->addUpload('foo', dirname(dirname(__DIR__)) . '/_files/empty.gif', 'picture.gif', 'image/gif') + ->addUpload('bar', + dirname(dirname(__DIR__)) . '/_files/empty.gif', null, 'image/gif', + dirname(dirname(__DIR__)) . '/_files/plaintext.txt', 'secret.txt', 'text/x-whatever' + ); + + $response = $this->request->send(); + $this->assertStringContainsString("foo picture.gif image/gif 43", $response->getBody()); + $this->assertStringContainsString("bar0 empty.gif image/gif 43", $response->getBody()); + $this->assertStringContainsString("bar1 secret.txt text/x-whatever 15", $response->getBody()); + } + + public function testRawPostData() + { + $data = 'Nothing to see here, move along'; + + $this->request->setMethod(HTTP_Request2::METHOD_POST) + ->setBody($data); + $response = $this->request->send(); + $this->assertEquals($data, $response->getBody()); + } + + public function testCookies() + { + $cookies = + 'CUSTOMER' => 'WILE_E_COYOTE', + 'PART_NUMBER' => 'ROCKET_LAUNCHER_0001' + ; + + foreach ($cookies as $k => $v) { + $this->request->addCookie($k, $v); + } + $response = $this->request->send(); + $this->assertEquals(serialize($cookies), $response->getBody()); + } + + public function testTimeout() + { + $this->request->setConfig('timeout', 2); + try { + $this->request->send(); + $this->fail('Expected HTTP_Request2_Exception was not thrown'); + } catch (HTTP_Request2_MessageException $e) { + $this->assertEquals(HTTP_Request2_Exception::TIMEOUT, $e->getCode()); + } + } + + public function testTimeoutInRequest() + { + $this->request->setConfig('timeout', 2) + ->setUrl($this->baseUrl . 'postparameters.php') + ->setBody(new HTTP_Request2_Adapter_SlowpokeBody('foo' => 'some value', )); + try { + $this->request->send(); + $this->fail('Expected HTTP_Request2_MessageException was not thrown'); + } catch (HTTP_Request2_MessageException $e) { + $this->assertEquals(HTTP_Request2_Exception::TIMEOUT, $e->getCode()); + } + } + + public function testBasicAuth() + { + $this->request->getUrl()->setQueryVariables( + 'user' => 'luser', + 'pass' => 'qwerty' + ); + $wrong = clone $this->request; + + $this->request->setAuth('luser', 'qwerty'); + $response = $this->request->send(); + $this->assertEquals(200, $response->getStatus()); + + $wrong->setAuth('luser', 'password'); + $response = $wrong->send(); + $this->assertEquals(401, $response->getStatus()); + } + + public function testDigestAuth() + { + $this->request->getUrl()->setQueryVariables( + 'user' => 'luser', + 'pass' => 'qwerty' + ); + $wrong = clone $this->request; + $observer = new HTTP_Request2_Adapter_EventSequenceObserver('sentHeaders', 'receivedHeaders'); + + $this->request->setAuth('luser', 'qwerty', HTTP_Request2::AUTH_DIGEST) + ->attach($observer); + $response = $this->request->send(); + $this->assertEquals(200, $response->getStatus()); + $this->assertEquals( + 'sentHeaders', 'receivedHeaders', 'sentHeaders', 'receivedHeaders', + $observer->sequence + ); + + $wrong->setAuth('luser', 'password', HTTP_Request2::AUTH_DIGEST); + $response = $wrong->send(); + $this->assertEquals(401, $response->getStatus()); + } + + public function testRedirectsDefault() + { + $observer = new HTTP_Request2_Adapter_EventSequenceObserver( + 'sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders' + ); + $this->request->setUrl($this->baseUrl . 'redirects.php') + ->setConfig('follow_redirects' => true, 'strict_redirects' => false) + ->setMethod(HTTP_Request2::METHOD_POST) + ->addPostParameter('foo', 'foo value') + ->attach($observer); + + $response = $this->request->send(); + $this->assertStringContainsString('Method=GET', $response->getBody()); + $this->assertStringNotContainsString('foo', $response->getBody()); + $this->assertEquals($this->baseUrl . 'redirects.php?redirects=0', $response->getEffectiveUrl()); + $this->assertEquals( + 'sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders', 'sentHeaders', 'receivedHeaders', + $observer->sequence + ); + } + + public function testRedirectsStrict() + { + $observer = new HTTP_Request2_Adapter_EventSequenceObserver( + 'sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders' + ); + $this->request->setUrl($this->baseUrl . 'redirects.php') + ->setConfig('follow_redirects' => true, 'strict_redirects' => true) + ->setMethod(HTTP_Request2::METHOD_POST) + ->addPostParameter('foo', 'foo value') + ->attach($observer); + + $response = $this->request->send(); + $this->assertStringContainsString('Method=POST', $response->getBody()); + $this->assertStringContainsString('foo', $response->getBody()); + $this->assertEquals( + 'sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders', + 'sentHeaders', 'sentBodyPart', 'sentBody', 'receivedHeaders', + $observer->sequence + ); + } + + public function testRedirectsLimit() + { + $this->request->setUrl($this->baseUrl . 'redirects.php?redirects=4') + ->setConfig('follow_redirects' => true, 'max_redirects' => 2); + + try { + $this->request->send(); + $this->fail('Expected HTTP_Request2_Exception was not thrown'); + } catch (HTTP_Request2_MessageException $e) { + $this->assertEquals(HTTP_Request2_Exception::TOO_MANY_REDIRECTS, $e->getCode()); + } + } + + public function testRedirectsRelative() + { + $this->request->setUrl($this->baseUrl . 'redirects.php?special=relative') + ->setConfig('follow_redirects' => true); + + $response = $this->request->send(); + $this->assertStringContainsString('did relative', $response->getBody()); + } + + public function testRedirectsNonHTTP() + { + $this->request->setUrl($this->baseUrl . 'redirects.php?special=ftp') + ->setConfig('follow_redirects' => true); + + try { + $this->request->send(); + $this->fail('Expected HTTP_Request2_Exception was not thrown'); + } catch (HTTP_Request2_MessageException $e) { + $this->assertEquals(HTTP_Request2_Exception::NON_HTTP_REDIRECT, $e->getCode()); + } + } + + public function testCookieJar() + { + $this->request->setUrl($this->baseUrl . 'setcookie.php?name=cookie_name&value=cookie_value'); + $req2 = clone $this->request; + + $this->request->setCookieJar()->send(); + $jar = $this->request->getCookieJar(); + $jar->store( + 'name' => 'foo', 'value' => 'bar', + $this->request->getUrl() + ); + + $response = $req2->setUrl($this->baseUrl . 'cookies.php')->setCookieJar($jar)->send(); + $this->assertEquals( + serialize('cookie_name' => 'cookie_value', 'foo' => 'bar'), + $response->getBody() + ); + } + + public function testCookieJarAndRedirect() + { + $this->request->setUrl($this->baseUrl . 'redirects.php?special=cookie') + ->setConfig('follow_redirects', true) + ->setCookieJar(); + + $response = $this->request->send(); + $this->assertEquals(serialize('cookie_on_redirect' => 'success'), $response->getBody()); + } + + /** + * @link http://pear.php.net/bugs/bug.php?id=20125 + */ + public function testChunkedRequest() + { + $data = + 'long' => str_repeat('a', 1000), + 'very_long' => str_repeat('b', 2000) + ; + + $this->request->setMethod(HTTP_Request2::METHOD_POST) + ->setUrl($this->baseUrl . 'postparameters.php') + ->setConfig('buffer_size', 512) + ->setHeader('Transfer-Encoding', 'chunked') + ->addPostParameter($data); + + $response = $this->request->send(); + $this->assertEquals(serialize($data), $response->getBody()); + } + + /** + * @link http://pear.php.net/bugs/bug.php?id=19233 + * @link http://pear.php.net/bugs/bug.php?id=15937 + */ + public function testPreventExpectHeader() + { + $fp = fopen(dirname(dirname(__DIR__)) . '/_files/bug_15305', 'rb'); + $observer = new HTTP_Request2_Adapter_HeaderObserver(); + $body = new HTTP_Request2_MultipartBody( + , + + 'upload' => + 'fp' => $fp, + 'filename' => 'bug_15305', + 'type' => 'application/octet-stream', + 'size' => 16338 + + + ); + + $this->request->setMethod(HTTP_Request2::METHOD_POST) + ->setUrl($this->baseUrl . 'uploads.php') + ->setHeader('Expect', '') + ->setBody($body) + ->attach($observer); + + $response = $this->request->send(); + $this->assertStringNotContainsString('Expect:', $observer->headers); + $this->assertStringContainsString('upload bug_15305 application/octet-stream 16338', $response->getBody()); + } + + public function testDownloadObserverWithPlainBody() + { + $fp = fopen('php://memory', 'r+'); + $observer = new HTTP_Request2_Observer_UncompressingDownload($fp); + + $this->request->setConfig('store_body', false) + ->setUrl($this->baseUrl . 'download.php') + ->attach($observer); + + $this->request->send(); + rewind($fp); + $this->assertEquals(str_repeat('0123456789abcdef', 128), fread($fp, 8192)); + } + + public function testDownloadObserverWithGzippedBody() + { + $fp = fopen('php://memory', 'r+'); + $observer = new HTTP_Request2_Observer_UncompressingDownload($fp); + + $this->request->setConfig('store_body', false) + ->attach($observer); + + $normal = clone $this->request; + $normal->setUrl($this->baseUrl . 'download.php?gzip') + ->send(); + + $slow = clone $this->request; + $slow->setUrl($this->baseUrl . 'download.php?gzip&slowpoke') + ->send(); + + rewind($fp); + $this->assertEquals(str_repeat('0123456789abcdef', 256), fread($fp, 8192)); + } + + public function testDownloadObserverEnforcesSizeLimit() + { + $this->expectException(\HTTP_Request2_MessageException::class); + $this->expectExceptionMessage('Body length limit'); + $fp = fopen('php://memory', 'r+'); + $observer = new HTTP_Request2_Observer_UncompressingDownload($fp, 1000); + + $this->request->setConfig('store_body', false) + ->setUrl($this->baseUrl . 'download.php?gzip') + ->attach($observer); + + $this->request->send(); + } + + public function testIncompleteBody() + { + $events = 'receivedBodyPart', 'warning', 'receivedBody'; + $this->request->setHeader('Accept-Encoding', 'identity'); + + $plain = clone $this->request; + $plain->attach($observer = new HTTP_Request2_Adapter_EventSequenceObserver($events)); + $response = $plain->send(); + $this->assertEquals('This is a test', $response->getBody()); + $this->assertEquals($events, $observer->sequence); + + $chunked = clone $this->request; + $chunked->getUrl()->setQueryVariable('chunked', 'yep'); + $chunked->attach($observer = new HTTP_Request2_Adapter_EventSequenceObserver($events)); + $response = $chunked->send(); + $this->assertEquals('This is a test', $response->getBody()); + $this->assertEquals($events, $observer->sequence); + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/Adapter/CurlTest.php
Added
@@ -0,0 +1,180 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Tests for HTTP_Request2 package that require a working webserver */ +require_once __DIR__ . '/CommonNetworkTest.php'; + +require_once __DIR__ . '/UploadSizeObserver.php'; + +/** + * Unit test for Curl Adapter of HTTP_Request2 + */ +class HTTP_Request2_Adapter_CurlTest extends HTTP_Request2_Adapter_CommonNetworkTest +{ + /** + * Configuration for HTTP Request object + * @var array + */ + protected $config = + 'adapter' => \HTTP_Request2_Adapter_Curl::class + ; + + protected function set_up() + { + parent::set_up(); + if (!extension_loaded('curl')) { + $this->markTestSkipped("Curl extension should be enabled to run Curl tests"); + } + } + + /** + * Checks whether redirect support in cURL is disabled by safe_mode or open_basedir + * @return bool + */ + protected function isRedirectSupportDisabled() + { + return ini_get('safe_mode') || ini_get('open_basedir'); + } + + public function testRedirectsDefault() + { + if ($this->isRedirectSupportDisabled()) { + $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); + } else { + parent::testRedirectsDefault(); + } + } + + public function testRedirectsStrict() + { + if ($this->isRedirectSupportDisabled()) { + $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); + } else { + parent::testRedirectsStrict(); + } + } + + public function testRedirectsLimit() + { + if ($this->isRedirectSupportDisabled()) { + $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); + } else { + parent::testRedirectsLimit(); + } + } + + public function testRedirectsRelative() + { + if ($this->isRedirectSupportDisabled()) { + $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); + } else { + parent::testRedirectsRelative(); + } + } + + public function testRedirectsNonHTTP() + { + if ($this->isRedirectSupportDisabled()) { + $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); + } else { + parent::testRedirectsNonHTTP(); + } + } + + public function testCookieJarAndRedirect() + { + if ($this->isRedirectSupportDisabled()) { + $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); + } else { + parent::testCookieJarAndRedirect(); + } + } + + public function testBug17450() + { + if (!$this->isRedirectSupportDisabled()) { + $this->markTestSkipped('Neither safe_mode nor open_basedir is enabled'); + } + + $this->request->setUrl($this->baseUrl . 'redirects.php') + ->setConfig('follow_redirects' => true); + + try { + $this->request->send(); + $this->fail('Expected HTTP_Request2_Exception was not thrown'); + + } catch (HTTP_Request2_LogicException $e) { + $this->assertEquals(HTTP_Request2_Exception::MISCONFIGURATION, $e->getCode()); + } + } + + public function testBug20440() + { + $this->request->setUrl($this->baseUrl . 'rawpostdata.php') + ->setMethod(HTTP_Request2::METHOD_PUT) + ->setHeader('Expect', '') + ->setBody('This is a test'); + + $noredirects = clone $this->request; + $noredirects->setConfig('follow_redirects', false) + ->attach($observer = new HTTP_Request2_Adapter_UploadSizeObserver()); + $noredirects->send(); + // Curl sends body with Transfer-encoding: chunked, so size can be larger + $this->assertGreaterThanOrEqual(14, $observer->size); + + $redirects = clone $this->request; + $redirects->setConfig('follow_redirects', true) + ->attach($observer = new HTTP_Request2_Adapter_UploadSizeObserver()); + $redirects->send(); + $this->assertGreaterThanOrEqual(14, $observer->size); + } + + /** + * An URL performing a redirect was used for storing cookies in a jar rather than target URL + * + * @link http://pear.php.net/bugs/bug.php?id=20561 + */ + public function testBug20561() + { + if ($this->isRedirectSupportDisabled()) { + $this->markTestSkipped('Redirect support in cURL is disabled by safe_mode or open_basedir setting'); + + } else { + $this->request->setUrl($this->baseUrl . 'redirects.php?special=youtube') + ->setConfig( + 'follow_redirects' => true, + 'ssl_verify_peer' => false + ) + ->setCookieJar(true); + + $this->request->send(); + $this->assertGreaterThan(0, count($this->request->getCookieJar()->getAll())); + } + } + + public function testIncompleteBody() + { + if (version_compare(phpversion(), '7.4', '>=')) { + $this::expectException(\HTTP_Request2_Exception::class); + } + parent::testIncompleteBody(); + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/Adapter/EventSequenceObserver.php
Added
@@ -0,0 +1,50 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Saves observed event names + */ +class HTTP_Request2_Adapter_EventSequenceObserver implements SplObserver +{ + private $_watched = ; + + public $sequence = ; + + public function __construct(array $watchedEvents = ) + { + if (!empty($watchedEvents)) { + $this->_watched = $watchedEvents; + } + } + + #ReturnTypeWillChange + public function update(SplSubject $subject) + { + /* @var $subject HTTP_Request2 */ + $event = $subject->getLastEvent(); + + if ($event'name' !== end($this->sequence) + && (empty($this->_watched) || in_array($event'name', $this->_watched, true)) + ) { + $this->sequence = $event'name'; + } + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/Adapter/HeaderObserver.php
Added
@@ -0,0 +1,39 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Observer that saves request headers + */ +class HTTP_Request2_Adapter_HeaderObserver implements SplObserver +{ + public $headers; + + #ReturnTypeWillChange + public function update(SplSubject $subject) + { + /* @var $subject HTTP_Request2 */ + $event = $subject->getLastEvent(); + + if ('sentHeaders' == $event'name') { + $this->headers = $event'data'; + } + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/Adapter/MockTest.php
Added
@@ -0,0 +1,149 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Sets up includes */ +require_once dirname(dirname(__DIR__)) . '/TestHelper.php'; + +use Yoast\PHPUnitPolyfills\TestCases\TestCase; + +/** + * Unit test for HTTP_Request2_Response class + */ +class HTTP_Request2_Adapter_MockTest extends TestCase +{ + public function testDefaultResponse() + { + $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_GET, + 'adapter' => 'mock'); + $response = $req->send(); + $this->assertEquals(400, $response->getStatus()); + $this->assertEquals(0, count($response->getHeader())); + $this->assertEquals('', $response->getBody()); + } + + public function testResponseFromString() + { + $mock = new HTTP_Request2_Adapter_Mock(); + $mock->addResponse( + "HTTP/1.1 200 OK\r\n" . + "Content-Type: text/plain; charset=iso-8859-1\r\n" . + "\r\n" . + "This is a string" + ); + $req = new HTTP_Request2('http://www.example.com/'); + $req->setAdapter($mock); + + $response = $req->send(); + $this->assertEquals(200, $response->getStatus()); + $this->assertEquals(1, count($response->getHeader())); + $this->assertEquals('This is a string', $response->getBody()); + } + + public function testResponseFromFile() + { + $mock = new HTTP_Request2_Adapter_Mock(); + $mock->addResponse(fopen(dirname(dirname(__DIR__)) . + '/_files/response_headers', 'rb')); + + $req = new HTTP_Request2('http://www.example.com/'); + $req->setAdapter($mock); + + $response = $req->send(); + $this->assertEquals(200, $response->getStatus()); + $this->assertEquals(7, count($response->getHeader())); + $this->assertEquals('Nothing to see here, move along.', $response->getBody()); + } + + public function testResponsesQueue() + { + $mock = new HTTP_Request2_Adapter_Mock(); + $mock->addResponse( + "HTTP/1.1 301 Over there\r\n" . + "Location: http://www.example.com/newpage.html\r\n" . + "\r\n" . + "The document is over there" + ); + $mock->addResponse( + "HTTP/1.1 200 OK\r\n" . + "Content-Type: text/plain; charset=iso-8859-1\r\n" . + "\r\n" . + "This is a string" + ); + + $req = new HTTP_Request2('http://www.example.com/'); + $req->setAdapter($mock); + $this->assertEquals(301, $req->send()->getStatus()); + $this->assertEquals(200, $req->send()->getStatus()); + $this->assertEquals(400, $req->send()->getStatus()); + } + + /** + * Returning URL-specific responses + * @link http://pear.php.net/bugs/bug.php?id=19276 + */ + public function testRequest19276() + { + $mock = new HTTP_Request2_Adapter_Mock(); + $mock->addResponse( + "HTTP/1.1 200 OK\r\n" . + "Content-Type: text/plain; charset=iso-8859-1\r\n" . + "\r\n" . + "This is a response from example.org", + 'http://example.org/' + ); + $mock->addResponse( + "HTTP/1.1 200 OK\r\n" . + "Content-Type: text/plain; charset=iso-8859-1\r\n" . + "\r\n" . + "This is a response from example.com", + 'http://example.com/' + ); + + $req1 = new HTTP_Request2('http://localhost/'); + $req1->setAdapter($mock); + $this->assertEquals(400, $req1->send()->getStatus()); + + $req2 = new HTTP_Request2('http://example.com/'); + $req2->setAdapter($mock); + $this->assertStringContainsString('example.com', $req2->send()->getBody()); + + $req3 = new HTTP_Request2('http://example.org'); + $req3->setAdapter($mock); + $this->assertStringContainsString('example.org', $req3->send()->getBody()); + } + + public function testResponseException() + { + $mock = new HTTP_Request2_Adapter_Mock(); + $mock->addResponse( + new HTTP_Request2_Exception('Shit happens') + ); + $req = new HTTP_Request2('http://www.example.com/'); + $req->setAdapter($mock); + try { + $req->send(); + } catch (Exception $e) { + $this->assertEquals('Shit happens', $e->getMessage()); + return; + } + $this->fail('Expected HTTP_Request2_Exception was not thrown'); + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/Adapter/SlowpokeBody.php
Added
@@ -0,0 +1,43 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Makes a 3 second delay before sending the request body + */ +class HTTP_Request2_Adapter_SlowpokeBody extends HTTP_Request2_MultipartBody +{ + protected $doSleep; + + public function rewind() + { + $this->doSleep = true; + parent::rewind(); + } + + public function read($length) + { + if ($this->doSleep) { + sleep(3); + $this->doSleep = false; + } + return parent::read($length); + } +} +?>
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/Adapter/SocketProxyTest.php
Added
@@ -0,0 +1,56 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Tests for HTTP_Request2 package that require a working webserver */ +require_once __DIR__ . '/CommonNetworkTest.php'; + +/** + * Unit test for Socket Adapter of HTTP_Request2 working through proxy + */ +class HTTP_Request2_Adapter_SocketProxyTest extends HTTP_Request2_Adapter_CommonNetworkTest +{ + /** + * Configuration for HTTP Request object + * @var array + */ + protected $config = + 'adapter' => \HTTP_Request2_Adapter_Socket::class + ; + + protected function set_up() + { + parent::set_up(); + + if (!HTTP_REQUEST2_TESTS_PROXY_HOST) { + $this->markTestSkipped('Proxy is not configured'); + + } else { + $this->config += + 'proxy_host' => HTTP_REQUEST2_TESTS_PROXY_HOST, + 'proxy_port' => HTTP_REQUEST2_TESTS_PROXY_PORT, + 'proxy_user' => HTTP_REQUEST2_TESTS_PROXY_USER, + 'proxy_password' => HTTP_REQUEST2_TESTS_PROXY_PASSWORD, + 'proxy_auth_scheme' => HTTP_REQUEST2_TESTS_PROXY_AUTH_SCHEME, + 'proxy_type' => HTTP_REQUEST2_TESTS_PROXY_TYPE + ; + } + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/Adapter/SocketTest.php
Added
@@ -0,0 +1,214 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Tests for HTTP_Request2 package that require a working webserver */ +require_once __DIR__ . '/CommonNetworkTest.php'; + +/** + * Unit test for Socket Adapter of HTTP_Request2 + */ +class HTTP_Request2_Adapter_SocketTest extends HTTP_Request2_Adapter_CommonNetworkTest +{ + /** + * Configuration for HTTP Request object + * @var array + */ + protected $config = + 'adapter' => \HTTP_Request2_Adapter_Socket::class + ; + + /** + * @doesNotPerformAssertions + */ + public function testBug17826() + { + $adapter = new HTTP_Request2_Adapter_Socket(); + + $request1 = new HTTP_Request2($this->baseUrl . 'redirects.php?redirects=2'); + $request1->setConfig('follow_redirects' => true, 'max_redirects' => 3) + ->setAdapter($adapter) + ->send(); + + $request2 = new HTTP_Request2($this->baseUrl . 'redirects.php?redirects=2'); + $request2->setConfig('follow_redirects' => true, 'max_redirects' => 3) + ->setAdapter($adapter) + ->send(); + } + + + /** + * Infinite loop with stream wrapper passed as upload + * + * Dunno how the original reporter managed to pass a file pointer + * that doesn't support fstat() to MultipartBody, maybe he didn't use + * addUpload(). So we don't use it, either. + * + * @link http://pear.php.net/bugs/bug.php?id=19934 + */ + public function testBug19934() + { + if (!in_array('http', stream_get_wrappers())) { + $this->markTestSkipped("This test requires an HTTP fopen wrapper enabled"); + } + + $fp = fopen($this->baseUrl . '/bug19934.php', 'rb'); + $body = new HTTP_Request2_MultipartBody( + , + + 'upload' => + 'fp' => $fp, + 'filename' => 'foo.txt', + 'type' => 'text/plain', + 'size' => 20000 + + + ); + $this->request->setMethod(HTTP_Request2::METHOD_POST) + ->setUrl($this->baseUrl . 'uploads.php') + ->setBody($body); + + set_error_handler($this, 'rewindWarningsHandler'); + $response = $this->request->send(); + restore_error_handler(); + + $this->assertStringContainsString("upload foo.txt text/plain 20000", $response->getBody()); + } + + public function rewindWarningsHandler($errno, $errstr) + { + if (($errno & E_WARNING) && false !== strpos($errstr, 'rewind')) { + return true; + } + return false; + } + + /** + * Do not send request body twice to URLs protected by digest auth + * + * @link http://pear.php.net/bugs/bug.php?id=19233 + */ + public function test100ContinueHandling() + { + if (!HTTP_REQUEST2_TESTS_DIGEST_URL) { + $this->markTestSkipped('This test requires an URL protected by server digest auth'); + } + + $fp = fopen(dirname(dirname(__DIR__)) . '/_files/bug_15305', 'rb'); + $body = $this->getMockBuilder(\HTTP_Request2_MultipartBody::class) + ->setMethods('read') + ->setConstructorArgs( + , + + 'upload' => + 'fp' => $fp, + 'filename' => 'bug_15305', + 'type' => 'application/octet-stream', + 'size' => 16338 + + + ) + ->getMock(); + $body->expects($this->never())->method('read'); + + $this->request->setMethod(HTTP_Request2::METHOD_POST) + ->setUrl(HTTP_REQUEST2_TESTS_DIGEST_URL) + ->setBody($body); + + $this->assertEquals(401, $this->request->send()->getStatus()); + } + + public function test100ContinueTimeoutBug() + { + $fp = fopen(dirname(dirname(__DIR__)) . '/_files/bug_15305', 'rb'); + $body = new HTTP_Request2_MultipartBody( + , + + 'upload' => + 'fp' => $fp, + 'filename' => 'bug_15305', + 'type' => 'application/octet-stream', + 'size' => 16338 + + + ); + + $this->request->setMethod(HTTP_Request2::METHOD_POST) + ->setUrl($this->baseUrl . 'uploads.php?slowpoke') + ->setBody($body); + + $response = $this->request->send(); + $this->assertStringContainsString('upload bug_15305 application/octet-stream 16338', $response->getBody()); + } + + /** + * Socket adapter should not throw an exception (invalid chunk length '') + * if a buggy server doesn't send last zero-length chunk when using chunked encoding + * + * @link http://pear.php.net/bugs/bug.php?id=20228 + */ + public function testBug20228() + { + $events = 'receivedBodyPart', 'warning', 'receivedBody'; + $this->request->setHeader('Accept-Encoding', 'identity') + ->attach($observer = new HTTP_Request2_Adapter_EventSequenceObserver($events)); + $response = $this->request->send(); + + if (false === strpos((string)$response->getHeader('Server'), 'Apache')) { + $this->markTestSkipped("This test will likely fail on non-Apache web server"); + } + + $this->assertEquals('This is a test', $response->getBody()); + $this->assertEquals($events, $observer->sequence); + } + + public function testHowsMySSL() + { + if (!in_array('ssl', stream_get_transports())) { + $this->markTestSkipped("This test requires SSL support"); + } + + $this->request->setUrl('https://www.howsmyssl.com/a/check') + ->setConfig('ssl_verify_peer', false); + + if (null === ($responseData = json_decode($this->request->send()->getBody(), true))) { + $this->fail('Cannot decode JSON from howsmyssl.com response'); + } + + $this->assertEmpty($responseData'insecure_cipher_suites'); + + $this->assertEquals('Probably Okay', $responseData'rating'); + } + + public function testDefaultSocketTimeout() + { + ini_set('default_socket_timeout', 2); + + $this::expectException(\HTTP_Request2_MessageException::class); + $this::expectExceptionMessageMatches('/default_socket_timeout/'); + try { + $this->request->setConfig('timeout', 0) + ->setUrl($this->baseUrl . 'timeout.php') + ->send(); + } finally { + ini_restore('default_socket_timeout'); + } + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/Adapter/UploadSizeObserver.php
Added
@@ -0,0 +1,40 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Stores the length of request body + */ +class HTTP_Request2_Adapter_UploadSizeObserver implements SplObserver +{ + public $size; + + #ReturnTypeWillChange + public function update(SplSubject $subject) + { + /* @var $subject HTTP_Request2 */ + $event = $subject->getLastEvent(); + + if ('sentBody' == $event'name') { + $this->size = $event'data'; + } + } + +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/CookieJarTest.php
Added
@@ -0,0 +1,401 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Sets up includes */ +require_once dirname(__DIR__) . '/TestHelper.php'; + +use Yoast\PHPUnitPolyfills\TestCases\TestCase; + +/** + * Unit test for HTTP_Request2_CookieJar class + */ +class HTTP_Request2_CookieJarTest extends TestCase +{ + /** + * Cookie jar instance being tested + * @var HTTP_Request2_CookieJar + */ + protected $jar; + + protected function set_up() + { + $this->jar = new HTTP_Request2_CookieJar(); + } + + /** + * Test that we can't store junk "cookies" in jar + * + * @dataProvider invalidCookieProvider + */ + public function testStoreInvalid($cookie) + { + $this->expectException(\HTTP_Request2_LogicException::class); + $this->jar->store($cookie); + } + + /** + * Per feature requests, allow to ignore invalid cookies rather than throw exceptions + * + * @link http://pear.php.net/bugs/bug.php?id=19937 + * @link http://pear.php.net/bugs/bug.php?id=20401 + * @dataProvider invalidCookieProvider + */ + public function testCanIgnoreInvalidCookies($cookie) + { + $this->jar->ignoreInvalidCookies(true); + $this->assertFalse($this->jar->store($cookie)); + } + + /** + * Ignore setting a cookie from "parallel" subdomain when relevant option is on + * + * @link http://pear.php.net/bugs/bug.php?id=20401 + */ + public function testRequest20401() + { + $this->jar->ignoreInvalidCookies(true); + $response = HTTP_Request2_Adapter_Mock::createResponseFromFile( + fopen(dirname(__DIR__) . '/_files/response_cookies', 'rb') + ); + $setter = new Net_URL2('http://pecl.php.net/'); + + $this->assertFalse($this->jar->addCookiesFromResponse($response, $setter)); + $this->assertCount(3, $this->jar->getAll()); + } + + + /** + * + * @dataProvider noPSLDomainsProvider + */ + public function testDomainMatchNoPSL($requestHost, $cookieDomain, $expected) + { + $this->jar->usePublicSuffixList(false); + $this->assertEquals($expected, $this->jar->domainMatch($requestHost, $cookieDomain)); + } + + /** + * + * @dataProvider PSLDomainsProvider + */ + public function testDomainMatchPSL($requestHost, $cookieDomain, $expected) + { + $this->jar->usePublicSuffixList(true); + $this->assertEquals($expected, $this->jar->domainMatch($requestHost, $cookieDomain)); + } + + public function testConvertExpiresToISO8601() + { + $dt = new DateTime(); + $dt->setTimezone(new DateTimeZone('UTC')); + $dt->modify('+1 day'); + + $this->jar->store( + 'name' => 'foo', + 'value' => 'bar', + 'domain' => '.example.com', + 'path' => '/', + 'expires' => $dt->format(DateTime::COOKIE), + 'secure' => false + ); + $cookies = $this->jar->getAll(); + $this->assertEquals($cookies0'expires', $dt->format(DateTime::ISO8601)); + } + + public function testProblem2038() + { + $this->jar->store( + 'name' => 'foo', + 'value' => 'bar', + 'domain' => '.example.com', + 'path' => '/', + 'expires' => 'Sun, 01 Jan 2040 03:04:05 GMT', + 'secure' => false + ); + $cookies = $this->jar->getAll(); + $this->assertEquals( + 'name' => 'foo', + 'value' => 'bar', + 'domain' => '.example.com', + 'path' => '/', + 'expires' => '2040-01-01T03:04:05+0000', + 'secure' => false + , $cookies); + } + + public function testStoreExpired() + { + $base = + 'name' => 'foo', + 'value' => 'bar', + 'domain' => '.example.com', + 'path' => '/', + 'secure' => false + ; + + $dt = new DateTime(); + $dt->setTimezone(new DateTimeZone('UTC')); + $dt->modify('-1 day'); + $yesterday = $dt->format(DateTime::COOKIE); + + $dt->modify('+2 days'); + $tomorrow = $dt->format(DateTime::COOKIE); + + $this->jar->store($base + 'expires' => $yesterday); + $this->assertEquals(0, count($this->jar->getAll())); + + $this->jar->store($base + 'expires' => $tomorrow); + $this->assertEquals(1, count($this->jar->getAll())); + $this->jar->store($base + 'expires' => $yesterday); + $this->assertEquals(0, count($this->jar->getAll())); + } + + /** + * + * @dataProvider cookieAndSetterProvider + */ + public function testGetDomainAndPathFromSetter($cookie, $setter, $expected) + { + $this->jar->store($cookie, $setter); + $expected = array_merge($cookie, $expected); + $cookies = $this->jar->getAll(); + $this->assertEquals($expected, $cookies0); + } + + /** + * + * @dataProvider cookieMatchProvider + */ + public function testGetMatchingCookies($url, $expectedCount) + { + $cookies = + 'domain' => '.example.com', 'path' => '/', 'secure' => false, + 'domain' => '.example.com', 'path' => '/', 'secure' => true, + 'domain' => '.example.com', 'path' => '/path', 'secure' => false, + 'domain' => '.example.com', 'path' => '/other', 'secure' => false, + 'domain' => 'example.com', 'path' => '/', 'secure' => false, + 'domain' => 'www.example.com', 'path' => '/', 'secure' => false, + 'domain' => 'specific.example.com', 'path' => '/path', 'secure' => false, + 'domain' => 'nowww.example.com', 'path' => '/', 'secure' => false, + ; + + for ($i = 0; $i < count($cookies); $i++) { + $this->jar->store($cookies$i + 'expires' => null, 'name' => "cookie{$i}", 'value' => "cookie_{$i}_value"); + } + + $this->assertEquals($expectedCount, count($this->jar->getMatching(new Net_URL2($url)))); + } + + public function testLongestPathFirst() + { + $cookie = + 'name' => 'foo', + 'domain' => '.example.com', + ; + foreach ('/', '/specific/path/', '/specific/' as $path) { + $this->jar->store($cookie + 'path' => $path, 'value' => str_replace('/', '_', $path)); + } + $this->assertEquals( + 'foo=_specific_path_; foo=_specific_; foo=_', + $this->jar->getMatching(new Net_URL2('http://example.com/specific/path/file.php'), true) + ); + } + + public function testSerializable() + { + $dt = new DateTime(); + $dt->setTimezone(new DateTimeZone('UTC')); + $dt->modify('+1 day'); + $cookie = 'domain' => '.example.com', 'path' => '/', 'secure' => false, 'value' => 'foo'; + + $this->jar->store($cookie + 'name' => 'session', 'expires' => null); + $this->jar->store($cookie + 'name' => 'long', 'expires' => $dt->format(DateTime::COOKIE)); + + $newJar = unserialize(serialize($this->jar)); + $cookies = $newJar->getAll(); + $this->assertEquals(1, count($cookies)); + $this->assertEquals('long', $cookies0'name'); + + $this->jar->serializeSessionCookies(true); + $newJar = unserialize(serialize($this->jar)); + $this->assertEquals($this->jar->getAll(), $newJar->getAll()); + } + + public function testRemoveExpiredOnUnserialize() + { + $dt = new DateTime(); + $dt->setTimezone(new DateTimeZone('UTC')); + $dt->modify('+2 seconds'); + + $this->jar->store( + 'name' => 'foo', + 'value' => 'bar', + 'domain' => '.example.com', + 'path' => '/', + 'expires' => $dt->format(DateTime::COOKIE), + ); + + $serialized = serialize($this->jar); + sleep(2); + $newJar = unserialize($serialized); + $this->assertEquals(, $newJar->getAll()); + } + + public static function invalidCookieProvider() + { + return + , + 'name' => 'foo', + + 'name' => 'a name', + 'value' => 'bar', + 'domain' => '.example.com', + 'path' => '/', + , + + 'name' => 'foo', + 'value' => 'a value', + 'domain' => '.example.com', + 'path' => '/', + , + + 'name' => 'foo', + 'value' => 'bar', + 'domain' => '.example.com', + 'path' => null, + , + + 'name' => 'foo', + 'value' => 'bar', + 'domain' => null, + 'path' => '/', + , + + 'name' => 'foo', + 'value' => 'bar', + 'domain' => '.example.com', + 'path' => '/', + 'expires' => 'invalid date', + , + ; + } + + public static function noPSLdomainsProvider() + { + return + 'localhost', 'localhost', true, + 'www.example.com', 'www.example.com', true, + '127.0.0.1', '127.0.0.1', true, + '127.0.0.1', '.0.0.1', false, + 'www.example.com', '.example.com', true, + 'deep.within.example.com', '.example.com', true, + 'example.com', '.com', false, + 'anotherexample.com', 'example.com', false, + 'whatever.msk.ru', '.msk.ru', true, + 'whatever.co.uk', '.co.uk', true, + 'whatever.bd', '.whatever.bd', true, + 'whatever.tokyo.jp', '.whatever.tokyo.jp', true, + 'metro.tokyo.jp', '.metro.tokyo.jp', true, + 'foo.bar', '.foo.bar', true + ; + } + + public static function PSLdomainsProvider() + { + return + 'localhost', 'localhost', true, + 'www.example.com', 'www.example.com', true, + '127.0.0.1', '127.0.0.1', true, + '127.0.0.1', '.0.0.1', false, + 'www.example.com', '.example.com', true, + 'deep.within.example.com', '.example.com', true, + 'example.com', '.com', false, + 'anotherexample.com', 'example.com', false, + 'whatever.msk.ru', '.msk.ru', false, + 'whatever.co.uk', '.co.uk', false, + 'whatever.bd', '.whatever.bd', false, + 'com.bn', '.com.bn', false, + 'nic.tr', '.nic.tr', true, + 'foo.bar', '.foo.bar', true + ; + } + + public static function cookieAndSetterProvider() + { + return + + + 'name' => 'foo', + 'value' => 'bar', + 'domain' => null, + 'path' => null, + 'expires' => null, + 'secure' => false + , + new Net_URL2('http://example.com/directory/file.php'), + + 'domain' => 'example.com', + 'path' => '/directory/' + + , + + + 'name' => 'foo', + 'value' => 'bar', + 'domain' => '.example.com', + 'path' => null, + 'expires' => null, + 'secure' => false + , + new Net_URL2('http://example.com/path/to/file.php'), + + 'path' => '/path/to/' + + , + + + 'name' => 'foo', + 'value' => 'bar', + 'domain' => null, + 'path' => '/', + 'expires' => null, + 'secure' => false + , + new Net_URL2('http://example.com/another/file.php'), + + 'domain' => 'example.com' + + + ; + } + + public static function cookieMatchProvider() + { + return + 'http://www.example.com/path/file.php', 4, + 'https://www.example.com/path/file.php', 5, + 'http://example.com/path/file.php', 3, + 'http://specific.example.com/path/file.php', 4, + 'http://specific.example.com/other/file.php', 3, + 'http://another.example.com/another', 2 + ; + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/MultipartBodyTest.php
Added
@@ -0,0 +1,96 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Sets up includes */ +require_once dirname(__DIR__) . '/TestHelper.php'; + +use Yoast\PHPUnitPolyfills\TestCases\TestCase; + +/** + * Unit test for HTTP_Request2_MultipartBody class + */ +class HTTP_Request2_MultipartBodyTest extends TestCase +{ + public function testUploadSimple() + { + $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); + $body = $req->addPostParameter('foo', 'I am a parameter') + ->addUpload('upload', dirname(__DIR__) . '/_files/plaintext.txt') + ->getBody(); + + $this->assertTrue($body instanceof HTTP_Request2_MultipartBody); + $asString = $body->__toString(); + $boundary = $body->getBoundary(); + $this->assertEquals($body->getLength(), strlen($asString)); + $this->assertStringContainsString('This is a test.', $asString); + $this->assertStringContainsString('I am a parameter', $asString); + $this->assertMatchesRegularExpression("!--{$boundary}--\r\n$!", $asString); + } + + public function testRequest16863() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); + $fp = fopen(dirname(__DIR__) . '/_files/plaintext.txt', 'rb'); + $body = $req->addUpload('upload', $fp) + ->getBody(); + + $asString = $body->__toString(); + $this->assertStringContainsString('name="upload"; filename="anonymous.blob"', $asString); + $this->assertStringContainsString('This is a test.', $asString); + + $req->addUpload('bad_upload', fopen('php://input', 'rb')); + } + + public function testStreaming() + { + $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); + $body = $req->addPostParameter('foo', 'I am a parameter') + ->addUpload('upload', dirname(__DIR__) . '/_files/plaintext.txt') + ->getBody(); + $asString = ''; + while ($part = $body->read(10)) { + $asString .= $part; + } + $this->assertEquals($body->getLength(), strlen($asString)); + $this->assertStringContainsString('This is a test.', $asString); + $this->assertStringContainsString('I am a parameter', $asString); + } + + public function testUploadArray() + { + $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); + $body = $req->addUpload('upload', + dirname(__DIR__) . '/_files/plaintext.txt', 'bio.txt', 'text/plain', + fopen(dirname(__DIR__) . '/_files/empty.gif', 'rb'), 'photo.gif', 'image/gif' + ) + ->getBody(); + $asString = $body->__toString(); + $this->assertStringContainsString(file_get_contents(dirname(__DIR__) . '/_files/empty.gif'), $asString); + $this->assertStringContainsString('name="upload0"; filename="bio.txt"', $asString); + $this->assertStringContainsString('name="upload1"; filename="photo.gif"', $asString); + + $body2 = $req->setConfig('use_brackets' => false)->getBody(); + $asString = $body2->__toString(); + $this->assertStringContainsString('name="upload"; filename="bio.txt"', $asString); + $this->assertStringContainsString('name="upload"; filename="photo.gif"', $asString); + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2/ResponseTest.php
Added
@@ -0,0 +1,150 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Sets up includes */ +require_once dirname(__DIR__) . '/TestHelper.php'; + +use Yoast\PHPUnitPolyfills\TestCases\TestCase; + +/** + * Unit test for HTTP_Request2_Response class + */ +class HTTP_Request2_ResponseTest extends TestCase +{ + public function testParseStatusLine() + { + $this->expectException(\HTTP_Request2_MessageException::class); + $response = new HTTP_Request2_Response('HTTP/1.1 200 OK'); + $this->assertEquals('1.1', $response->getVersion()); + $this->assertEquals(200, $response->getStatus()); + $this->assertEquals('OK', $response->getReasonPhrase()); + + $response2 = new HTTP_Request2_Response('HTTP/1.2 222 Nishtyak!'); + $this->assertEquals('1.2', $response2->getVersion()); + $this->assertEquals(222, $response2->getStatus()); + $this->assertEquals('Nishtyak!', $response2->getReasonPhrase()); + + $response3 = new HTTP_Request2_Response('HTTP/1.1 200 '); + $this->assertEquals('1.1', $response3->getVersion()); + $this->assertEquals(200, $response3->getStatus()); + $this->assertEquals('OK', $response3->getReasonPhrase()); + + $response4 = new HTTP_Request2_Response("HTTP/1.1 200 \r\n"); + $this->assertEquals('1.1', $response4->getVersion()); + $this->assertEquals(200, $response4->getStatus()); + $this->assertEquals('OK', $response4->getReasonPhrase()); + + // RFC 9112 gives the following definition for reason-phrase: + // > reason-phrase = 1*( HTAB / SP / VCHAR / obs-text ) + // so do not use trim() and consider whitespace-only reason-phrase as present + $response5 = new HTTP_Request2_Response("HTTP/1.1 200 \r\n"); + $this->assertEquals('1.1', $response5->getVersion()); + $this->assertEquals(200, $response5->getStatus()); + $this->assertEquals(' ', $response5->getReasonPhrase()); + + new HTTP_Request2_Response('Invalid status line'); + } + + /** + * https://www.rfc-editor.org/rfc/rfc9112.html#name-status-line + * + * > A server MUST send the space that separates the status-code from + * > the reason-phrase even when the reason-phrase is absent + * > (i.e., the status-line would end with the space). + */ + public function testSpaceIsRequiredAfterStatusCode() + { + $this->expectException(\HTTP_Request2_MessageException::class); + new HTTP_Request2_Response('HTTP/1.1 200'); + } + + public function testParseHeaders() + { + $response = $this->readResponseFromFile('response_headers'); + $this->assertEquals(7, count($response->getHeader())); + $this->assertEquals('PHP/6.2.2', $response->getHeader('X-POWERED-BY')); + $this->assertEquals('text/html; charset=windows-1251', $response->getHeader('cOnTeNt-TyPe')); + $this->assertEquals('accept-charset, user-agent', $response->getHeader('vary')); + } + + public function testParseCookies() + { + $response = $this->readResponseFromFile('response_cookies'); + $cookies = $response->getCookies(); + $this->assertEquals(4, count($cookies)); + $expected = + 'name' => 'foo', 'value' => 'bar', 'expires' => null, + 'domain' => null, 'path' => null, 'secure' => false, + 'name' => 'PHPSESSID', 'value' => '1234567890abcdef1234567890abcdef', + 'expires' => null, 'domain' => null, 'path' => '/', 'secure' => true, + 'name' => 'A', 'value' => 'B=C', 'expires' => null, + 'domain' => null, 'path' => null, 'secure' => false, + 'name' => 'baz', 'value' => '%20a%20value', 'expires' => 'Sun, 03 Jan 2010 03:04:05 GMT', + 'domain' => 'pear.php.net', 'path' => null, 'secure' => false, + ; + foreach ($cookies as $k => $cookie) { + $this->assertEquals($expected$k, $cookie); + } + } + + public function testGzipEncoding() + { + $this->expectException(\HTTP_Request2_MessageException::class); + $response = $this->readResponseFromFile('response_gzip'); + $this->assertEquals('0e964e9273c606c46afbd311b5ad4d77', md5($response->getBody())); + + $response = $this->readResponseFromFile('response_gzip_broken'); + $response->getBody(); + } + + public function testDeflateEncoding() + { + $response = $this->readResponseFromFile('response_deflate'); + $this->assertEquals('0e964e9273c606c46afbd311b5ad4d77', md5($response->getBody())); + } + + public function testBug15305() + { + $response = $this->readResponseFromFile('bug_15305'); + $this->assertEquals('c8c5088fc8a7652afef380f086c010a6', md5($response->getBody())); + } + + public function testBug18169() + { + $response = $this->readResponseFromFile('bug_18169'); + $this->assertEquals('', $response->getBody()); + } + + protected function readResponseFromFile($filename) + { + $fp = fopen(dirname(__DIR__) . '/_files/' . $filename, 'rb'); + $response = new HTTP_Request2_Response(fgets($fp)); + do { + $headerLine = fgets($fp); + $response->parseHeaderLine($headerLine); + } while ('' != trim($headerLine)); + + while (!feof($fp)) { + $response->appendBody(fread($fp, 1024)); + } + return $response; + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/Request2Test.php
Added
@@ -0,0 +1,361 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** Sets up includes */ +require_once __DIR__ . '/TestHelper.php'; + +use Yoast\PHPUnitPolyfills\TestCases\TestCase; + +/** + * Unit test for HTTP_Request2 class + */ +class HTTP_Request2Test extends TestCase +{ + public function testConstructorSetsDefaults() + { + $url = new Net_URL2('http://www.example.com/foo'); + $req = new HTTP_Request2($url, HTTP_Request2::METHOD_POST, 'connect_timeout' => 666); + + $this->assertSame($url, $req->getUrl()); + $this->assertEquals(HTTP_Request2::METHOD_POST, $req->getMethod()); + $this->assertEquals(666, $req->getConfig('connect_timeout')); + } + + public function testSetUrl() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $urlString = 'http://www.example.com/foo/bar.php'; + $url = new Net_URL2($urlString); + + $req1 = new HTTP_Request2(); + $req1->setUrl($url); + $this->assertSame($url, $req1->getUrl()); + + $req2 = new HTTP_Request2(); + $req2->setUrl($urlString); + $this->assertInstanceOf(\Net_URL2::class, $req2->getUrl()); + $this->assertEquals($urlString, $req2->getUrl()->getUrl()); + + $req3 = new HTTP_Request2(); + $req3->setUrl('This will cause an error'); + } + + public function testConvertUserinfoToAuth() + { + $req = new HTTP_Request2(); + $req->setUrl('http://foo:b%40r@www.example.com/'); + + $this->assertEquals('', (string)$req->getUrl()->getUserinfo()); + $this->assertEquals( + 'user' => 'foo', 'password' => 'b@r', 'scheme' => HTTP_Request2::AUTH_BASIC, + $req->getAuth() + ); + } + + public function testSetMethod() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $req = new HTTP_Request2(); + $req->setMethod(HTTP_Request2::METHOD_PUT); + $this->assertEquals(HTTP_Request2::METHOD_PUT, $req->getMethod()); + + $req->setMethod('Invalid method'); + } + + public function testSetAndGetConfig() + { + $req = new HTTP_Request2(); + $this->assertArrayHasKey('connect_timeout', $req->getConfig()); + + $req->setConfig('connect_timeout' => 123); + $this->assertEquals(123, $req->getConfig('connect_timeout')); + try { + $req->setConfig('foo' => 'unknown parameter'); + $this->fail('Expected HTTP_Request2_LogicException was not thrown'); + } catch (HTTP_Request2_LogicException $e) {} + + try { + $req->getConfig('bar'); + $this->fail('Expected HTTP_Request2_LogicException was not thrown'); + } catch (HTTP_Request2_LogicException $e) {} + } + + public function testSetProxyAsUrl() + { + $req = new HTTP_Request2(); + $req->setConfig('proxy', 'socks5://foo:bar%25baz@localhost:1080/'); + + $this->assertEquals('socks5', $req->getConfig('proxy_type')); + $this->assertEquals('localhost', $req->getConfig('proxy_host')); + $this->assertEquals(1080, $req->getConfig('proxy_port')); + $this->assertEquals('foo', $req->getConfig('proxy_user')); + $this->assertEquals('bar%baz', $req->getConfig('proxy_password')); + } + + public function testHeaders() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $req = new HTTP_Request2(); + $autoHeaders = $req->getHeaders(); + + $req->setHeader('Foo', 'Bar'); + $req->setHeader('Foo-Bar: value'); + $req->setHeader('Another-Header' => 'another value', 'Yet-Another: other_value'); + $this->assertEquals( + 'foo-bar' => 'value', 'another-header' => 'another value', + 'yet-another' => 'other_value', 'foo' => 'Bar' + $autoHeaders, + $req->getHeaders() + ); + + $req->setHeader('FOO-BAR'); + $req->setHeader('aNOTHER-hEADER'); + $this->assertEquals( + 'yet-another' => 'other_value', 'foo' => 'Bar' + $autoHeaders, + $req->getHeaders() + ); + + $req->setHeader('Invalid header', 'value'); + } + + public function testBug15937() + { + $req = new HTTP_Request2(); + $autoHeaders = $req->getHeaders(); + + $req->setHeader('Expect: '); + $req->setHeader('Foo', ''); + $this->assertEquals( + 'expect' => '', 'foo' => '' + $autoHeaders, + $req->getHeaders() + ); + } + + public function testRequest17507() + { + $req = new HTTP_Request2(); + + $req->setHeader('accept-charset', 'iso-8859-1'); + $req->setHeader('accept-charset', 'windows-1251', 'utf-8', false); + + $req->setHeader('accept' => 'text/html'); + $req->setHeader('accept' => 'image/gif', null, false); + + $headers = $req->getHeaders(); + + $this->assertEquals('iso-8859-1, windows-1251, utf-8', $headers'accept-charset'); + $this->assertEquals('text/html, image/gif', $headers'accept'); + } + + public function testCookies() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $req = new HTTP_Request2(); + $req->addCookie('name', 'value'); + $req->addCookie('foo', 'bar'); + $headers = $req->getHeaders(); + $this->assertEquals('name=value; foo=bar', $headers'cookie'); + + $req->addCookie('invalid cookie', 'value'); + } + + public function testPlainBody() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $req = new HTTP_Request2(); + $req->setBody('A string'); + $this->assertEquals('A string', $req->getBody()); + + $req->setBody(__DIR__ . '/_files/plaintext.txt', true); + $headers = $req->getHeaders(); + $this->assertMatchesRegularExpression( + '!^(text/plain|application/octet-stream)!', + $headers'content-type' + ); + $this->assertEquals('This is a test.', fread($req->getBody(), 1024)); + + $req->setBody('missing file', true); + } + + public function testRequest16863() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $req = new HTTP_Request2(); + $req->setBody(fopen(__DIR__ . '/_files/plaintext.txt', 'rb')); + $headers = $req->getHeaders(); + $this->assertEquals('application/octet-stream', $headers'content-type'); + + $req->setBody(fopen('php://input', 'rb')); + } + + public function testUrlencodedBody() + { + $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); + $req->addPostParameter('foo', 'bar'); + $req->addPostParameter('baz' => 'quux'); + $req->addPostParameter('foobar', 'one', 'two'); + $this->assertEquals( + 'foo=bar&baz=quux&foobar%5B0%5D=one&foobar%5B1%5D=two', + $req->getBody() + ); + + $req->setConfig('use_brackets' => false); + $this->assertEquals( + 'foo=bar&baz=quux&foobar=one&foobar=two', + $req->getBody() + ); + } + + public function testRequest15368() + { + $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); + $req->addPostParameter('foo', 'te~st'); + $this->assertStringContainsString('~', $req->getBody()); + } + + public function testUpload() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $this->expectExceptionMessage('missing file'); + $req = new HTTP_Request2(null, HTTP_Request2::METHOD_POST); + $req->addUpload('upload', __DIR__ . '/_files/plaintext.txt'); + + $headers = $req->getHeaders(); + $this->assertEquals('multipart/form-data', $headers'content-type'); + + $req->addUpload('upload_2', 'missing file'); + } + + public function testPropagateUseBracketsToNetURL2() + { + $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_GET, + 'use_brackets' => false); + $req->getUrl()->setQueryVariable('foo', 'bar', 'baz'); + $this->assertEquals('http://www.example.com/?foo=bar&foo=baz', $req->getUrl()->__toString()); + + $req->setConfig('use_brackets', true)->setUrl('http://php.example.com/'); + $req->getUrl()->setQueryVariable('foo', 'bar', 'baz'); + + $this->assertEquals('http://php.example.com/?foo=bar&foo=baz', $req->getUrl()->__toString()); + } + + public function testSetBodyRemovesPostParameters() + { + $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_POST); + $req->addPostParameter('foo', 'bar'); + $req->setBody(''); + $this->assertEquals('', $req->getBody()); + } + + public function testPostParametersPrecedeSetBodyForPost() + { + $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_POST); + $req->setBody('Request body'); + $req->addPostParameter('foo', 'bar'); + + $this->assertEquals('foo=bar', $req->getBody()); + + $req->setMethod(HTTP_Request2::METHOD_PUT); + $this->assertEquals('Request body', $req->getBody()); + } + + public function testSetMultipartBody() + { + require_once 'HTTP/Request2/MultipartBody.php'; + + $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_POST); + $body = new HTTP_Request2_MultipartBody('foo' => 'bar', ); + $req->setBody($body); + $this->assertSame($body, $req->getBody()); + } + + public function testBug17460() + { + $req = new HTTP_Request2('http://www.example.com/', HTTP_Request2::METHOD_POST); + $req->addPostParameter('foo', 'bar') + ->setHeader('content-type', 'application/x-www-form-urlencoded; charset=UTF-8'); + + $this->assertEquals('foo=bar', $req->getBody()); + } + + public function testCookieJar() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $req = new HTTP_Request2(); + $this->assertNull($req->getCookieJar()); + + $req->setCookieJar(); + $jar = $req->getCookieJar(); + $this->assertInstanceOf(\HTTP_Request2_CookieJar::class, $jar); + + $req2 = new HTTP_Request2(); + $req2->setCookieJar($jar); + $this->assertSame($jar, $req2->getCookieJar()); + + $req2->setCookieJar(null); + $this->assertNull($req2->getCookieJar()); + + $req2->setCookieJar('foo'); + } + + public function testAddCookieToJar() + { + $req = new HTTP_Request2(); + $req->setCookieJar(); + + try { + $req->addCookie('foo', 'bar'); + $this->fail('Expected HTTP_Request2_Exception was not thrown'); + } catch (HTTP_Request2_LogicException $e) { } + + $req->setUrl('http://example.com/path/file.php'); + $req->addCookie('foo', 'bar'); + + $this->assertArrayNotHasKey('cookie', $req->getHeaders()); + $cookies = $req->getCookieJar()->getAll(); + $this->assertEquals( + + 'name' => 'foo', + 'value' => 'bar', + 'domain' => 'example.com', + 'path' => '/path/', + 'expires' => null, + 'secure' => false + , + $cookies0 + ); + } + + public function testDisallowEmptyUrls() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $this->expectExceptionMessage('none'); + $req = new HTTP_Request2(); + $req->send(); + } + + public function testDisallowRelativeUrls() + { + $this->expectException(\HTTP_Request2_LogicException::class); + $this->expectExceptionMessage('\'/foo/bar.php\''); + $req = new HTTP_Request2('/foo/bar.php'); + $req->send(); + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/TestHelper.php
Added
@@ -0,0 +1,64 @@ +<?php +/** + * Unit tests for HTTP_Request2 package + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +if ('@' . 'package_version@' !== '2.6.0') { + // Installed with PEAR: we should be on the include path, just require_once everything + require_once 'HTTP/Request2.php'; + require_once 'HTTP/Request2/CookieJar.php'; + require_once 'HTTP/Request2/MultipartBody.php'; + require_once 'HTTP/Request2/Response.php'; + require_once 'HTTP/Request2/Adapter/Mock.php'; + require_once 'HTTP/Request2/Adapter/Socket.php'; + require_once 'HTTP/Request2/Observer/UncompressingDownload.php'; + $installed = true; + +} else { + $installed = false; + foreach (__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php' as $file) { + if (file_exists($file)) { + // found composer autoloader, use it + require_once $file; + $installed = true; + + break; + } + } +} + +if (!$installed) { + fwrite(STDERR, + 'As HTTP_Request2 has required dependencies, tests should be run either' . PHP_EOL . PHP_EOL . + ' - after installation of package with PEAR:' . PHP_EOL . + ' pear install package.xml' . PHP_EOL . PHP_EOL . + ' - or setting up its dependencies using Composer:' . PHP_EOL . + ' composer install' . PHP_EOL . PHP_EOL + ); + + die(1); +} + +if (!defined('HTTP_REQUEST2_TESTS_BASE_URL')) { + if (is_readable(__DIR__ . '/NetworkConfig.php')) { + require_once __DIR__ . '/NetworkConfig.php'; + } else { + require_once __DIR__ . '/NetworkConfig.php.dist'; + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_files/bug_15305
Changed
(renamed from HTTP_Request2-2.3.0/tests/_files/bug_15305)
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_files/bug_18169
Changed
(renamed from HTTP_Request2-2.3.0/tests/_files/bug_18169)
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_files/empty.gif
Changed
(renamed from HTTP_Request2-2.3.0/tests/_files/empty.gif)
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_files/plaintext.txt
Changed
(renamed from HTTP_Request2-2.3.0/tests/_files/plaintext.txt)
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_files/response_cookies
Changed
(renamed from HTTP_Request2-2.3.0/tests/_files/response_cookies)
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_files/response_deflate
Changed
(renamed from HTTP_Request2-2.3.0/tests/_files/response_deflate)
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_files/response_gzip
Changed
(renamed from HTTP_Request2-2.3.0/tests/_files/response_gzip)
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_files/response_gzip_broken
Changed
(renamed from HTTP_Request2-2.3.0/tests/_files/response_gzip_broken)
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_files/response_headers
Changed
(renamed from HTTP_Request2-2.3.0/tests/_files/response_headers)
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/basicauth.php
Added
@@ -0,0 +1,33 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +$user = isset($_SERVER'PHP_AUTH_USER') ? $_SERVER'PHP_AUTH_USER' : null; +$pass = isset($_SERVER'PHP_AUTH_PW') ? $_SERVER'PHP_AUTH_PW' : null; +$wantedUser = isset($_GET'user') ? $_GET'user' : null; +$wantedPass = isset($_GET'pass') ? $_GET'pass' : null; + +if (!$user || !$pass || $user != $wantedUser || $pass != $wantedPass) { + header('WWW-Authenticate: Basic realm="HTTP_Request2 tests"', true, 401); + echo "Login required"; +} else { + echo "Username={$user};Password={$pass}"; +} + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/bug19934.php
Added
@@ -0,0 +1,27 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +for ($i = 0; $i < 20; $i++) { + for ($j = 0; $j < 10; $j++) { + echo str_repeat((string)$j, 98) . "\r\n"; + } + flush(); + usleep(50000); +} \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/bug20228.php
Added
@@ -0,0 +1,24 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +header('Transfer-Encoding: chunked'); + +echo "e\r\n"; +echo "This is a test\r\n";
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/cookies.php
Added
@@ -0,0 +1,24 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +ksort($_COOKIE); +echo serialize($_COOKIE); + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/digestauth.php
Added
@@ -0,0 +1,83 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +/** + * Mostly borrowed from PHP manual and Socket Adapter implementation + * + * @link http://php.net/manual/en/features.http-auth.php + */ + +/** + * Parses the Digest auth header + * + * @param string $txt + */ +function http_digest_parse($txt) +{ + $token = '^\x00-\x1f\x7f-\xff()<>@,;:\\\\"/\\?={}\s+'; + $quoted = '"(?:\\\\.|^\\\\")*"'; + + // protect against missing data + $needed_parts = array_flip('nonce', 'nc', 'cnonce', 'qop', 'username', 'uri', 'response'); + $data = ; + + preg_match_all("!({$token})\\s*=\\s*({$token}|{$quoted})!", $txt, $matches); + for ($i = 0; $i < count($matches0); $i++) { + // ignore unneeded parameters + if (isset($needed_parts$matches1$i)) { + unset($needed_parts$matches1$i); + if ('"' == substr($matches2$i, 0, 1)) { + $data$matches1$i = substr($matches2$i, 1, -1); + } else { + $data$matches1$i = $matches2$i; + } + } + } + + return !empty($needed_parts) ? false : $data; +} + +$realm = 'HTTP_Request2 tests'; +$wantedUser = isset($_GET'user') ? $_GET'user' : null; +$wantedPass = isset($_GET'pass') ? $_GET'pass' : null; +$validAuth = false; + +if (!empty($_SERVER'PHP_AUTH_DIGEST') + && ($data = http_digest_parse($_SERVER'PHP_AUTH_DIGEST')) + && $wantedUser == $data'username' +) { + // generate the valid response + $a1 = md5($data'username' . ':' . $realm . ':' . $wantedPass); + $a2 = md5($_SERVER'REQUEST_METHOD' . ':' . $data'uri'); + $response = md5($a1. ':' . $data'nonce' . ':' . $data'nc' . ':' + . $data'cnonce' . ':' . $data'qop' . ':' . $a2); + + // check valid response against existing one + $validAuth = ($data'response' == $response); +} + +if (!$validAuth || empty($_SERVER'PHP_AUTH_DIGEST')) { + header('WWW-Authenticate: Digest realm="' . $realm . + '",qop="auth",nonce="' . uniqid() . '"', true, 401); + echo "Login required"; +} else { + echo "Username={$data'username'}"; +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/download.php
Added
@@ -0,0 +1,45 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +$payload = str_repeat('0123456789abcdef', 128); + +if (array_key_exists('gzip', $_GET)) { + // we inject a long "filename" into the header to check whether the downloader + // can handle an incomplete header in "slowpoke" mode + $payload = pack('c4Vc2', 0x1f, 0x8b, 8, 8, time(), 2, 255) + . str_repeat('a_really_really_long_file_name', 10) . '.txt' . chr(0) + . gzdeflate($payload) + . pack('V2', crc32($payload), 2048); + header('Content-Encoding: gzip'); +} + +if (!array_key_exists('slowpoke', $_GET)) { + echo $payload; + +} else { + $pos = 0; + $length = strlen($payload); + while ($pos < $length) { + echo substr($payload, $pos, 65); + $pos += 65; + flush(); + usleep(50000); + } +} \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/getparameters.php
Added
@@ -0,0 +1,24 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +ksort($_GET); +echo serialize($_GET); + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/incompletebody.php
Added
@@ -0,0 +1,32 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +header('Connection: close'); + +if (array_key_exists('chunked', $_GET)) { + header('Transfer-Encoding: chunked'); + echo "2A\r\n"; + +} else { + header('Content-Length: 42'); +} + +echo "This is a test"; +flush(); \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/postparameters.php
Added
@@ -0,0 +1,24 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +ksort($_POST); +echo serialize($_POST); + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/rawpostdata.php
Added
@@ -0,0 +1,22 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +readfile('php://input'); +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/redirects.php
Added
@@ -0,0 +1,50 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +$redirects = isset($_GET'redirects')? $_GET'redirects': 1; +$https = !empty($_SERVER'HTTPS') && ('off' != strtolower($_SERVER'HTTPS')); +$special = isset($_GET'special')? $_GET'special': null; + +if ('ftp' == $special) { + header('Location: ftp://localhost/pub/exploit.exe', true, 301); + +} elseif ('youtube' == $special) { + header('Location: https://youtube.com/', true, 301); + +} elseif ('relative' == $special) { + header('Location: ./getparameters.php?msg=did%20relative%20redirect', true, 302); + +} elseif ('cookie' == $special) { + setcookie('cookie_on_redirect', 'success'); + header('Location: ./cookies.php', true, 302); + +} elseif ($redirects > 0) { + $url = ($https? 'https': 'http') . '://' . $_SERVER'SERVER_NAME' + . (($https && 443 == $_SERVER'SERVER_PORT' || !$https && 80 == $_SERVER'SERVER_PORT') + ? '' : ':' . $_SERVER'SERVER_PORT') + . $_SERVER'PHP_SELF' . '?redirects=' . (--$redirects); + header('Location: ' . $url, true, 302); + +} else { + echo "Method=" . $_SERVER'REQUEST_METHOD' . ';'; + var_dump($_POST); + var_dump($_GET); +} +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/setcookie.php
Added
@@ -0,0 +1,27 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +$name = empty($_GET'name')? 'foo': $_GET'name'; +$value = empty($_GET'value')? 'bar': $_GET'value'; + +setcookie($name, $value); + +echo "Cookie set!"; +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/timeout.php
Added
@@ -0,0 +1,23 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +sleep(5); + +?> \ No newline at end of file
View file
HTTP_Request2-2.6.0.tgz/HTTP_Request2-2.6.0/tests/_network/uploads.php
Added
@@ -0,0 +1,34 @@ +<?php +/** + * Helper files for HTTP_Request2 unit tests. Should be accessible via HTTP. + * + * PHP version 5 + * + * LICENSE + * + * This source file is subject to BSD 3-Clause License that is bundled + * with this package in the file LICENSE and available at the URL + * https://raw.github.com/pear/HTTP_Request2/trunk/docs/LICENSE + * + * @category HTTP + * @package HTTP_Request2 + * @author Alexey Borzov <avb@php.net> + * @copyright 2008-2023 Alexey Borzov <avb@php.net> + * @license http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License + * @link http://pear.php.net/package/HTTP_Request2 + */ + +if (isset($_GET'slowpoke')) { + sleep(3); +} + +foreach ($_FILES as $name => $file) { + if (is_array($file'name')) { + foreach($file'name' as $k => $v) { + echo "{$name}{$k} {$v} {$file'type'$k} {$file'size'$k}\n"; + } + } else { + echo "{$name} {$file'name'} {$file'type'} {$file'size'}\n"; + } +} +?> \ No newline at end of file
View file
HTTP_Request2-2.3.0.tgz/package.xml -> HTTP_Request2-2.6.0.tgz/package.xml
Changed
@@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<package packagerversion="1.9.5" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> +<package packagerversion="1.10.13" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>HTTP_Request2</name> <channel>pear.php.net</channel> <extends>HTTP_Request</extends> @@ -18,11 +18,11 @@ <email>avb@php.net</email> <active>yes</active> </lead> - <date>2016-02-13</date> - <time>20:23:34</time> + <date>2023-11-01</date> + <time>20:03:16</time> <version> - <release>2.3.0</release> - <api>2.3.0</api> + <release>2.6.0</release> + <api>2.4.0</api> </version> <stability> <release>stable</release> @@ -30,74 +30,64 @@ </stability> <license uri="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</license> <notes> -New features: - * New observer that can do on-the-fly decoding of compressed responses, - see HTTP_Request2_Observer_UncompressingDownload. - Thanks to Delian Krustev for initial implementation. - * CookieJar can now silently ignore invalid cookies with $jar->ignoreInvalidCookies(true); - instead of throwing an exception. See requests #19937 and #20401 - * Adapters now dispatch a new 'warning' event, e.g. in case of incomplete response - body or broken 'chunked' encoding. Exception was thrown previously by Socket adapter - in the latter case, see bug #20228 - * Improved security of HTTPS requests in Socket adapter - - Use 'tls://' instead of 'ssl://' in connection string to prevent fallback to - known insecure versions, use only TLS when enabling crypto via proxy (see bug #20462) - - On PHP 5.6+ require using only TLS 1.1 and TLS 1.2 - - Do not use insecure ciphers - * Improved test suite, network-backed tests now run on Travis CI - -Changes and fixes: - * Curl adapter failed to send PUT request body with 'follow_redirects' on (bug #20440) - * Curl adapter supplied invalid cookie domain to CookieJar after redirect (bug #20561) - * Curl adapter now properly dispatches events while sending the request - * mime_content_type() returning false was handled incorrectly when guessing content-type - * Use 'peer_name' and 'verify_peer_name' SSL context options on PHP 5.6+ - instead of deprecated 'CN_match' - * Public Suffix List updated to current version, its download location changed - -Note to Composer users: next package version will probably get rid of 'include-path' -setting in composer.json favour of using autoloader. +* Tested on PHP 8.2 and 8.3 +* Use psalm for static analysis, several minor issues fixed +* Correctly parse HTTP status line with an empty reason-phrase + (see https://github.com/pear/HTTP_Request2/pull/26) +* Updated Public Suffix List </notes> <contents> <dir name="/"> - <file md5sum="ff31b30d8df996defb7b608d6d2db1e1" name="HTTP/Request2/Adapter/Curl.php" role="php"> + <file md5sum="81b94fe3f5aad81231fe5c5440b7cbbb" name="HTTP/Request2/Adapter/Curl.php" role="php"> + <tasks:replace from="@package_version@" to="version" type="package-info" /> + </file> + <file md5sum="2c606ad03c86bf425d56efebedb97331" name="HTTP/Request2/Adapter/Mock.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="202012330e01073212804fd9e2a1cc31" name="HTTP/Request2/Adapter/Mock.php" role="php"> + <file md5sum="1bc53a7d450ae228d103a6a2ee5a40c8" name="HTTP/Request2/Adapter/Socket.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="e2b21b1eea2f0295e43d9477e881bb9f" name="HTTP/Request2/Adapter/Socket.php" role="php"> + <file md5sum="3df137bc6a2d9667f56cb92c6bea726a" name="HTTP/Request2/Observer/Log.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="10237a9d6822757bd717d53acf211b8a" name="HTTP/Request2/Observer/Log.php" role="php"> + <file md5sum="e3268a3edaac30a2656038625a233229" name="HTTP/Request2/Observer/UncompressingDownload.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="8d272f33494040c346fbd89fd7edaf8a" name="HTTP/Request2/Observer/UncompressingDownload.php" role="php"> + <file md5sum="b2b2c26afad5f85eff31bde32922a60a" name="HTTP/Request2/Adapter.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="3325b0f4933fd013e9a6ce4953bcb75b" name="HTTP/Request2/Adapter.php" role="php"> + <file md5sum="d358858512d2f79bac5803b42471e978" name="HTTP/Request2/ConnectionException.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="e06b17a767c0778ca1be0942f5ae7d1d" name="HTTP/Request2/CookieJar.php" role="php"> + <file md5sum="6761ec824b7eb6a4608a95979e63902d" name="HTTP/Request2/CookieJar.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> <tasks:replace from="@data_dir@" to="data_dir" type="pear-config" /> </file> - <file md5sum="d4f7e1d9a30bf0fa02a2d6ae3c553223" name="HTTP/Request2/Exception.php" role="php"> + <file md5sum="82dfe4edf7760cb4d8912f050644251a" name="HTTP/Request2/Exception.php" role="php"> + <tasks:replace from="@package_version@" to="version" type="package-info" /> + </file> + <file md5sum="24385fe0eefe7869a5921ce7ac8030c5" name="HTTP/Request2/LogicException.php" role="php"> + <tasks:replace from="@package_version@" to="version" type="package-info" /> + </file> + <file md5sum="bed90ef51aecf640f4a0e70b5b6be2ab" name="HTTP/Request2/MessageException.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="fffe7e58f3e45dd54b0d32a8e66ff21b" name="HTTP/Request2/MultipartBody.php" role="php"> + <file md5sum="5c1cae794cd7bda24730c6d253e5c6eb" name="HTTP/Request2/MultipartBody.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="f332e47d535d68d799016b77bbcebc31" name="HTTP/Request2/SocketWrapper.php" role="php"> + <file md5sum="606b8ac8903b169894dbc919922fe394" name="HTTP/Request2/NotImplementedException.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="85ab1e0fb01171adb854185ba0bb3757" name="HTTP/Request2/SOCKS5.php" role="php"> + <file md5sum="29ed9a6a30e8a7baeb61798c2b3dc9dd" name="HTTP/Request2/SocketWrapper.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="f07cc69f5af8201bfc9250cd4d8466b5" name="HTTP/Request2/Response.php" role="php"> + <file md5sum="ab45f702ad91928d5f2ed8b71fc17fc1" name="HTTP/Request2/SOCKS5.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="95d0943f0e31e570c138f56e37b5b1b9" name="HTTP/Request2.php" role="php"> + <file md5sum="8ea0569b63a7c01bbe9489aa100428e4" name="HTTP/Request2/Response.php" role="php"> + <tasks:replace from="@package_version@" to="version" type="package-info" /> + </file> + <file md5sum="878c0ecc74ef8f400832a58175ff52dc" name="HTTP/Request2.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file md5sum="22d7f11b85dd00bd8919a4226a5a0388" name="tests/_files/bug_15305" role="test" /> @@ -109,48 +99,49 @@ <file md5sum="c36530c79c044fde1745b244c38d381f" name="tests/_files/response_gzip" role="test" /> <file md5sum="722328bfe89a9c9f7de5a020ed2c4589" name="tests/_files/response_gzip_broken" role="test" /> <file md5sum="1fb55dfe18831f8fe6280280e72ad216" name="tests/_files/response_headers" role="test" /> - <file md5sum="ad304b4f6438fa6fb9d89a8145032dd0" name="tests/_network/basicauth.php" role="test" /> - <file md5sum="68fa92c224d8946a1b231456fbb224a3" name="tests/_network/bug19934.php" role="test" /> - <file md5sum="aa222585358077911072f3dd0c42df9e" name="tests/_network/bug20228.php" role="test" /> - <file md5sum="865a3d4456fc408254e0fa6736216f19" name="tests/_network/cookies.php" role="test" /> - <file md5sum="e0009b1b032491bc8257cdf6178f25de" name="tests/_network/digestauth.php" role="test" /> - <file md5sum="30490b1f1be793b920d7fd9c0b175b45" name="tests/_network/download.php" role="test" /> - <file md5sum="a82c3f9cf27a44b198e5f93a90bc96b3" name="tests/_network/getparameters.php" role="test" /> - <file md5sum="70be2bfd73621dcd5e90cb33fafcf104" name="tests/_network/incompletebody.php" role="test" /> - <file md5sum="de962e4a76f01ff24a47d0480f10ce48" name="tests/_network/postparameters.php" role="test" /> - <file md5sum="89ae150b707a7972a131036439950d03" name="tests/_network/rawpostdata.php" role="test" /> - <file md5sum="eb62599fc9b811da4393c8e87ae2140b" name="tests/_network/redirects.php" role="test" /> - <file md5sum="51d61e300459c69c6071495f0748c624" name="tests/_network/setcookie.php" role="test" /> - <file md5sum="a35c31d0b53a9fc00c5ada155489a966" name="tests/_network/timeout.php" role="test" /> - <file md5sum="32a9e4b93ebbfef839e032332d75d39f" name="tests/_network/uploads.php" role="test" /> - <file md5sum="b29f96cb193b877fa07679db536cd20f" name="tests/Request2/Adapter/AllTests.php" role="test" /> - <file md5sum="55cf05d4285a5c9cb52a0116c476f5ef" name="tests/Request2/Adapter/CommonNetworkTest.php" role="test" /> - <file md5sum="a3ba6aa11bc67f2a3f302d6ada41f296" name="tests/Request2/Adapter/CurlTest.php" role="test" /> - <file md5sum="981e65e64ec10ded190cdeb7f4855307" name="tests/Request2/Adapter/MockTest.php" role="test" /> - <file md5sum="2d71de555a33b7b250bc1278b23f6806" name="tests/Request2/Adapter/SkippedTests.php" role="test" /> - <file md5sum="91374b3099989349963f0e17c7842ac7" name="tests/Request2/Adapter/SocketProxyTest.php" role="test" /> - <file md5sum="516895325ec84457932f0f82ec69678b" name="tests/Request2/Adapter/SocketTest.php" role="test" /> - <file md5sum="dda9904272b1bba42bd8a972b221a0eb" name="tests/Request2/AllTests.php" role="test" /> - <file md5sum="232d4db37a3cdc3779e40ae6113047cb" name="tests/Request2/CookieJarTest.php" role="test" /> - <file md5sum="481cc1a17ed65eba0b10a8916228ab03" name="tests/Request2/MultipartBodyTest.php" role="test" /> - <file md5sum="b47370213741960d7046354c13fc601c" name="tests/Request2/ResponseTest.php" role="test" /> - <file md5sum="eef194a01abd27faba5dcda848520450" name="tests/AllTests.php" role="test" /> - <file md5sum="b2e41760e4dda3db9534880286ecad2f" name="tests/NetworkConfig.php.dist" role="test" /> - <file md5sum="55622a56b671b8c5aaad4b6e6be96956" name="tests/ObserverTest.php" role="test" /> - <file md5sum="78e1ad02e00b16c688e00539091802ab" name="tests/Request2Test.php" role="test" /> - <file md5sum="2d8b1c14b500e6002d54285a875cc988" name="tests/TestHelper.php" role="test"> + <file md5sum="1300ecb05dcfbfd0f660d85f7b822f75" name="tests/_network/basicauth.php" role="test" /> + <file md5sum="57a14362482d07c4cb65efd88af82aad" name="tests/_network/bug19934.php" role="test" /> + <file md5sum="046ec21ddb24d17de11191142f17634e" name="tests/_network/bug20228.php" role="test" /> + <file md5sum="d936464dcbfe85db34a5e9e0caf3f09b" name="tests/_network/cookies.php" role="test" /> + <file md5sum="28072362d7978dbf45326dfb365d7c50" name="tests/_network/digestauth.php" role="test" /> + <file md5sum="743e78c9b9228d1587cfc560b524c005" name="tests/_network/download.php" role="test" /> + <file md5sum="025f47711d0cbfa81c22281514b03098" name="tests/_network/getparameters.php" role="test" /> + <file md5sum="559b6c355e6808b4a05d4cbcc8de9c8b" name="tests/_network/incompletebody.php" role="test" /> + <file md5sum="76fc75c6690831078c04c683004ac529" name="tests/_network/postparameters.php" role="test" /> + <file md5sum="c7b06c6a61e1117d5593f2328b7df69d" name="tests/_network/rawpostdata.php" role="test" /> + <file md5sum="9bcac94a128f4ca48d03673150dc0355" name="tests/_network/redirects.php" role="test" /> + <file md5sum="fdbad4b54f39dd99a7db23131ea5a608" name="tests/_network/setcookie.php" role="test" /> + <file md5sum="c0b58a16f0d6f33d01a779d3ef098cd3" name="tests/_network/timeout.php" role="test" /> + <file md5sum="a6e122470853fff67d412f3267479bcf" name="tests/_network/uploads.php" role="test" /> + <file md5sum="fe63a10112291a44572e3fa4bc2bcc07" name="tests/Request2/Adapter/CommonNetworkTest.php" role="test" /> + <file md5sum="df55d1a4335fb6f5041db986fc7e0f7a" name="tests/Request2/Adapter/CurlTest.php" role="test" /> + <file md5sum="10763c9aee1d48dd43d1433bca830456" name="tests/Request2/Adapter/EventSequenceObserver.php" role="test" /> + <file md5sum="7e75eee398c4a90d98e1bef6efa5b139" name="tests/Request2/Adapter/HeaderObserver.php" role="test" /> + <file md5sum="13375bb49ce5fc15bb9868e8c0dbb7e8" name="tests/Request2/Adapter/MockTest.php" role="test" /> + <file md5sum="93cac67453e3b636d898601ec7001d55" name="tests/Request2/Adapter/SlowpokeBody.php" role="test" /> + <file md5sum="89df375c49efdd2d043eebb841b911d0" name="tests/Request2/Adapter/SocketProxyTest.php" role="test" /> + <file md5sum="d9a077b6938c1d7915de8933ae123f46" name="tests/Request2/Adapter/SocketTest.php" role="test" /> + <file md5sum="ab9b010f059b8936535349d1e851f27b" name="tests/Request2/Adapter/UploadSizeObserver.php" role="test" /> + <file md5sum="b28285f3d28e7e83661432a09f3bc9bb" name="tests/Request2/CookieJarTest.php" role="test" /> + <file md5sum="299dc04dbb9d19ca4ff7804e771d8ed8" name="tests/Request2/MultipartBodyTest.php" role="test" /> + <file md5sum="955c6bad2aadb8abb3068ca93b4709c3" name="tests/Request2/ResponseTest.php" role="test" /> + <file md5sum="6e297ef4f197bf35bab38a8907ae38e4" name="tests/MockObserver.php" role="test" /> + <file md5sum="5c8d0c9a0dbaaa41a07606b5ca1e9126" name="tests/NetworkConfig.php.dist" role="test" /> + <file md5sum="1c9e41a433df231a6cffd3955fc472b7" name="tests/ObserverTest.php" role="test" /> + <file md5sum="05bf285854eb50d0c8e1f74a1f65ccd5" name="tests/Request2Test.php" role="test" /> + <file md5sum="236caed62ad058509e62c68476bd1789" name="tests/TestHelper.php" role="test"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> - <file md5sum="02589df0c03918eb53366867e4649031" name="docs/LICENSE" role="doc" /> - <file md5sum="4bf3cf43f9053b41181b9008c8f20c5a" name="docs/examples/upload-rapidshare.php" role="doc" /> - <file md5sum="7a4c1c26722b93b637655610d0fc93f5" name="data/generate-list.php" role="data" /> - <file md5sum="cbb73ce35ae899857acb93bc64855744" name="data/public-suffix-list.php" role="data" /> + <file md5sum="9de7b683e45c54d5d091d017e077ea70" name="docs/LICENSE" role="doc" /> + <file md5sum="571d899be53b4b7c5e3159db11deb007" name="docs/examples/upload-rapidshare.php" role="doc" /> + <file md5sum="b5847f7e0ce516304981ab4dd0fbf59c" name="data/generate-list.php" role="data" /> + <file md5sum="a6b85531cd25bb0a62b960bca1a17543" name="data/public-suffix-list.php" role="data" /> </dir> </contents> <dependencies> <required> <php> - <min>5.2.0</min> + <min>5.6.0</min> </php> <pearinstaller> <min>1.9.2</min> @@ -187,7 +178,7 @@ <install as="examples/upload-rapidshare.php" name="docs/examples/upload-rapidshare.php" /> <install as="generate-list.php" name="data/generate-list.php" /> <install as="public-suffix-list.php" name="data/public-suffix-list.php" /> - <install as="AllTests.php" name="tests/AllTests.php" /> + <install as="MockObserver.php" name="tests/MockObserver.php" /> <install as="NetworkConfig.php.dist" name="tests/NetworkConfig.php.dist" /> <install as="ObserverTest.php" name="tests/ObserverTest.php" /> <install as="Request2Test.php" name="tests/Request2Test.php" /> @@ -215,21 +206,167 @@ <install as="_network/setcookie.php" name="tests/_network/setcookie.php" /> <install as="_network/timeout.php" name="tests/_network/timeout.php" /> <install as="_network/uploads.php" name="tests/_network/uploads.php" /> - <install as="Request2/AllTests.php" name="tests/Request2/AllTests.php" /> <install as="Request2/CookieJarTest.php" name="tests/Request2/CookieJarTest.php" /> <install as="Request2/MultipartBodyTest.php" name="tests/Request2/MultipartBodyTest.php" /> <install as="Request2/ResponseTest.php" name="tests/Request2/ResponseTest.php" /> - <install as="Request2/Adapter/AllTests.php" name="tests/Request2/Adapter/AllTests.php" /> <install as="Request2/Adapter/CommonNetworkTest.php" name="tests/Request2/Adapter/CommonNetworkTest.php" /> <install as="Request2/Adapter/CurlTest.php" name="tests/Request2/Adapter/CurlTest.php" /> + <install as="Request2/Adapter/EventSequenceObserver.php" name="tests/Request2/Adapter/EventSequenceObserver.php" /> + <install as="Request2/Adapter/HeaderObserver.php" name="tests/Request2/Adapter/HeaderObserver.php" /> <install as="Request2/Adapter/MockTest.php" name="tests/Request2/Adapter/MockTest.php" /> - <install as="Request2/Adapter/SkippedTests.php" name="tests/Request2/Adapter/SkippedTests.php" /> + <install as="Request2/Adapter/SlowpokeBody.php" name="tests/Request2/Adapter/SlowpokeBody.php" /> <install as="Request2/Adapter/SocketProxyTest.php" name="tests/Request2/Adapter/SocketProxyTest.php" /> <install as="Request2/Adapter/SocketTest.php" name="tests/Request2/Adapter/SocketTest.php" /> + <install as="Request2/Adapter/UploadSizeObserver.php" name="tests/Request2/Adapter/UploadSizeObserver.php" /> </filelist> </phprelease> <changelog> <release> + <date>2022-01-06</date> + <version> + <release>2.5.1</release> + <api>2.4.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</license> + <notes> +* The package runs under PHP 8.1 without `E_DEPRECATED` messages + https://github.com/pear/HTTP_Request2/issues/25 +* Updated Public Suffix List + </notes> + </release> + <release> + <date>2021-07-12</date> + <version> + <release>2.5.0</release> + <api>2.4.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</license> + <notes> +Fixed + * Socket adapter will now retry writing to socket rather than throw an exception if `fwrite()` call + returns zero written bytes + https://github.com/pear/HTTP_Request2/issues/23 + +Changed + * Socket adapter will use only TLS 1.2 and TLS 1.3 + (the latter is available on PHP 7.4+) + * Upgraded tests for PHPUnit 9 compatibility, PHPUnit Polyfills package + is used to run them on PHP 5.6 to PHP 8 + * Test suite now runs on Github Actions rather than on Travis + * Updated Public Suffix List + </notes> + </release> + <release> + <date>2020-09-24</date> + <version> + <release>2.4.2</release> + <api>2.4.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</license> + <notes> +Socket adapter could prematurely end receiving the response body due to +fread() call returning an empty string + </notes> + </release> + <release> + <date>2020-08-01</date> + <version> + <release>2.4.1</release> + <api>2.4.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</license> + <notes> +Switch socket to blocking mode when enabling crypto, this fixes HTTPS requests +through proxy with Socket adapter +https://github.com/pear/HTTP_Request2/issues/20 + </notes> + </release> + <release> + <date>2020-07-26</date> + <version> + <release>2.4.0</release> + <api>2.4.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</license> + <notes> +* Minimum required version is now PHP 5.6, as using older versions for HTTPS + requests may be insecure +* Removed support for magic_quotes_runtime, as get_magic_quotes_runtime() + was deprecated in PHP 7.4 and the functionality itself was disabled + since PHP 5.4 (bug #23839) +* Socket adapter now uses socket in non-blocking mode, as some configurations + could have problems with timeouts in HTTPS requests (bug #21229) +* Fixed bogus size check error with gzipped responses larger than 4 GiB + uncompressed (bug #21239) +* Use current "Intermediate compatibility" cipher list +* Updated Public Suffix List + +The package is now 100% autoload-compatible, when installed with composer it +no longer uses include-path and does not contain require_once statements + </notes> + </release> + <release> + <date>2016-02-13</date> + <version> + <release>2.3.0</release> + <api>2.3.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</license> + <notes> +New features: + * New observer that can do on-the-fly decoding of compressed responses, + see HTTP_Request2_Observer_UncompressingDownload. + Thanks to Delian Krustev for initial implementation. + * CookieJar can now silently ignore invalid cookies with $jar->ignoreInvalidCookies(true); + instead of throwing an exception. See requests #19937 and #20401 + * Adapters now dispatch a new 'warning' event, e.g. in case of incomplete response + body or broken 'chunked' encoding. Exception was thrown previously by Socket adapter + in the latter case, see bug #20228 + * Improved security of HTTPS requests in Socket adapter + - Use 'tls://' instead of 'ssl://' in connection string to prevent fallback to + known insecure versions, use only TLS when enabling crypto via proxy (see bug #20462) + - On PHP 5.6+ require using only TLS 1.1 and TLS 1.2 + - Do not use insecure ciphers + * Improved test suite, network-backed tests now run on Travis CI + +Changes and fixes: + * Curl adapter failed to send PUT request body with 'follow_redirects' on (bug #20440) + * Curl adapter supplied invalid cookie domain to CookieJar after redirect (bug #20561) + * Curl adapter now properly dispatches events while sending the request + * mime_content_type() returning false was handled incorrectly when guessing content-type + * Use 'peer_name' and 'verify_peer_name' SSL context options on PHP 5.6+ + instead of deprecated 'CN_match' + * Public Suffix List updated to current version, its download location changed + +Note to Composer users: next package version will probably get rid of 'include-path' +setting in composer.json favour of using autoloader. + </notes> + </release> + <release> <date>2014-01-16</date> <version> <release>2.2.1</release>
View file
debian.changelog
Changed
@@ -1,3 +1,9 @@ +php-http-request2 (2.6.0-1~kolab1) unstable; urgency=medium + + * Update to 2.6.0 + + -- Christoph Erhardt <kolab@sicherha.de> Tue, 09 Jul 2024 23:11:01 +0200 + php-http-request2 (2.3.0-1~kolab1) unstable; urgency=medium * Package for Kolab
View file
debian.control
Changed
@@ -4,7 +4,7 @@ Maintainer: Debian PHP PEAR Maintainers <pkg-php-pear@lists.alioth.debian.org> Uploaders: Sascha Girrulat <sascha@girrulat.de> Build-Depends: debhelper (>= 8.0.0), - php-net-url2 (>= 2.1.1), + php-net-url2 (>= 2.2.0), phpunit, pkg-php-tools Standards-Version: 3.9.7
View file
php-http-request2.dsc
Changed
@@ -2,7 +2,7 @@ Source: php-http-request2 Binary: php-http-request2 Architecture: all -Version: 2.3.0-1~kolab1 +Version: 2.6.0-1~kolab1 Maintainer: Debian PHP PEAR Maintainers <pkg-php-pear@lists.alioth.debian.org> Uploaders: Sascha Girrulat <sascha@girrulat.de> Homepage: http://pear.php.net/package/HTTP_Request2/
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.