PluginProbe
Plausible Analytics / trunk
Plausible Analytics vtrunk
2.6.1 2.6.0 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 All 52 releases
plausible-analytics / src / Client / lib / Lib / GuzzleHttp / RequestOptions.php

RequestOptions.php in Plausible Analytics trunk, at src/Client/lib/Lib/GuzzleHttp/RequestOptions.php

277 lines 10.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Plausible\Analytics\WP\Client\Lib\GuzzleHttp;
4
5 /**
6 * This class contains a list of built-in Guzzle request options.
7 *
8 * More documentation for each option can be found at http://guzzlephp.org/.
9 *
10 * @see http://docs.guzzlephp.org/en/v6/request-options.html
11 */
12 final class RequestOptions
13 {
14 /**
15 * allow_redirects: (bool|array) Controls redirect behavior. Pass false
16 * to disable redirects, pass true to enable redirects, pass an
17 * associative to provide custom redirect settings. Defaults to "false".
18 * This option only works if your handler has the RedirectMiddleware. When
19 * passing an associative array, you can provide the following key value
20 * pairs:
21 *
22 * - max: (int, default=5) maximum number of allowed redirects.
23 * - strict: (bool, default=false) Set to true to use strict redirects
24 * meaning redirect POST requests with POST requests vs. doing what most
25 * browsers do which is redirect POST requests with GET requests
26 * - referer: (bool, default=false) Set to true to enable the Referer
27 * header.
28 * - protocols: (array, default=['http', 'https']) Allowed redirect
29 * protocols.
30 * - on_redirect: (callable) PHP callable that is invoked when a redirect
31 * is encountered. The callable is invoked with the request, the redirect
32 * response that was received, and the effective URI. Any return value
33 * from the on_redirect function is ignored.
34 */
35 public const ALLOW_REDIRECTS = 'allow_redirects';
36
37 /**
38 * auth: (array) Pass an array of HTTP authentication parameters to use
39 * with the request. The array must contain the username in index [0],
40 * the password in index [1], and you can optionally provide a built-in
41 * authentication type in index [2]. Pass null to disable authentication
42 * for a request.
43 */
44 public const AUTH = 'auth';
45
46 /**
47 * body: (resource|string|null|int|float|StreamInterface|callable|\Iterator)
48 * Body to send in the request.
49 */
50 public const BODY = 'body';
51
52 /**
53 * cert: (string|array) Set to a string to specify the path to a file
54 * containing a PEM formatted SSL client side certificate. If a password
55 * is required, then set cert to an array containing the path to the PEM
56 * file in the first array element followed by the certificate password
57 * in the second array element.
58 */
59 public const CERT = 'cert';
60
61 /**
62 * cookies: (bool|Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Cookie\CookieJarInterface, default=false)
63 * Specifies whether or not cookies are used in a request or what cookie
64 * jar to use or what cookies to send. This option only works if your
65 * handler has the `cookie` middleware. Valid values are `false` and
66 * an instance of {@see \Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Cookie\CookieJarInterface}.
67 */
68 public const COOKIES = 'cookies';
69
70 /**
71 * connect_timeout: (float, default=0) Float describing the number of
72 * seconds to wait while trying to connect to a server. Use 0 to wait
73 * 300 seconds (the default behavior).
74 */
75 public const CONNECT_TIMEOUT = 'connect_timeout';
76
77 /**
78 * crypto_method: (int) A value describing the minimum TLS protocol
79 * version to use.
80 *
81 * This setting must be set to one of the
82 * ``STREAM_CRYPTO_METHOD_TLS*_CLIENT`` constants. PHP 7.4 or higher is
83 * required in order to use TLS 1.3, and cURL 7.34.0 or higher is required
84 * in order to specify a crypto method, with cURL 7.52.0 or higher being
85 * required to use TLS 1.3.
86 */
87 public const CRYPTO_METHOD = 'crypto_method';
88
89 /**
90 * debug: (bool|resource) Set to true or set to a PHP stream returned by
91 * fopen() enable debug output with the HTTP handler used to send a
92 * request.
93 */
94 public const DEBUG = 'debug';
95
96 /**
97 * decode_content: (bool, default=true) Specify whether or not
98 * Content-Encoding responses (gzip, deflate, etc.) are automatically
99 * decoded.
100 */
101 public const DECODE_CONTENT = 'decode_content';
102
103 /**
104 * delay: (int) The amount of time to delay before sending in milliseconds.
105 */
106 public const DELAY = 'delay';
107
108 /**
109 * expect: (bool|integer) Controls the behavior of the
110 * "Expect: 100-Continue" header.
111 *
112 * Set to `true` to enable the "Expect: 100-Continue" header for all
113 * requests that sends a body. Set to `false` to disable the
114 * "Expect: 100-Continue" header for all requests. Set to a number so that
115 * the size of the payload must be greater than the number in order to send
116 * the Expect header. Setting to a number will send the Expect header for
117 * all requests in which the size of the payload cannot be determined or
118 * where the body is not rewindable.
119 *
120 * By default, Guzzle will add the "Expect: 100-Continue" header when the
121 * size of the body of a request is greater than 1 MB and a request is
122 * using HTTP/1.1.
123 */
124 public const EXPECT = 'expect';
125
126 /**
127 * form_params: (array) Associative array of form field names to values
128 * where each value is a string or array of strings. Sets the Content-Type
129 * header to application/x-www-form-urlencoded when no Content-Type header
130 * is already present.
131 */
132 public const FORM_PARAMS = 'form_params';
133
134 /**
135 * headers: (array) Associative array of HTTP headers. Each value MUST be
136 * a string or array of strings.
137 */
138 public const HEADERS = 'headers';
139
140 /**
141 * http_errors: (bool, default=true) Set to false to disable exceptions
142 * when a non- successful HTTP response is received. By default,
143 * exceptions will be thrown for 4xx and 5xx responses. This option only
144 * works if your handler has the `httpErrors` middleware.
145 */
146 public const HTTP_ERRORS = 'http_errors';
147
148 /**
149 * idn: (bool|int, default=true) A combination of IDNA_* constants for
150 * idn_to_ascii() PHP's function (see "options" parameter). Set to false to
151 * disable IDN support completely, or to true to use the default
152 * configuration (IDNA_DEFAULT constant).
153 */
154 public const IDN_CONVERSION = 'idn_conversion';
155
156 /**
157 * json: (mixed) Adds JSON data to a request. The provided value is JSON
158 * encoded and a Content-Type header of application/json will be added to
159 * the request if no Content-Type header is already present.
160 */
161 public const JSON = 'json';
162
163 /**
164 * multipart: (array) Array of associative arrays, each containing a
165 * required "name" key mapping to the form field, name, a required
166 * "contents" key mapping to a StreamInterface|resource|string, an
167 * optional "headers" associative array of custom headers, and an
168 * optional "filename" key mapping to a string to send as the filename in
169 * the part. If no "filename" key is present, then no "filename" attribute
170 * will be added to the part.
171 */
172 public const MULTIPART = 'multipart';
173
174 /**
175 * on_headers: (callable) A callable that is invoked when the HTTP headers
176 * of the response have been received but the body has not yet begun to
177 * download.
178 */
179 public const ON_HEADERS = 'on_headers';
180
181 /**
182 * on_stats: (callable) allows you to get access to transfer statistics of
183 * a request and access the lower level transfer details of the handler
184 * associated with your client. ``on_stats`` is a callable that is invoked
185 * when a handler has finished sending a request. The callback is invoked
186 * with transfer statistics about the request, the response received, or
187 * the error encountered. Included in the data is the total amount of time
188 * taken to send the request.
189 */
190 public const ON_STATS = 'on_stats';
191
192 /**
193 * progress: (callable) Defines a function to invoke when transfer
194 * progress is made. The function accepts the following positional
195 * arguments: the total number of bytes expected to be downloaded, the
196 * number of bytes downloaded so far, the number of bytes expected to be
197 * uploaded, the number of bytes uploaded so far.
198 */
199 public const PROGRESS = 'progress';
200
201 /**
202 * proxy: (string|array) Pass a string to specify an HTTP proxy, or an
203 * array to specify different proxies for different protocols (where the
204 * key is the protocol and the value is a proxy string).
205 */
206 public const PROXY = 'proxy';
207
208 /**
209 * query: (array|string) Associative array of query string values to add
210 * to the request. This option uses PHP's http_build_query() to create
211 * the string representation. Pass a string value if you need more
212 * control than what this method provides
213 */
214 public const QUERY = 'query';
215
216 /**
217 * sink: (resource|string|StreamInterface) Where the data of the
218 * response is written to. Defaults to a PHP temp stream. Providing a
219 * string will write data to a file by the given name.
220 */
221 public const SINK = 'sink';
222
223 /**
224 * synchronous: (bool) Set to true to inform HTTP handlers that you intend
225 * on waiting on the response. This can be useful for optimizations. Note
226 * that a promise is still returned if you are using one of the async
227 * client methods.
228 */
229 public const SYNCHRONOUS = 'synchronous';
230
231 /**
232 * ssl_key: (array|string) Specify the path to a file containing a private
233 * SSL key in PEM format. If a password is required, then set to an array
234 * containing the path to the SSL key in the first array element followed
235 * by the password required for the certificate in the second element.
236 */
237 public const SSL_KEY = 'ssl_key';
238
239 /**
240 * stream: Set to true to attempt to stream a response rather than
241 * download it all up-front.
242 */
243 public const STREAM = 'stream';
244
245 /**
246 * verify: (bool|string, default=true) Describes the SSL certificate
247 * verification behavior of a request. Set to true to enable SSL
248 * certificate verification using the system CA bundle when available
249 * (the default). Set to false to disable certificate verification (this
250 * is insecure!). Set to a string to provide the path to a CA bundle on
251 * disk to enable verification using a custom certificate.
252 */
253 public const VERIFY = 'verify';
254
255 /**
256 * timeout: (float, default=0) Float describing the timeout of the
257 * request in seconds. Use 0 to wait indefinitely (the default behavior).
258 */
259 public const TIMEOUT = 'timeout';
260
261 /**
262 * read_timeout: (float, default=default_socket_timeout ini setting) Float describing
263 * the body read timeout, for stream requests.
264 */
265 public const READ_TIMEOUT = 'read_timeout';
266
267 /**
268 * version: (float) Specifies the HTTP protocol version to attempt to use.
269 */
270 public const VERSION = 'version';
271
272 /**
273 * force_ip_resolve: (bool) Force client to use only ipv4 or ipv6 protocol
274 */
275 public const FORCE_IP_RESOLVE = 'force_ip_resolve';
276 }
277