add curlcode
[mdref/mdref-http] / http / Client / Curl.md
1 # namespace http\Client\Curl
2
3 The http\Client\Curl namespace holds option value constants specific to the curl driver of the http\Client.
4
5 ## Changelog
6
7 Version | Change
8 --------|-------
9 2.1.0 | Added $dns_interface, $dns_local_ip4, $dns_local_ip6 options, $expect_100_timeout.
10
11 ## Constants:
12
13 ### HTTP Protocol Version
14
15 * HTTP_VERSION_1_0
16 Use HTTP/1.0 protocol version.
17 * HTTP_VERSION_1_1
18 Use HTTP/1.1 protocol version.
19 * HTTP_VERSION_ANY
20 Use any HTTP protocol version.
21
22 ### SSL Protocol Version
23
24 * SSL_VERSION_TLSv1
25 Use TLSv1 encryption.
26 * SSL_VERSION_SSLv2
27 Use SSLv2 encryption.
28 * SSL_VERSION_SSLv3
29 Use SSLv3 encryption.
30 * SSL_VERSION_ANY
31 Use any encryption.
32
33 ### DNS IP Version
34
35 * IPRESOLVE_V4
36 Use IPv4 resolver.
37 * IPRESOLVE_V6
38 Use IPv6 resolver.
39 * IPRESOLVE_ANY
40 Use any resolver.
41
42 ### Authentication Type
43
44 * AUTH_BASIC
45 Use Basic authentication.
46 * AUTH_DIGEST
47 Use Digest authentication.
48 * AUTH_DIGEST_IE
49 Use IE (lower v7) quirks with Digest authentication. Available if libcurl is v7.19.3 or more recent.
50 * AUTH_NTLM
51 Use NTLM authentication.
52 * AUTH_GSSNEG
53 Use GSS-Negotiate authentication.
54 * AUTH_ANY
55 Use any authentication.
56
57 ### Proxy Protocol Version
58
59 * PROXY_SOCKS4
60 Use SOCKSv4 proxy protocol.
61 * PROXY_SOCKS4A
62 Use SOCKSv4a proxy protocol.
63 * PROXY_SOCKS5_HOSTNAME
64 Use SOCKS5h proxy protocol.
65 * PROXY_SOCKS5
66 Use SOCKS5 proxy protoccol.
67 * PROXY_HTTP
68 Use HTTP/1.1 proxy protocol.
69 * PROXY_HTTP_1_0
70 Use HTTP/1.0 proxy protocol. Available if libcurl is v7.19.4 or more recent.
71
72 ### POST Redirection Behavior
73
74 * POSTREDIR_301
75 Keep POSTing on 301 redirects. Available if libcurl is v7.19.1 or more recent.
76 * POSTREDIR_302
77 Keep POSTing on 302 redirects. Available if libcurl is v7.19.1 or more recent.
78 * POSTREDIR_ALL
79 Keep POSTing on any redirect. Available if libcurl is v7.19.1 or more recent.
80
81
82 ## Options:
83
84 The option names used here are more or less derived from the corresponding CURLOPT_* names.
85 ### HTTP
86
87 * int $protocol
88 The HTTP protocol version. See http\Client\Curl::HTTP_VERSION_* constants.
89
90 ### Proxies
91
92 * string $proxyhost
93 The hostname of the proxy.
94 * int $proxytype
95 See http\Client\Curl::PROXY_* constants.
96 * int $proxyport
97 The port number of the proxy.
98 * string $proxyauth
99 user:password
100 * int $proxyauthtype
101 See http\Client\Curl::AUTH_* constants.
102 * bool $proxytunnel
103 Tunnel all operations through the proxy.
104 * string $noproxy
105 Comma separated list of hosts where no proxy should be used. Available if libcurl is v7.19.4 or more recent.
106
107 ### DNS
108
109 * int $dns_cache_timeout
110 Resolved hosts will be kept fot this number of seconds.
111 * int $ipresolve
112 See http\Client\Curl::IPRESOLVE_* constants.
113 * array $resolve
114 A list of HOST:PORT:ADDRESS mappings which pre-populate the DNS cache. Available if libcurl is v7.21.3 or more recent.
115 * string $dns_servers
116 Comma separated list of custom DNS servers of the form HOST[:PORT]. Available if libcurl is v7.24.0 or more recent and has built-in c-ares support.
117 * string $dns_interface
118 The name of the network interface ***name*** that the DNS resolver should bind to. Available if libcurl is v7.33.0 or more recent and has built-in c-ares support.
119 * string $dns_local_ip4
120 The local IPv4 ***address*** that the resolver should bind to. Available if libcurl is v7.33.0 or more recent and has built-in c-ares support.
121 * string $dns_local_ip6
122 The local IPv6 ***address*** that the resolver should bind to. Available if libcurl is v7.33.0 or more recent and has built-in c-ares support.
123
124 ### Limits
125
126 * int $low_speed_limit
127 Minimum speed in bytes per second.
128 * int $low_speed_time
129 Maximum time in seconds the transfer can be below $low_speed_limit before cancelling.
130 * int $maxfilesize
131 Maximum download size.
132
133 ### Connection handling
134
135 * bool $fresh_connect
136 Force a new connection.
137 * bool $forbid_reuse
138 Force closing the connection.
139
140 ### Networking
141
142 * string $interface
143 Outgoing interface name.
144 * array $portrange
145 A tuple of min/max ports.
146 * int $port
147 Override the URL's port.
148 * int $address_scope
149 RFC4007 zone_id. Available if libcurl is v7.19.0 or more recent.
150 * bool $tcp_keepalive
151 Whether to use TCP keepalive. Available if libcurl is v7.25.0 or more recent.
152 * int $tcp_keepidle
153 Seconds to wait before sending keepalive probes. Available if libcurl is v7.25.0 or more recent.
154 * int $tcp_keepintvl
155 Interval in seconds to wait between sending keepalive probes. Available if libcurl is v7.25.0 or more recent.
156 * bool $tcp_nodelay
157 Disable [Nagle's algotrithm](http://tools.ietf.org/html/rfc896).
158
159 ### Authentication
160
161 * string $httpauth
162 user:password
163 * int $httpauthtype
164 See http\Client\Curl::AUTH_* constants.
165
166 ### Redirection
167
168 * int $redirect
169 How many redirects to follow.
170 * bool $unrestricted_auth
171 Whether to keep sending authentication credentials on redirects to different hosts.
172 * int $postredir
173 See http\Client\Curl::POSTREDIR_* constants. Available if libcurl is v7.19.1 or more recent.
174
175 ### Retries
176
177 * int $retrycount
178 Retry this often.
179 * float $retrydelay
180 Pause this number of seconds between retries.
181
182 ### Special headers
183
184 * string $referer
185 Custom Referer header.
186 * bool $autoreferer
187 Whether to automatically send referers.
188 * string $useragent
189 Custom User-Agent header.
190 * string $etag
191 Custom ETag.
192 * bool $compress
193 Whether to request compressed content (through Accept-Encoding).
194 * int $lastmodified
195 Custom If-(Un)Modified since time. If less than zero, the current time will be added.
196
197 ### Resume/Ranges
198
199 * int $resume
200 Resume from this byte offset.
201 * array $range
202 Fetch specific ranges (if server supports byte ranges).
203
204 ### Cookies
205
206 * bool $encodecookies
207 Whether to URLencode cookies.
208 * array $cookies
209 List of custom cookies in the form ["name" => "value"].
210 * bool $cookiesession
211 Ignore previous session cookies to be loaded from $cookiestore.
212 * string $cookiestore
213 Path to a Netscape cookie file, from which cookies will be loaded resp. to which cookies will be written.
214
215 ### Timeouts
216
217 * float $timeout
218 Seconds the complete transfer may take.
219 * float $connecttimeout
220 Seconds the connect may take.
221 * float $expect_100_timeout
222 Senconds to wait for the server to send a response to "Expect: 100-Continue" before just proceeding with the request. Available if libcurl is v7.36.0 or more recent.
223
224 ### SSL
225
226 * array $ssl
227 Subarray of SSL related options:
228 * string $cert
229 SSL certificate file.
230 * string $certtype
231 Certificate type (DER, PEM). (Secure Transport additionally supports P12).
232 * string $key
233 Private key file.
234 * string $keytype
235 PK type (PEM, DER, ENG).
236 * string $keypasswd
237 The password for the private key.
238 * string $engine
239 Crypto engine to use for the private key.
240 * int $version
241 See http\Client\Curl::SSL_VERSION_* constants.
242 * bool $verifypeer
243 Whether to apply peer verification.
244 * bool $verifyhost
245 Whether to apply host verification.
246 * string $cipher_list
247 One or more cipher strings separated by colons.
248 * string $cainfo
249 CA bundle to verify the peer with.
250 * string $capath
251 Directory with prepared CA certs to verify the peer with.
252 * string $random_file
253 A file used to read from to seed the random engine.
254 * string $egdsocket
255 A Entropy Gathering Daemon socket.
256 * string $issuercert
257 CA PEM cert for peer verification. Available if libcurl is v7.19.0 or more recent.
258 * string $crlfile
259 File with the concatenation of CRL in PEM format. Available if libcurl was built with OpenSSL support.
260 * bool $certinfo
261 Enable gathering of SSL certificate chain information. Available if libcurl is v7.19.1 or more recent.