← All changes
|
vendor_prefixed/guzzlehttp/guzzle/src/RequestOptions.php
+250
-90
18.6
→
trunk
View file →
| @@ -4,11 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * This class contains a list of built-in Guzzle request options. |
| 7 | 7 | * |
| 8 | - * More documentation for each option can be found at http://guzzlephp.org/. | |
| 9 | - * | |
| 10 | - * @link http://docs.guzzlephp.org/en/v6/request-options.html | |
| 8 | + * @see https://github.com/guzzle/guzzle/blob/7.15/docs/request-options.md | |
| 11 | 9 | */ |
| 12 | 10 | final class RequestOptions |
| 13 | 11 | { |
| 14 | 12 | /** |
| @@ -21,70 +19,110 @@ | ||
| 21 | 19 | * |
| 22 | 20 | * - max: (int, default=5) maximum number of allowed redirects. |
| 23 | 21 | * - strict: (bool, default=false) Set to true to use strict redirects |
| 24 | 22 | * meaning redirect POST requests with POST requests vs. doing what most |
| 25 | - * browsers do which is redirect POST requests with GET requests | |
| 23 | + * browsers do which is redirect POST requests with GET requests. The | |
| 24 | + * QUERY method keeps its method and body across non-strict 301 and 302 | |
| 25 | + * redirects, and a 303 redirect is followed with a body-less GET. | |
| 26 | 26 | * - referer: (bool, default=false) Set to true to enable the Referer |
| 27 | 27 | * header. |
| 28 | - * - protocols: (array, default=['http', 'https']) Allowed redirect | |
| 29 | - * protocols. | |
| 28 | + * - protocols: (non-empty-array<array-key, string>, default=['http', 'https']) | |
| 29 | + * Allowed redirect protocols. Redirect matching is case-sensitive; use | |
| 30 | + * "http" and "https". | |
| 30 | 31 | * - on_redirect: (callable) PHP callable that is invoked when a redirect |
| 31 | 32 | * is encountered. The callable is invoked with the request, the redirect |
| 32 | 33 | * response that was received, and the effective URI. Any return value |
| 33 | 34 | * from the on_redirect function is ignored. |
| 35 | + * - track_redirects: (bool, default=false) Track redirected URI and status | |
| 36 | + * history in response headers. | |
| 34 | 37 | */ |
| 35 | - const ALLOW_REDIRECTS = 'allow_redirects'; | |
| 38 | + public const ALLOW_REDIRECTS = 'allow_redirects'; | |
| 36 | 39 | /** |
| 37 | - * auth: (array) Pass an array of HTTP authentication parameters to use | |
| 38 | - * with the request. The array must contain the username in index [0], | |
| 39 | - * the password in index [1], and you can optionally provide a built-in | |
| 40 | - * authentication type in index [2]. Pass null to disable authentication | |
| 41 | - * for a request. | |
| 40 | + * auth: (array{0: string, 1: string, 2?: string|null}|string|false|null) | |
| 41 | + * Pass an array of HTTP authentication parameters to use with the request. | |
| 42 | + * The array must contain the username in index [0], the password in index | |
| 43 | + * [1], and you can optionally provide a built-in authentication type in | |
| 44 | + * index [2]. Pass false or null to disable authentication for a request. | |
| 45 | + * String values are passed through for custom handlers. | |
| 42 | 46 | */ |
| 43 | - const AUTH = 'auth'; | |
| 47 | + public const AUTH = 'auth'; | |
| 44 | 48 | /** |
| 45 | - * body: (resource|string|null|int|float|StreamInterface|callable|\Iterator) | |
| 46 | - * Body to send in the request. | |
| 49 | + * body: (resource|string|null|int|float|bool|\Psr\Http\Message\StreamInterface|(callable&object)|\Iterator|\Stringable) | |
| 50 | + * Body to send in the request. Callable arrays are arrays, and arrays are | |
| 51 | + * not valid body values in Guzzle. | |
| 47 | 52 | */ |
| 48 | - const BODY = 'body'; | |
| 53 | + public const BODY = 'body'; | |
| 49 | 54 | /** |
| 50 | - * cert: (string|array) Set to a string to specify the path to a file | |
| 51 | - * containing a PEM formatted SSL client side certificate. If a password | |
| 52 | - * is required, then set cert to an array containing the path to the PEM | |
| 53 | - * file in the first array element followed by the certificate password | |
| 54 | - * in the second array element. | |
| 55 | + * cert: (string|array{0: string, 1?: string|null}) Set to a string to | |
| 56 | + * specify the path to a client certificate file. PEM is the default | |
| 57 | + * certificate format. If a password is required, set cert to an array | |
| 58 | + * containing the certificate path in the first array element followed by | |
| 59 | + * the certificate password in the second array element. A null password is | |
| 60 | + * treated the same as omitting it. Use cert_type to specify another | |
| 61 | + * supported certificate format. | |
| 55 | 62 | */ |
| 56 | - const CERT = 'cert'; | |
| 63 | + public const CERT = 'cert'; | |
| 57 | 64 | /** |
| 58 | - * cookies: (bool|GuzzleHttp\Cookie\CookieJarInterface, default=false) | |
| 65 | + * cert_type: (string) Specify the SSL client certificate file type. | |
| 66 | + */ | |
| 67 | + public const CERT_TYPE = 'cert_type'; | |
| 68 | + /** | |
| 69 | + * cookies: (false|GuzzleHttp\Cookie\CookieJarInterface, default=false) | |
| 59 | 70 | * Specifies whether or not cookies are used in a request or what cookie |
| 60 | 71 | * jar to use or what cookies to send. This option only works if your |
| 61 | 72 | * handler has the `cookie` middleware. Valid values are `false` and |
| 62 | - * an instance of {@see GuzzleHttp\Cookie\CookieJarInterface}. | |
| 73 | + * an instance of {@see Cookie\CookieJarInterface}. | |
| 63 | 74 | */ |
| 64 | - const COOKIES = 'cookies'; | |
| 75 | + public const COOKIES = 'cookies'; | |
| 65 | 76 | /** |
| 66 | - * connect_timeout: (float, default=0) Float describing the number of | |
| 67 | - * seconds to wait while trying to connect to a server. Use 0 to wait | |
| 68 | - * indefinitely (the default behavior). | |
| 77 | + * connect_timeout: (int|float, default=0) Number of seconds to wait while | |
| 78 | + * trying to connect to a server. Use 0 to wait 300 seconds (the default | |
| 79 | + * behavior). | |
| 69 | 80 | */ |
| 70 | - const CONNECT_TIMEOUT = 'connect_timeout'; | |
| 81 | + public const CONNECT_TIMEOUT = 'connect_timeout'; | |
| 71 | 82 | /** |
| 83 | + * crypto_method: (int) A value describing the minimum TLS protocol | |
| 84 | + * version to use. | |
| 85 | + * | |
| 86 | + * This setting must be set to one of the | |
| 87 | + * ``STREAM_CRYPTO_METHOD_TLS*_CLIENT`` constants. PHP 7.4 or higher is | |
| 88 | + * required in order to use TLS 1.3, and cURL 7.34.0 or higher is required | |
| 89 | + * in order to specify a crypto method, with cURL 7.52.0 or higher being | |
| 90 | + * required to use TLS 1.3. | |
| 91 | + */ | |
| 92 | + public const CRYPTO_METHOD = 'crypto_method'; | |
| 93 | + /** | |
| 94 | + * crypto_method_max: (int) A value describing the maximum TLS protocol | |
| 95 | + * version to use. | |
| 96 | + * | |
| 97 | + * This setting must be set to one of the | |
| 98 | + * ``STREAM_CRYPTO_METHOD_TLS*_CLIENT`` constants. On the stream handler, | |
| 99 | + * PHP 7.3 or higher is required to set a maximum TLS version, and PHP 7.4 | |
| 100 | + * or higher is required to use TLS 1.3. cURL 7.54.0 or higher is required | |
| 101 | + * in order to specify a maximum TLS version with the cURL handler. | |
| 102 | + */ | |
| 103 | + public const CRYPTO_METHOD_MAX = 'crypto_method_max'; | |
| 104 | + /** | |
| 105 | + * curl: (array) Raw cURL options to apply when using a built-in cURL handler. | |
| 106 | + */ | |
| 107 | + public const CURL = 'curl'; | |
| 108 | + /** | |
| 72 | 109 | * debug: (bool|resource) Set to true or set to a PHP stream returned by |
| 73 | 110 | * fopen() enable debug output with the HTTP handler used to send a |
| 74 | 111 | * request. |
| 75 | 112 | */ |
| 76 | - const DEBUG = 'debug'; | |
| 113 | + public const DEBUG = 'debug'; | |
| 77 | 114 | /** |
| 78 | - * decode_content: (bool, default=true) Specify whether or not | |
| 115 | + * decode_content: (bool|string, default=true) Specify whether or not | |
| 79 | 116 | * Content-Encoding responses (gzip, deflate, etc.) are automatically |
| 80 | 117 | * decoded. |
| 81 | 118 | */ |
| 82 | - const DECODE_CONTENT = 'decode_content'; | |
| 119 | + public const DECODE_CONTENT = 'decode_content'; | |
| 83 | 120 | /** |
| 84 | - * delay: (int) The amount of time to delay before sending in milliseconds. | |
| 121 | + * delay: (int|float) The amount of time to delay before sending in | |
| 122 | + * milliseconds. | |
| 85 | 123 | */ |
| 86 | - const DELAY = 'delay'; | |
| 124 | + public const DELAY = 'delay'; | |
| 87 | 125 | /** |
| 88 | 126 | * expect: (bool|integer) Controls the behavior of the |
| 89 | 127 | * "Expect: 100-Continue" header. |
| 90 | 128 | * |
| @@ -99,21 +137,22 @@ | ||
| 99 | 137 | * By default, Guzzle will add the "Expect: 100-Continue" header when the |
| 100 | 138 | * size of the body of a request is greater than 1 MB and a request is |
| 101 | 139 | * using HTTP/1.1. |
| 102 | 140 | */ |
| 103 | - const EXPECT = 'expect'; | |
| 141 | + public const EXPECT = 'expect'; | |
| 104 | 142 | /** |
| 105 | - * form_params: (array) Associative array of form field names to values | |
| 106 | - * where each value is a string or array of strings. Sets the Content-Type | |
| 107 | - * header to application/x-www-form-urlencoded when no Content-Type header | |
| 108 | - * is already present. | |
| 143 | + * form_params: (array<array-key, string|int|float|bool|null|array>) | |
| 144 | + * Associative array of form field names to scalar, null, or nested array | |
| 145 | + * values. Sets the Content-Type header to application/x-www-form-urlencoded | |
| 146 | + * when no Content-Type header is already present. | |
| 109 | 147 | */ |
| 110 | - const FORM_PARAMS = 'form_params'; | |
| 148 | + public const FORM_PARAMS = 'form_params'; | |
| 111 | 149 | /** |
| 112 | - * headers: (array) Associative array of HTTP headers. Each value MUST be | |
| 113 | - * a string or array of strings. | |
| 150 | + * headers: (array<array-key, string|non-empty-array<array-key, string>>|null) | |
| 151 | + * Associative array of HTTP headers. Each value MUST be a string or non-empty | |
| 152 | + * array of strings. | |
| 114 | 153 | */ |
| 115 | - const HEADERS = 'headers'; | |
| 154 | + public const HEADERS = 'headers'; | |
| 116 | 155 | /** |
| 117 | 156 | * http_errors: (bool, default=true) Set to false to disable exceptions |
| 118 | 157 | * when a non- successful HTTP response is received. By default, |
| 119 | 158 | * exceptions will be thrown for 4xx and 5xx responses. This option only |
| @@ -118,38 +157,124 @@ | ||
| 118 | 157 | * when a non- successful HTTP response is received. By default, |
| 119 | 158 | * exceptions will be thrown for 4xx and 5xx responses. This option only |
| 120 | 159 | * works if your handler has the `httpErrors` middleware. |
| 121 | 160 | */ |
| 122 | - const HTTP_ERRORS = 'http_errors'; | |
| 161 | + public const HTTP_ERRORS = 'http_errors'; | |
| 123 | 162 | /** |
| 124 | - * idn: (bool|int, default=true) A combination of IDNA_* constants for | |
| 125 | - * idn_to_ascii() PHP's function (see "options" parameter). Set to false to | |
| 126 | - * disable IDN support completely, or to true to use the default | |
| 127 | - * configuration (IDNA_DEFAULT constant). | |
| 163 | + * idn_conversion: (bool|int|null, default=false) A combination of IDNA_* | |
| 164 | + * constants for PHP's idn_to_ascii() function. Set to false or null to | |
| 165 | + * disable IDN support, or to true to use the default configuration | |
| 166 | + * (IDNA_DEFAULT constant). | |
| 128 | 167 | */ |
| 129 | - const IDN_CONVERSION = 'idn_conversion'; | |
| 168 | + public const IDN_CONVERSION = 'idn_conversion'; | |
| 130 | 169 | /** |
| 131 | 170 | * json: (mixed) Adds JSON data to a request. The provided value is JSON |
| 132 | 171 | * encoded and a Content-Type header of application/json will be added to |
| 133 | 172 | * the request if no Content-Type header is already present. |
| 134 | 173 | */ |
| 135 | - const JSON = 'json'; | |
| 174 | + public const JSON = 'json'; | |
| 136 | 175 | /** |
| 137 | - * multipart: (array) Array of associative arrays, each containing a | |
| 138 | - * required "name" key mapping to the form field, name, a required | |
| 139 | - * "contents" key mapping to a StreamInterface|resource|string, an | |
| 140 | - * optional "headers" associative array of custom headers, and an | |
| 141 | - * optional "filename" key mapping to a string to send as the filename in | |
| 142 | - * the part. If no "filename" key is present, then no "filename" attribute | |
| 143 | - * will be added to the part. | |
| 176 | + * multipart: (array) Array of part arrays, each containing a required | |
| 177 | + * "name" key mapping to the string or integer form field name, a required | |
| 178 | + * "contents" key mapping to any non-array value accepted by PSR-7 | |
| 179 | + * Utils::streamFor() or a nested array of field values, an optional | |
| 180 | + * "headers" array of string custom header values, and an optional | |
| 181 | + * "filename" key mapping to a string to send as the filename in the part. | |
| 182 | + * "headers" and "filename" cannot be used when "contents" is an array. | |
| 144 | 183 | */ |
| 145 | - const MULTIPART = 'multipart'; | |
| 184 | + public const MULTIPART = 'multipart'; | |
| 146 | 185 | /** |
| 186 | + * multiplex: (string) Controls how a request sent through a built-in | |
| 187 | + * cURL handler relates to shared, multiplexed connections: how an HTTP/2 | |
| 188 | + * request pursues one, or, with Multiplexing::NONE, whether the transfer | |
| 189 | + * may share its connection at all. When the option is not set, | |
| 190 | + * multiplexing is left to libcurl: nothing waits, and established | |
| 191 | + * multiplex-capable connections are still shared. Use | |
| 192 | + * Multiplexing::EAGER to explicitly never wait for pending connections, | |
| 193 | + * Multiplexing::WAIT to wait on libcurl-eligible pending connections with | |
| 194 | + * CURLOPT_PIPEWAIT, normally to the same origin, | |
| 195 | + * Multiplexing::REQUIRE_EAGER to fail unless a multiplexed protocol is | |
| 196 | + * guaranteed while dialing eagerly, or Multiplexing::REQUIRE_WAIT for the | |
| 197 | + * same guarantee while also waiting on pending connections. The required | |
| 198 | + * modes require a handler that permits actual multiplexing, not merely a | |
| 199 | + * multiplexed protocol, and are rejected on a Multiplexing::NONE handler. | |
| 200 | + * The stream handler ignores EAGER and WAIT, and rejects the required | |
| 201 | + * family; CurlHandler has no multi handle to multiplex over. Explicit | |
| 202 | + * modes reject deprecated raw cURL options they conflict with: the | |
| 203 | + * required family cannot be combined with a raw CURLOPT_HTTP_VERSION, | |
| 204 | + * CURLOPT_URL, or CURLOPT_FOLLOWLOCATION; no explicit mode can be | |
| 205 | + * combined with a raw CURLOPT_PIPEWAIT on the CurlMultiHandler; and | |
| 206 | + * Multiplexing::NONE on a CurlMultiHandler that permits multiplexing | |
| 207 | + * cannot be combined with the raw CURLOPT_HTTP_VERSION, CURLOPT_HTTPAUTH | |
| 208 | + * (including the "auth" request option's "digest" and "ntlm" modes, | |
| 209 | + * which set it), CURLOPT_PROXYAUTH, CURLOPT_FOLLOWLOCATION, | |
| 210 | + * CURLOPT_HTTPHEADER, CURLOPT_ALTSVC, CURLOPT_ALTSVC_CTRL, or | |
| 211 | + * CURLOPT_PROXYTYPE cURL options. The required family also | |
| 212 | + * rejects final CURLOPT_HTTPAUTH masks that permit NTLM, which libcurl | |
| 213 | + * retries over HTTP/1.1. The required family validates its cleartext | |
| 214 | + * proxy rule against the final cURL configuration, after raw options | |
| 215 | + * such as CURLOPT_PROXY and CURLOPT_PRE_PROXY are applied; only the | |
| 216 | + * exact raw CURLOPT_NOPROXY wildcard '*' disables the primary proxy and | |
| 217 | + * pre-proxy there, and raw host-specific patterns are conservatively | |
| 218 | + * treated as leaving them active. These rejections are | |
| 219 | + * configuration-conflict checks, not remote security checks. | |
| 220 | + * | |
| 221 | + * Multiplexing::NONE disables multiplexing for a whole handler when | |
| 222 | + * passed as the "multiplex" client configuration option, which | |
| 223 | + * configures the default handler and also becomes the default request | |
| 224 | + * option, or, when constructing a handler directly, as the | |
| 225 | + * CurlMultiHandler "multiplex" constructor option. A handler | |
| 226 | + * configured with Multiplexing::NONE rejects explicitly requested wait | |
| 227 | + * modes as a configuration conflict when the transfer would actually | |
| 228 | + * wait, and always rejects the required modes, because they require a | |
| 229 | + * handler that permits actual multiplexing, not merely a multiplexed | |
| 230 | + * protocol. As a request option value, Multiplexing::NONE guarantees the | |
| 231 | + * transfer does not share its connection with any concurrent transfer. | |
| 232 | + * Multiplexing::NONE does not force HTTP/1.1: on a Multiplexing::NONE | |
| 233 | + * handler, HTTP/2 still negotiates and each transfer keeps its | |
| 234 | + * connection to itself. | |
| 235 | + * | |
| 236 | + * The request option value is accepted exactly where the guarantee | |
| 237 | + * holds and can be verified: on a CurlMultiHandler configured with | |
| 238 | + * Multiplexing::NONE, for requests whose declared protocol version is | |
| 239 | + * HTTP/1.x, on CurlHandler, and on the stream handler, which never | |
| 240 | + * multiplexes. An HTTP/2 request with a Multiplexing::NONE request | |
| 241 | + * option is rejected on a CurlMultiHandler that permits multiplexing. | |
| 242 | + * On a CurlMultiHandler that permits multiplexing, Multiplexing::NONE | |
| 243 | + * is also rejected with a custom "handle_factory", alongside a raw | |
| 244 | + * CURLMOPT_PIPELINING cURL multi option, and combined with the raw | |
| 245 | + * CURLOPT_HTTP_VERSION, CURLOPT_HTTPAUTH (including the "auth" request | |
| 246 | + * option's "digest" and "ntlm" modes, which set it), CURLOPT_PROXYAUTH, | |
| 247 | + * CURLOPT_FOLLOWLOCATION, CURLOPT_HTTPHEADER, CURLOPT_ALTSVC, | |
| 248 | + * CURLOPT_ALTSVC_CTRL, or CURLOPT_PROXYTYPE cURL options. It is also | |
| 249 | + * rejected when the request carries an Expect: 100-continue header (its | |
| 250 | + * 417 retries select connections outside the safeguards; remove an | |
| 251 | + * explicitly supplied header, or set the "expect" request option to | |
| 252 | + * false to prevent it being added automatically). | |
| 253 | + * | |
| 254 | + * On a client whose multi handler permits multiplexing, the ordinary | |
| 255 | + * non-streaming default stack - both cURL handlers available and no | |
| 256 | + * connection caps forcing multi-only routing - runs synchronous | |
| 257 | + * requests on the CurlHandler path, which satisfies the guarantee for | |
| 258 | + * any protocol version, while asynchronous requests run on the | |
| 259 | + * CurlMultiHandler, so an HTTP/2 request with Multiplexing::NONE | |
| 260 | + * succeeds synchronously and is rejected asynchronously on the same | |
| 261 | + * client. Keep-alive reuse between consecutive transfers is | |
| 262 | + * unaffected, except on libcurl versions below 7.77.0 and from 8.11.0 | |
| 263 | + * through 8.12.1, where an accepted HTTP/1.x request on a multiplexing | |
| 264 | + * CurlMultiHandler forces a fresh connection. Custom handlers receive | |
| 265 | + * the "multiplex" option unchanged: its semantics are handler-defined, | |
| 266 | + * Guzzle does not guarantee it is honored, and a client-level | |
| 267 | + * Multiplexing::NONE with a custom handler flows to it as a default | |
| 268 | + * request option without client-side enforcement. | |
| 269 | + */ | |
| 270 | + public const MULTIPLEX = 'multiplex'; | |
| 271 | + /** | |
| 147 | 272 | * on_headers: (callable) A callable that is invoked when the HTTP headers |
| 148 | 273 | * of the response have been received but the body has not yet begun to |
| 149 | 274 | * download. |
| 150 | 275 | */ |
| 151 | - const ON_HEADERS = 'on_headers'; | |
| 276 | + public const ON_HEADERS = 'on_headers'; | |
| 152 | 277 | /** |
| 153 | 278 | * on_stats: (callable) allows you to get access to transfer statistics of |
| 154 | 279 | * a request and access the lower level transfer details of the handler |
| 155 | 280 | * associated with your client. ``on_stats`` is a callable that is invoked |
| @@ -157,10 +282,20 @@ | ||
| 157 | 282 | * with transfer statistics about the request, the response received, or |
| 158 | 283 | * the error encountered. Included in the data is the total amount of time |
| 159 | 284 | * taken to send the request. |
| 160 | 285 | */ |
| 161 | - const ON_STATS = 'on_stats'; | |
| 286 | + public const ON_STATS = 'on_stats'; | |
| 162 | 287 | /** |
| 288 | + * on_trailers: (callable) A callable that is invoked by the built-in cURL | |
| 289 | + * handlers once per successful transfer, after the response body has been | |
| 290 | + * received, with an associative array of the parsed HTTP trailers followed | |
| 291 | + * by the response. Trailer field names are lowercased and grouped | |
| 292 | + * case-insensitively; values keep their wire order. Malformed trailer | |
| 293 | + * field lines are discarded before parsing. Trailer fields are reported | |
| 294 | + * separately from response headers and are never merged into the response. | |
| 295 | + */ | |
| 296 | + public const ON_TRAILERS = 'on_trailers'; | |
| 297 | + /** | |
| 163 | 298 | * progress: (callable) Defines a function to invoke when transfer |
| 164 | 299 | * progress is made. The function accepts the following positional |
| 165 | 300 | * arguments: the total number of bytes expected to be downloaded, the |
| 166 | 301 | * number of bytes downloaded so far, the number of bytes expected to be |
| @@ -165,28 +300,36 @@ | ||
| 165 | 300 | * arguments: the total number of bytes expected to be downloaded, the |
| 166 | 301 | * number of bytes downloaded so far, the number of bytes expected to be |
| 167 | 302 | * uploaded, the number of bytes uploaded so far. |
| 168 | 303 | */ |
| 169 | - const PROGRESS = 'progress'; | |
| 304 | + public const PROGRESS = 'progress'; | |
| 170 | 305 | /** |
| 306 | + * protocols: (non-empty-array<array-key, string>, default=['http', 'https']) | |
| 307 | + * Allowed URI schemes. Built-in handlers accept only the case-sensitive | |
| 308 | + * values "http" and "https". | |
| 309 | + */ | |
| 310 | + public const PROTOCOLS = 'protocols'; | |
| 311 | + /** | |
| 171 | 312 | * proxy: (string|array) Pass a string to specify an HTTP proxy, or an |
| 172 | 313 | * array to specify different proxies for different protocols (where the |
| 173 | - * key is the protocol and the value is a proxy string). | |
| 314 | + * key is the protocol and the value is a proxy string or null). Provide a | |
| 315 | + * "no" key as a comma-delimited string, array of strings, or null to | |
| 316 | + * specify hosts or host-and-port pairs that should not be proxied. | |
| 174 | 317 | */ |
| 175 | - const PROXY = 'proxy'; | |
| 318 | + public const PROXY = 'proxy'; | |
| 176 | 319 | /** |
| 177 | - * query: (array|string) Associative array of query string values to add | |
| 178 | - * to the request. This option uses PHP's http_build_query() to create | |
| 179 | - * the string representation. Pass a string value if you need more | |
| 180 | - * control than what this method provides | |
| 320 | + * query: (array<array-key, mixed>|string) Associative array of query string | |
| 321 | + * values to add to the request. This option uses PHP's http_build_query() | |
| 322 | + * to create the string representation. Pass a string value if you need | |
| 323 | + * more control than what this method provides | |
| 181 | 324 | */ |
| 182 | - const QUERY = 'query'; | |
| 325 | + public const QUERY = 'query'; | |
| 183 | 326 | /** |
| 184 | - * sink: (resource|string|StreamInterface) Where the data of the | |
| 185 | - * response is written to. Defaults to a PHP temp stream. Providing a | |
| 186 | - * string will write data to a file by the given name. | |
| 327 | + * sink: (resource|string|\Psr\Http\Message\StreamInterface) Where the data | |
| 328 | + * of the response is written to. Defaults to a PHP temp stream. Providing | |
| 329 | + * a string will write data to a file by the given name. | |
| 187 | 330 | */ |
| 188 | - const SINK = 'sink'; | |
| 331 | + public const SINK = 'sink'; | |
| 189 | 332 | /** |
| 190 | 333 | * synchronous: (bool) Set to true to inform HTTP handlers that you intend |
| 191 | 334 | * on waiting on the response. This can be useful for optimizations. Note |
| 192 | 335 | * that a promise is still returned if you are using one of the async |
| @@ -191,22 +334,33 @@ | ||
| 191 | 334 | * on waiting on the response. This can be useful for optimizations. Note |
| 192 | 335 | * that a promise is still returned if you are using one of the async |
| 193 | 336 | * client methods. |
| 194 | 337 | */ |
| 195 | - const SYNCHRONOUS = 'synchronous'; | |
| 338 | + public const SYNCHRONOUS = 'synchronous'; | |
| 196 | 339 | /** |
| 197 | - * ssl_key: (array|string) Specify the path to a file containing a private | |
| 198 | - * SSL key in PEM format. If a password is required, then set to an array | |
| 199 | - * containing the path to the SSL key in the first array element followed | |
| 200 | - * by the password required for the certificate in the second element. | |
| 340 | + * ssl_key: (array{0: string, 1?: string|null}|string) Specify the path to | |
| 341 | + * a private SSL key file. PEM is the default private key format. If a | |
| 342 | + * password is required, set ssl_key to an array containing the key path in | |
| 343 | + * the first array element followed by the key password in the second | |
| 344 | + * element. A null password is treated the same as omitting it. Use | |
| 345 | + * ssl_key_type to specify another supported key format. | |
| 201 | 346 | */ |
| 202 | - const SSL_KEY = 'ssl_key'; | |
| 347 | + public const SSL_KEY = 'ssl_key'; | |
| 203 | 348 | /** |
| 204 | - * stream: Set to true to attempt to stream a response rather than | |
| 349 | + * ssl_key_type: (string) Specify the SSL private key file type. | |
| 350 | + */ | |
| 351 | + public const SSL_KEY_TYPE = 'ssl_key_type'; | |
| 352 | + /** | |
| 353 | + * stream: (bool) Set to true to attempt to stream a response rather than | |
| 205 | 354 | * download it all up-front. |
| 206 | 355 | */ |
| 207 | - const STREAM = 'stream'; | |
| 356 | + public const STREAM = 'stream'; | |
| 208 | 357 | /** |
| 358 | + * stream_context: (array) PHP stream context options to merge into the | |
| 359 | + * context used by the built-in stream handler. | |
| 360 | + */ | |
| 361 | + public const STREAM_CONTEXT = 'stream_context'; | |
| 362 | + /** | |
| 209 | 363 | * verify: (bool|string, default=true) Describes the SSL certificate |
| 210 | 364 | * verification behavior of a request. Set to true to enable SSL |
| 211 | 365 | * certificate verification using the system CA bundle when available |
| 212 | 366 | * (the default). Set to false to disable certificate verification (this |
| @@ -212,24 +366,30 @@ | ||
| 212 | 366 | * (the default). Set to false to disable certificate verification (this |
| 213 | 367 | * is insecure!). Set to a string to provide the path to a CA bundle on |
| 214 | 368 | * disk to enable verification using a custom certificate. |
| 215 | 369 | */ |
| 216 | - const VERIFY = 'verify'; | |
| 370 | + public const VERIFY = 'verify'; | |
| 217 | 371 | /** |
| 218 | - * timeout: (float, default=0) Float describing the timeout of the | |
| 372 | + * timeout: (int|float, default=0) Number describing the timeout of the | |
| 219 | 373 | * request in seconds. Use 0 to wait indefinitely (the default behavior). |
| 220 | 374 | */ |
| 221 | - const TIMEOUT = 'timeout'; | |
| 375 | + public const TIMEOUT = 'timeout'; | |
| 222 | 376 | /** |
| 223 | - * read_timeout: (float, default=default_socket_timeout ini setting) Float describing | |
| 224 | - * the body read timeout, for stream requests. | |
| 377 | + * read_timeout: (int|float, default=default_socket_timeout ini setting) | |
| 378 | + * Number describing the body read timeout, for stream requests. | |
| 225 | 379 | */ |
| 226 | - const READ_TIMEOUT = 'read_timeout'; | |
| 380 | + public const READ_TIMEOUT = 'read_timeout'; | |
| 227 | 381 | /** |
| 228 | - * version: (float) Specifies the HTTP protocol version to attempt to use. | |
| 382 | + * retries: (int) Current retry count used by the retry middleware. | |
| 229 | 383 | */ |
| 230 | - const VERSION = 'version'; | |
| 384 | + public const RETRIES = 'retries'; | |
| 231 | 385 | /** |
| 232 | - * force_ip_resolve: (bool) Force client to use only ipv4 or ipv6 protocol | |
| 386 | + * version: (string|int|float) Specifies the HTTP protocol version to attempt | |
| 387 | + * to use. | |
| 233 | 388 | */ |
| 234 | - const FORCE_IP_RESOLVE = 'force_ip_resolve'; | |
| 389 | + public const VERSION = 'version'; | |
| 390 | + /** | |
| 391 | + * force_ip_resolve: (string) Set to "v4" to force IPv4 resolution or "v6" | |
| 392 | + * for IPv6 resolution when supported by the handler. | |
| 393 | + */ | |
| 394 | + public const FORCE_IP_RESOLVE = 'force_ip_resolve'; | |
| 235 | 395 | } |