ethon 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -1
- data/lib/ethon/curls/classes.rb +2 -3
- data/lib/ethon/curls/options.rb +1 -1
- data/lib/ethon/easy.rb +4 -579
- data/lib/ethon/easy/http.rb +7 -0
- data/lib/ethon/easy/operations.rb +0 -4
- data/lib/ethon/easy/options.rb +586 -62
- data/lib/ethon/easy/response_callbacks.rb +0 -2
- data/lib/ethon/libc.rb +14 -2
- data/lib/ethon/multi/operations.rb +0 -4
- data/lib/ethon/version.rb +1 -3
- metadata +5 -5
data/lib/ethon/easy/http.rb
CHANGED
@@ -14,6 +14,8 @@ module Ethon
|
|
14
14
|
module Http
|
15
15
|
|
16
16
|
# Set specified options in order to make a http request.
|
17
|
+
# Look into {Ethon::Easy::Options Options} to see what you can
|
18
|
+
# provide in the options hash.
|
17
19
|
#
|
18
20
|
# @example Set options for http request.
|
19
21
|
# easy.http_request("www.google.com", :get, {})
|
@@ -27,6 +29,11 @@ module Ethon
|
|
27
29
|
# @option options :body [ Hash ] Body hash which
|
28
30
|
# becomes the request body. It is a PUT body for
|
29
31
|
# PUT requests and a POST from for everything else.
|
32
|
+
# @option options :headers [ Hash ] Request headers.
|
33
|
+
#
|
34
|
+
# @return [ void ]
|
35
|
+
#
|
36
|
+
# @see Ethon::Easy::Options
|
30
37
|
def http_request(url, action_name, options = {})
|
31
38
|
fabricate(action_name).new(url, options).setup(self)
|
32
39
|
end
|
@@ -20,8 +20,6 @@ module Ethon
|
|
20
20
|
# easy.perform
|
21
21
|
#
|
22
22
|
# @return [ Integer ] The return code.
|
23
|
-
#
|
24
|
-
# @api public
|
25
23
|
def perform
|
26
24
|
@return_code = Curl.easy_perform(handle)
|
27
25
|
complete
|
@@ -35,8 +33,6 @@ module Ethon
|
|
35
33
|
# @example Prepare easy.
|
36
34
|
# easy.prepare
|
37
35
|
#
|
38
|
-
# @api public
|
39
|
-
#
|
40
36
|
# @deprecated It is no longer necessary to call prepare.
|
41
37
|
def prepare
|
42
38
|
Ethon.logger.warn(
|
data/lib/ethon/easy/options.rb
CHANGED
@@ -3,16 +3,46 @@ module Ethon
|
|
3
3
|
|
4
4
|
# This module contains the logic and knowledge about the
|
5
5
|
# available options on easy.
|
6
|
-
#
|
7
|
-
# @api private
|
8
6
|
module Options
|
9
7
|
|
10
8
|
attr_reader :url
|
11
9
|
|
12
|
-
# Sets
|
10
|
+
# Sets the contents of the Accept-Encoding: header sent in a HTTP
|
11
|
+
# request, and enables decoding of a response when a
|
12
|
+
# Content-Encoding: header is received. Three encodings are
|
13
|
+
# supported: identity, which does nothing, deflate which requests
|
14
|
+
# the server to compress its response using the zlib algorithm,
|
15
|
+
# and gzip which requests the gzip algorithm. If a zero-length
|
16
|
+
# string is set, then an Accept-Encoding: header containing all
|
17
|
+
# supported encodings is sent.
|
18
|
+
# This is a request, not an order; the server may or may not do it.
|
19
|
+
# This option must be set (to any non-NULL value) or else any
|
20
|
+
# unsolicited encoding done by the server is ignored. See the
|
21
|
+
# special file lib/README.encoding for details.
|
22
|
+
# (This option was called CURLOPT_ENCODING before 7.21.6)
|
23
|
+
#
|
24
|
+
# @example Set accept_encoding option.
|
25
|
+
# easy.accept_encoding = "gzip"
|
26
|
+
#
|
27
|
+
# @param [ String ] value The value to set.
|
28
|
+
#
|
29
|
+
# @return [ void ]
|
30
|
+
def accept_encoding=(value)
|
31
|
+
Curl.set_option(:accept_encoding, value_for(value, :string), handle)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Pass a string to a zero terminated
|
35
|
+
# string naming a file holding one or more certificates to verify
|
36
|
+
# the peer with. This makes sense only when used in combination with
|
37
|
+
# the CURLOPT_SSL_VERIFYPEER option. If CURLOPT_SSL_VERIFYPEER is
|
38
|
+
# zero, CURLOPT_CAINFO need not even indicate an accessible file.
|
39
|
+
# This option is by default set to the system path where libcurl's
|
40
|
+
# cacert bundle is assumed to be stored, as established at build time.
|
41
|
+
# When built against NSS, this is the directory that the NSS certificate
|
42
|
+
# database resides in.
|
13
43
|
#
|
14
44
|
# @example Set cainfo option.
|
15
|
-
# easy.cainfo =
|
45
|
+
# easy.cainfo = "/path/to/file"
|
16
46
|
#
|
17
47
|
# @param [ String ] value The value to set.
|
18
48
|
#
|
@@ -21,10 +51,20 @@ module Ethon
|
|
21
51
|
Curl.set_option(:cainfo, value_for(value, :string), handle)
|
22
52
|
end
|
23
53
|
|
24
|
-
#
|
54
|
+
# Pass a string to a zero terminated string naming a directory holding
|
55
|
+
# multiple CA certificates to verify the peer with. If libcurl is built
|
56
|
+
# against OpenSSL, the certificate directory must be prepared using the
|
57
|
+
# openssl c_rehash utility. This makes sense only when used in
|
58
|
+
# combination with the CURLOPT_SSL_VERIFYPEER option. If
|
59
|
+
# CURLOPT_SSL_VERIFYPEER is zero, CURLOPT_CAPATH need not even indicate
|
60
|
+
# an accessible path. The CURLOPT_CAPATH function apparently does not
|
61
|
+
# work in Windows due to some limitation in openssl. This option is
|
62
|
+
# OpenSSL-specific and does nothing if libcurl is built to use GnuTLS.
|
63
|
+
# NSS-powered libcurl provides the option only for backward
|
64
|
+
# compatibility.
|
25
65
|
#
|
26
66
|
# @example Set capath option.
|
27
|
-
# easy.capath =
|
67
|
+
# easy.capath = "/path/to/file"
|
28
68
|
#
|
29
69
|
# @param [ String ] value The value to set.
|
30
70
|
#
|
@@ -33,7 +73,13 @@ module Ethon
|
|
33
73
|
Curl.set_option(:capath, value_for(value, :string), handle)
|
34
74
|
end
|
35
75
|
|
36
|
-
#
|
76
|
+
# Pass a long. It should contain the maximum time in seconds that you
|
77
|
+
# allow the connection to the server to take. This only limits the
|
78
|
+
# connection phase, once it has connected, this option is of no more
|
79
|
+
# use. Set to zero to switch to the default built-in connection timeout
|
80
|
+
# \- 300 seconds. See also the CURLOPT_TIMEOUT option.
|
81
|
+
# In unix-like systems, this might cause signals to be used unless
|
82
|
+
# CURLOPT_NOSIGNAL is set.
|
37
83
|
#
|
38
84
|
# @example Set connecttimeout option.
|
39
85
|
# easy.connecttimeout = 1
|
@@ -45,7 +91,11 @@ module Ethon
|
|
45
91
|
Curl.set_option(:connecttimeout, value_for(value, :int), handle)
|
46
92
|
end
|
47
93
|
|
48
|
-
#
|
94
|
+
# Like CURLOPT_CONNECTTIMEOUT but takes the number of milliseconds
|
95
|
+
# instead. If libcurl is built to use the standard system name
|
96
|
+
# resolver, that portion of the connect will still use full-second
|
97
|
+
# resolution for timeouts with a minimum timeout allowed of one second.
|
98
|
+
# (Added in 7.16.2)
|
49
99
|
#
|
50
100
|
# @example Set connecttimeout_ms option.
|
51
101
|
# easy.connecttimeout_ms = 1
|
@@ -57,10 +107,21 @@ module Ethon
|
|
57
107
|
Curl.set_option(:connecttimeout_ms, value_for(value, :int), handle)
|
58
108
|
end
|
59
109
|
|
60
|
-
#
|
110
|
+
# Pass a string as parameter, which should be the full data to post in
|
111
|
+
# a HTTP POST operation. It behaves as the CURLOPT_POSTFIELDS option,
|
112
|
+
# but the original data are copied by the library, allowing the
|
113
|
+
# application to overwrite the original data after setting this option.
|
114
|
+
# Because data are copied, care must be taken when using this option in
|
115
|
+
# conjunction with CURLOPT_POSTFIELDSIZE or
|
116
|
+
# CURLOPT_POSTFIELDSIZE_LARGE: If the size has not been set prior to
|
117
|
+
# CURLOPT_COPYPOSTFIELDS, the data are assumed to be a NUL-terminated
|
118
|
+
# string; else the stored size informs the library about the data byte
|
119
|
+
# count to copy. In any case, the size must not be changed after
|
120
|
+
# CURLOPT_COPYPOSTFIELDS, unless another CURLOPT_POSTFIELDS or
|
121
|
+
# CURLOPT_COPYPOSTFIELDS option is issued. (Added in 7.17.1)
|
61
122
|
#
|
62
123
|
# @example Set copypostfields option.
|
63
|
-
# easy.copypostfields =
|
124
|
+
# easy.copypostfields = "PATCH"
|
64
125
|
#
|
65
126
|
# @param [ String ] value The value to set.
|
66
127
|
#
|
@@ -69,10 +130,40 @@ module Ethon
|
|
69
130
|
Curl.set_option(:copypostfields, value_for(value, :string), handle)
|
70
131
|
end
|
71
132
|
|
72
|
-
#
|
133
|
+
# Pass a pointer to a zero terminated string as parameter. It can be
|
134
|
+
# used to specify the request instead of GET or HEAD when performing
|
135
|
+
# HTTP based requests, instead of LIST and NLST when performing FTP
|
136
|
+
# directory listings and instead of LIST and RETR when issuing POP3
|
137
|
+
# based commands. This is particularly useful, for example, for
|
138
|
+
# performing a HTTP DELETE request or a POP3 DELE command.
|
139
|
+
# Please don't perform this at will, on HTTP based requests, by making
|
140
|
+
# sure your server supports the command you are sending first.
|
141
|
+
# When you change the request method by setting CURLOPT_CUSTOMREQUEST
|
142
|
+
# to something, you don't actually change how libcurl behaves or acts
|
143
|
+
# in regards to the particular request method, it will only change the
|
144
|
+
# actual string sent in the request.
|
145
|
+
# For example:
|
146
|
+
# With the HTTP protocol when you tell libcurl to do a HEAD request,
|
147
|
+
# but then specify a GET though a custom request libcurl will still act
|
148
|
+
# as if it sent a HEAD. To switch to a proper HEAD use CURLOPT_NOBODY,
|
149
|
+
# to switch to a proper POST use CURLOPT_POST or CURLOPT_POSTFIELDS and
|
150
|
+
# to switch to a proper GET use CURLOPT_HTTPGET.
|
151
|
+
# With the POP3 protocol when you tell libcurl to use a custom request
|
152
|
+
# it will behave like a LIST or RETR command was sent where it expects
|
153
|
+
# data to be returned by the server. As such CURLOPT_NOBODY should be
|
154
|
+
# used when specifying commands such as DELE and NOOP for example.
|
155
|
+
# Restore to the internal default by setting this to NULL.
|
156
|
+
# Many people have wrongly used this option to replace the entire
|
157
|
+
# request with their own, including multiple headers and POST contents.
|
158
|
+
# While that might work in many cases, it will cause libcurl to send
|
159
|
+
# invalid requests and it could possibly confuse the remote server
|
160
|
+
# badly. Use CURLOPT_POST and CURLOPT_POSTFIELDS to set POST data. Use
|
161
|
+
# CURLOPT_HTTPHEADER to replace or extend the set of headers sent by
|
162
|
+
# libcurl. Use CURLOPT_HTTP_VERSION to change HTTP version.
|
163
|
+
# (Support for POP3 added in 7.26.0)
|
73
164
|
#
|
74
165
|
# @example Set customrequest option.
|
75
|
-
# easy.customrequest =
|
166
|
+
# easy.customrequest = "PATCH"
|
76
167
|
#
|
77
168
|
# @param [ String ] value The value to set.
|
78
169
|
#
|
@@ -81,7 +172,15 @@ module Ethon
|
|
81
172
|
Curl.set_option(:customrequest, value_for(value, :string), handle)
|
82
173
|
end
|
83
174
|
|
84
|
-
#
|
175
|
+
# Pass a long, this sets the timeout in seconds. Name resolves will be
|
176
|
+
# kept in memory for this number of seconds. Set to zero to completely
|
177
|
+
# disable caching, or set to -1 to make the cached entries remain
|
178
|
+
# forever. By default, libcurl caches this info for 60 seconds.
|
179
|
+
# The name resolve functions of various libc implementations don't
|
180
|
+
# re-read name server information unless explicitly told so (for
|
181
|
+
# example, by calling res_init(3)). This may cause libcurl to keep
|
182
|
+
# using the older server even if DHCP has updated the server info, and
|
183
|
+
# this may look like a DNS cache issue to the casual libcurl-app user.
|
85
184
|
#
|
86
185
|
# @example Set dns_cache_timeout option.
|
87
186
|
# easy.dns_cache_timeout = 1
|
@@ -93,7 +192,15 @@ module Ethon
|
|
93
192
|
Curl.set_option(:dns_cache_timeout, value_for(value, :int), handle)
|
94
193
|
end
|
95
194
|
|
96
|
-
#
|
195
|
+
# A parameter set to 1 tells the library to follow any Location: header
|
196
|
+
# that the server sends as part of a HTTP header.
|
197
|
+
# This means that the library will re-send the same request on the new
|
198
|
+
# location and follow new Location: headers all the way until no more
|
199
|
+
# such headers are returned. CURLOPT_MAXREDIRS can be used to limit the
|
200
|
+
# number of redirects libcurl will follow.
|
201
|
+
# Since 7.19.4, libcurl can limit what protocols it will automatically
|
202
|
+
# follow. The accepted protocols are set with CURLOPT_REDIR_PROTOCOLS
|
203
|
+
# and it excludes the FILE protocol by default.
|
97
204
|
#
|
98
205
|
# @example Set followlocation option.
|
99
206
|
# easy.followlocation = true
|
@@ -105,7 +212,12 @@ module Ethon
|
|
105
212
|
Curl.set_option(:followlocation, value_for(value, :bool), handle)
|
106
213
|
end
|
107
214
|
|
108
|
-
#
|
215
|
+
# Pass a long. Set to 1 to make the next transfer explicitly close the
|
216
|
+
# connection when done. Normally, libcurl keeps all connections alive
|
217
|
+
# when done with one transfer in case a succeeding one follows that can
|
218
|
+
# re-use them. This option should be used with caution and only if you
|
219
|
+
# understand what it does. Set to 0 to have libcurl keep the connection
|
220
|
+
# open for possible later re-use (default behavior).
|
109
221
|
#
|
110
222
|
# @example Set forbid_reuse option.
|
111
223
|
# easy.forbid_reuse = true
|
@@ -117,10 +229,17 @@ module Ethon
|
|
117
229
|
Curl.set_option(:forbid_reuse, value_for(value, :bool), handle)
|
118
230
|
end
|
119
231
|
|
120
|
-
#
|
232
|
+
# Pass a long as parameter, which is set to a bitmask, to tell libcurl
|
233
|
+
# which authentication method(s) you want it to use. The available bits
|
234
|
+
# are listed below. If more than one bit is set, libcurl will first
|
235
|
+
# query the site to see which authentication methods it supports and
|
236
|
+
# then pick the best one you allow it to use. For some methods, this
|
237
|
+
# will induce an extra network round-trip. Set the actual name and
|
238
|
+
# password with the CURLOPT_USERPWD option or with the CURLOPT_USERNAME
|
239
|
+
# and the CURLOPT_PASSWORD options. (Added in 7.10.6)
|
121
240
|
#
|
122
241
|
# @example Set httpauth option.
|
123
|
-
# easy.httpauth =
|
242
|
+
# easy.httpauth = :basic
|
124
243
|
#
|
125
244
|
# @param [ $type_doc ] value The value to set.
|
126
245
|
#
|
@@ -129,7 +248,11 @@ module Ethon
|
|
129
248
|
Curl.set_option(:httpauth, value_for(value, :enum, :httpauth), handle)
|
130
249
|
end
|
131
250
|
|
132
|
-
#
|
251
|
+
# Pass a long. If the long is 1, this forces the HTTP request to get
|
252
|
+
# back to GET. Usable if a POST, HEAD, PUT, or a custom request has
|
253
|
+
# been used previously using the same curl handle.
|
254
|
+
# When setting CURLOPT_HTTPGET to 1, it will automatically set
|
255
|
+
# CURLOPT_NOBODY to 0 (since 7.14.1).
|
133
256
|
#
|
134
257
|
# @example Set httpget option.
|
135
258
|
# easy.httpget = true
|
@@ -141,10 +264,19 @@ module Ethon
|
|
141
264
|
Curl.set_option(:httpget, value_for(value, :bool), handle)
|
142
265
|
end
|
143
266
|
|
144
|
-
#
|
267
|
+
# Tells libcurl you want a multipart/formdata HTTP POST to be made and
|
268
|
+
# you instruct what data to pass on to the server. Pass a pointer to a
|
269
|
+
# linked list of curl_httppost structs as parameter. The easiest way to
|
270
|
+
# create such a list, is to use curl_formadd(3) as documented. The data
|
271
|
+
# in this list must remain intact until you close this curl handle
|
272
|
+
# again with curl_easy_cleanup(3).
|
273
|
+
# Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue"
|
274
|
+
# header. You can disable this header with CURLOPT_HTTPHEADER as usual.
|
275
|
+
# When setting CURLOPT_HTTPPOST, it will automatically set
|
276
|
+
# CURLOPT_NOBODY to 0 (since 7.14.1).
|
145
277
|
#
|
146
278
|
# @example Set httppost option.
|
147
|
-
# easy.httppost =
|
279
|
+
# easy.httppost = value
|
148
280
|
#
|
149
281
|
# @param [ String ] value The value to set.
|
150
282
|
#
|
@@ -153,7 +285,16 @@ module Ethon
|
|
153
285
|
Curl.set_option(:httppost, value_for(value, :string), handle)
|
154
286
|
end
|
155
287
|
|
156
|
-
#
|
288
|
+
# When uploading a file to a remote site, this option should be used to
|
289
|
+
# tell libcurl what the expected size of the infile is. This value
|
290
|
+
# should be passed as a long. See also CURLOPT_INFILESIZE_LARGE.
|
291
|
+
# For uploading using SCP, this option or CURLOPT_INFILESIZE_LARGE is
|
292
|
+
# mandatory.
|
293
|
+
# When sending emails using SMTP, this command can be used to specify
|
294
|
+
# the optional SIZE parameter for the MAIL FROM command. (Added in
|
295
|
+
# 7.23.0)
|
296
|
+
# This option does not limit how much data libcurl will actually send,
|
297
|
+
# as that is controlled entirely by what the read callback returns.
|
157
298
|
#
|
158
299
|
# @example Set infilesize option.
|
159
300
|
# easy.infilesize = 1
|
@@ -165,10 +306,21 @@ module Ethon
|
|
165
306
|
Curl.set_option(:infilesize, value_for(value, :int), handle)
|
166
307
|
end
|
167
308
|
|
168
|
-
#
|
309
|
+
# Pass a string as parameter. This sets the interface name to use as
|
310
|
+
# outgoing network interface. The name can be an interface name, an IP
|
311
|
+
# address, or a host name.
|
312
|
+
# Starting with 7.24.0: If the parameter starts with "if!" then it is
|
313
|
+
# treated as only as interface name and no attempt will ever be named
|
314
|
+
# to do treat it as an IP address or to do name resolution on it. If
|
315
|
+
# the parameter starts with "host!" it is treated as either an IP
|
316
|
+
# address or a hostname. Hostnames are resolved synchronously. Using
|
317
|
+
# the if! format is highly recommended when using the multi interfaces
|
318
|
+
# to avoid allowing the code to block. If "if!" is specified but the
|
319
|
+
# parameter does not match an existing interface,
|
320
|
+
# CURLE_INTERFACE_FAILED is returned.
|
169
321
|
#
|
170
322
|
# @example Set interface option.
|
171
|
-
# easy.interface =
|
323
|
+
# easy.interface = "eth0"
|
172
324
|
#
|
173
325
|
# @param [ String ] value The value to set.
|
174
326
|
#
|
@@ -177,10 +329,15 @@ module Ethon
|
|
177
329
|
Curl.set_option(:interface, value_for(value, :string), handle)
|
178
330
|
end
|
179
331
|
|
180
|
-
#
|
332
|
+
# Pass a pointer to a zero terminated string as parameter. It will be
|
333
|
+
# used as the password required to use the CURLOPT_SSLKEY or
|
334
|
+
# CURLOPT_SSH_PRIVATE_KEYFILE private key. You never needed a pass
|
335
|
+
# phrase to load a certificate but you need one to load your private key.
|
336
|
+
# (This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and
|
337
|
+
# CURLOPT_SSLCERTPASSWD up to 7.9.2)
|
181
338
|
#
|
182
339
|
# @example Set keypasswd option.
|
183
|
-
# easy.keypasswd =
|
340
|
+
# easy.keypasswd = "password"
|
184
341
|
#
|
185
342
|
# @param [ String ] value The value to set.
|
186
343
|
#
|
@@ -189,7 +346,12 @@ module Ethon
|
|
189
346
|
Curl.set_option(:keypasswd, value_for(value, :string), handle)
|
190
347
|
end
|
191
348
|
|
192
|
-
#
|
349
|
+
# Pass a long. The set number will be the redirection limit. If that
|
350
|
+
# many redirections have been followed, the next redirect will cause an
|
351
|
+
# error (CURLE_TOO_MANY_REDIRECTS). This option only makes sense if the
|
352
|
+
# CURLOPT_FOLLOWLOCATION is used at the same time. Added in 7.15.1:
|
353
|
+
# Setting the limit to 0 will make libcurl refuse any redirect. Set it
|
354
|
+
# to -1 for an infinite number of redirects (which is the default)
|
193
355
|
#
|
194
356
|
# @example Set maxredirs option.
|
195
357
|
# easy.maxredirs = 1
|
@@ -201,7 +363,12 @@ module Ethon
|
|
201
363
|
Curl.set_option(:maxredirs, value_for(value, :int), handle)
|
202
364
|
end
|
203
365
|
|
204
|
-
#
|
366
|
+
# A parameter set to 1 tells the library to not include the body-part
|
367
|
+
# in the output. This is only relevant for protocols that have separate
|
368
|
+
# header and body parts. On HTTP(S) servers, this will make libcurl do
|
369
|
+
# a HEAD request.
|
370
|
+
# To change request to GET, you should use CURLOPT_HTTPGET. Change
|
371
|
+
# request to POST with CURLOPT_POST etc.
|
205
372
|
#
|
206
373
|
# @example Set nobody option.
|
207
374
|
# easy.nobody = true
|
@@ -213,7 +380,24 @@ module Ethon
|
|
213
380
|
Curl.set_option(:nobody, value_for(value, :bool), handle)
|
214
381
|
end
|
215
382
|
|
216
|
-
#
|
383
|
+
# Pass a long. If it is 1, libcurl will not use any functions that
|
384
|
+
# install signal handlers or any functions that cause signals to be
|
385
|
+
# sent to the process. This option is mainly here to allow
|
386
|
+
# multi-threaded unix applications to still set/use all timeout options
|
387
|
+
# etc, without risking getting signals. (Added in 7.10)
|
388
|
+
# If this option is set and libcurl has been built with the standard
|
389
|
+
# name resolver, timeouts will not occur while the name resolve takes
|
390
|
+
# place. Consider building libcurl with c-ares support to enable
|
391
|
+
# asynchronous DNS lookups, which enables nice timeouts for name
|
392
|
+
# resolves without signals.
|
393
|
+
# Setting CURLOPT_NOSIGNAL to 1 makes libcurl NOT ask the system to
|
394
|
+
# ignore SIGPIPE signals, which otherwise are sent by the system when
|
395
|
+
# trying to send data to a socket which is closed in the other end.
|
396
|
+
# libcurl makes an effort to never cause such SIGPIPEs to trigger, but
|
397
|
+
# some operating systems have no way to avoid them and even on those
|
398
|
+
# that have there are some corner cases when they may still happen,
|
399
|
+
# contrary to our desire. In addition, using CURLAUTH_NTLM_WB
|
400
|
+
# authentication could cause a SIGCHLD signal to be raised.
|
217
401
|
#
|
218
402
|
# @example Set nosignal option.
|
219
403
|
# easy.nosignal = true
|
@@ -225,7 +409,11 @@ module Ethon
|
|
225
409
|
Curl.set_option(:nosignal, value_for(value, :bool), handle)
|
226
410
|
end
|
227
411
|
|
228
|
-
#
|
412
|
+
# If you want to post data to the server without letting libcurl do a
|
413
|
+
# strlen() to measure the data size, this option must be used. When
|
414
|
+
# this option is used you can post fully binary data, which otherwise
|
415
|
+
# is likely to fail. If this size is set to -1, the library will use
|
416
|
+
# strlen() to get the size.
|
229
417
|
#
|
230
418
|
# @example Set postfieldsize option.
|
231
419
|
# easy.postfieldsize = 1
|
@@ -237,10 +425,40 @@ module Ethon
|
|
237
425
|
Curl.set_option(:postfieldsize, value_for(value, :int), handle)
|
238
426
|
end
|
239
427
|
|
240
|
-
#
|
428
|
+
# Set HTTP proxy to use. The parameter should be a string to a zero
|
429
|
+
# terminated string holding the host name or dotted IP address. To
|
430
|
+
# specify port number in this string, append :[port] to the end of the
|
431
|
+
# host name. The proxy string may be prefixed with [protocol]:// since
|
432
|
+
# any such prefix will be ignored. The proxy's port number may
|
433
|
+
# optionally be specified with the separate option. If not specified,
|
434
|
+
# libcurl will default to using port 1080 for proxies.
|
435
|
+
# CURLOPT_PROXYPORT.
|
436
|
+
# When you tell the library to use a HTTP proxy, libcurl will
|
437
|
+
# transparently convert operations to HTTP even if you specify an FTP
|
438
|
+
# URL etc. This may have an impact on what other features of the
|
439
|
+
# library you can use, such as CURLOPT_QUOTE and similar FTP specifics
|
440
|
+
# that don't work unless you tunnel through the HTTP proxy. Such
|
441
|
+
# tunneling is activated with CURLOPT_HTTPPROXYTUNNEL.
|
442
|
+
# libcurl respects the environment variables http_proxy, ftp_proxy,
|
443
|
+
# all_proxy etc, if any of those are set. The CURLOPT_PROXY option does
|
444
|
+
# however override any possibly set environment variables.
|
445
|
+
# Setting the proxy string to "" (an empty string) will explicitly
|
446
|
+
# disable the use of a proxy, even if there is an environment variable
|
447
|
+
# set for it.
|
448
|
+
# Since 7.14.1, the proxy host string given in environment variables
|
449
|
+
# can be specified the exact same way as the proxy can be set with
|
450
|
+
# CURLOPT_PROXY, include protocol prefix (http://) and embedded user +
|
451
|
+
# password.
|
452
|
+
# Since 7.21.7, the proxy string may be specified with a protocol://
|
453
|
+
# prefix to specify alternative proxy protocols. Use socks4://,
|
454
|
+
# socks4a://, socks5:// or socks5h:// (the last one to enable socks5
|
455
|
+
# and asking the proxy to do the resolving, also known as
|
456
|
+
# CURLPROXY_SOCKS5_HOSTNAME type) to request the specific SOCKS version
|
457
|
+
# to be used. No protocol specified, http:// and all others will be
|
458
|
+
# treated as HTTP proxies.
|
241
459
|
#
|
242
460
|
# @example Set proxy option.
|
243
|
-
# easy.proxy =
|
461
|
+
# easy.proxy = "socks5://27.0.0.1:9050"
|
244
462
|
#
|
245
463
|
# @param [ String ] value The value to set.
|
246
464
|
#
|
@@ -249,10 +467,19 @@ module Ethon
|
|
249
467
|
Curl.set_option(:proxy, value_for(value, :string), handle)
|
250
468
|
end
|
251
469
|
|
252
|
-
#
|
470
|
+
# Pass a long as parameter, which is set to a bitmask, to tell libcurl
|
471
|
+
# which authentication method(s) you want it to use for your proxy
|
472
|
+
# authentication. If more than one bit is set, libcurl will first query
|
473
|
+
# the site to see what authentication methods it supports and then pick
|
474
|
+
# the best one you allow it to use. For some methods, this will induce
|
475
|
+
# an extra network round-trip. Set the actual name and password with
|
476
|
+
# the CURLOPT_PROXYUSERPWD option. The bitmask can be constructed by
|
477
|
+
# or'ing together the bits listed above for the CURLOPT_HTTPAUTH
|
478
|
+
# option. As of this writing, only Basic, Digest and NTLM work. (Added
|
479
|
+
# in 7.10.7)
|
253
480
|
#
|
254
481
|
# @example Set proxyauth option.
|
255
|
-
# easy.proxyauth =
|
482
|
+
# easy.proxyauth = value
|
256
483
|
#
|
257
484
|
# @param [ String ] value The value to set.
|
258
485
|
#
|
@@ -261,7 +488,8 @@ module Ethon
|
|
261
488
|
Curl.set_option(:proxyauth, value_for(value, :string), handle)
|
262
489
|
end
|
263
490
|
|
264
|
-
#
|
491
|
+
# Pass a long with this option to set the proxy port to connect to
|
492
|
+
# unless it is specified in the proxy string CURLOPT_PROXY.
|
265
493
|
#
|
266
494
|
# @example Set proxyport option.
|
267
495
|
# easy.proxyport = 1
|
@@ -273,22 +501,38 @@ module Ethon
|
|
273
501
|
Curl.set_option(:proxyport, value_for(value, :int), handle)
|
274
502
|
end
|
275
503
|
|
276
|
-
#
|
504
|
+
# Pass a long with this option to set type of the proxy. Available
|
505
|
+
# options for this are CURLPROXY_HTTP, CURLPROXY_HTTP_1_0 (added in
|
506
|
+
# 7.19.4), CURLPROXY_SOCKS4 (added in 7.10), CURLPROXY_SOCKS5,
|
507
|
+
# CURLPROXY_SOCKS4A (added in 7.18.0) and CURLPROXY_SOCKS5_HOSTNAME
|
508
|
+
# (added in 7.18.0). The HTTP type is default. (Added in 7.10)
|
509
|
+
# If you set CURLOPT_PROXYTYPE to CURLPROXY_HTTP_1_0, it will only
|
510
|
+
# affect how libcurl speaks to a proxy when CONNECT is used. The HTTP
|
511
|
+
# version used for "regular" HTTP requests is instead controlled with
|
512
|
+
# CURLOPT_HTTP_VERSION.
|
277
513
|
#
|
278
514
|
# @example Set proxytype option.
|
279
|
-
# easy.proxytype =
|
515
|
+
# easy.proxytype = :socks5
|
280
516
|
#
|
281
517
|
# @param [ String ] value The value to set.
|
282
518
|
#
|
283
519
|
# @return [ void ]
|
520
|
+
#
|
521
|
+
# @deprecated Please use the proxy option with protocoll handler.
|
284
522
|
def proxytype=(value)
|
523
|
+
Ethon.logger.warn(
|
524
|
+
"ETHON: Easy#proxytype= is deprecated. "+
|
525
|
+
"Please use Easy#proxy= with protocoll handlers."
|
526
|
+
)
|
285
527
|
Curl.set_option(:proxytype, value_for(value, :string), handle)
|
286
528
|
end
|
287
529
|
|
288
|
-
#
|
530
|
+
# Pass a string as parameter, which should be [user name]:[password]
|
531
|
+
# to use for the connection to the HTTP proxy. Use CURLOPT_PROXYAUTH
|
532
|
+
# to decide the authentication method.
|
289
533
|
#
|
290
534
|
# @example Set proxyuserpwd option.
|
291
|
-
# easy.proxyuserpwd =
|
535
|
+
# easy.proxyuserpwd = "user:password"
|
292
536
|
#
|
293
537
|
# @param [ String ] value The value to set.
|
294
538
|
#
|
@@ -297,10 +541,17 @@ module Ethon
|
|
297
541
|
Curl.set_option(:proxyuserpwd, value_for(value, :string), handle)
|
298
542
|
end
|
299
543
|
|
300
|
-
#
|
544
|
+
# Data pointer to pass to the file read function. If you use the
|
545
|
+
# CURLOPT_READFUNCTION option, this is the pointer you'll get as input.
|
546
|
+
# If you don't specify a read callback but instead rely on the default
|
547
|
+
# internal read function, this data must be a valid readable FILE *.
|
548
|
+
# If you're using libcurl as a win32 DLL, you MUST use a
|
549
|
+
# CURLOPT_READFUNCTION if you set this option.
|
550
|
+
# This option was also known by the older name CURLOPT_INFILE,
|
551
|
+
# the name CURLOPT_READDATA was introduced in 7.9.7.
|
301
552
|
#
|
302
553
|
# @example Set readdata option.
|
303
|
-
# easy.readdata =
|
554
|
+
# easy.readdata = value
|
304
555
|
#
|
305
556
|
# @param [ String ] value The value to set.
|
306
557
|
#
|
@@ -309,10 +560,33 @@ module Ethon
|
|
309
560
|
Curl.set_option(:readdata, value_for(value, :string), handle)
|
310
561
|
end
|
311
562
|
|
312
|
-
#
|
563
|
+
# Pass a pointer to a function that matches the following prototype:
|
564
|
+
# size_t function( void *ptr, size_t size, size_t nmemb, void
|
565
|
+
# *userdata); This function gets called by libcurl as soon as it needs
|
566
|
+
# to read data in order to send it to the peer. The data area pointed
|
567
|
+
# at by the pointer ptr may be filled with at most size multiplied with
|
568
|
+
# nmemb number of bytes. Your function must return the actual number of
|
569
|
+
# bytes that you stored in that memory area. Returning 0 will signal
|
570
|
+
# end-of-file to the library and cause it to stop the current transfer.
|
571
|
+
# If you stop the current transfer by returning 0 "pre-maturely" (i.e
|
572
|
+
# before the server expected it, like when you've said you will upload
|
573
|
+
# N bytes and you upload less than N bytes), you may experience that
|
574
|
+
# the server "hangs" waiting for the rest of the data that won't come.
|
575
|
+
# The read callback may return CURL_READFUNC_ABORT to stop the current
|
576
|
+
# operation immediately, resulting in a CURLE_ABORTED_BY_CALLBACK error
|
577
|
+
# code from the transfer (Added in 7.12.1)
|
578
|
+
# From 7.18.0, the function can return CURL_READFUNC_PAUSE which then
|
579
|
+
# will cause reading from this connection to become paused. See
|
580
|
+
# curl_easy_pause(3) for further details.
|
581
|
+
# Bugs: when doing TFTP uploads, you must return the exact amount of
|
582
|
+
# data that the callback wants, or it will be considered the final
|
583
|
+
# packet by the server end and the transfer will end there.
|
584
|
+
# If you set this callback pointer to NULL, or don't set it at all, the
|
585
|
+
# default internal read function will be used. It is doing an fread()
|
586
|
+
# on the FILE * userdata set with CURLOPT_READDATA.
|
313
587
|
#
|
314
588
|
# @example Set readfunction option.
|
315
|
-
# easy.readfunction =
|
589
|
+
# easy.readfunction = value
|
316
590
|
#
|
317
591
|
# @param [ String ] value The value to set.
|
318
592
|
#
|
@@ -321,7 +595,27 @@ module Ethon
|
|
321
595
|
Curl.set_option(:readfunction, value_for(value, :string), handle)
|
322
596
|
end
|
323
597
|
|
324
|
-
#
|
598
|
+
# Pass a long as parameter.
|
599
|
+
# This option determines whether libcurl verifies that the server cert
|
600
|
+
# is for the server it is known as.
|
601
|
+
# When negotiating a SSL connection, the server sends a certificate
|
602
|
+
# indicating its identity.
|
603
|
+
# When CURLOPT_SSL_VERIFYHOST is 2, that certificate must indicate that
|
604
|
+
# the server is the server to which you meant to connect, or the
|
605
|
+
# connection fails.
|
606
|
+
# Curl considers the server the intended one when the Common Name field
|
607
|
+
# or a Subject Alternate Name field in the certificate matches the host
|
608
|
+
# name in the URL to which you told Curl to connect.
|
609
|
+
# When the value is 1, the certificate must contain a Common Name
|
610
|
+
# field, but it doesn't matter what name it says. (This is not
|
611
|
+
# ordinarily a useful setting).
|
612
|
+
# When the value is 0, the connection succeeds regardless of the names
|
613
|
+
# in the certificate.
|
614
|
+
# The default value for this option is 2.
|
615
|
+
# This option controls checking the server's certificate's claimed
|
616
|
+
# identity. The server could be lying. To control lying, see
|
617
|
+
# CURLOPT_SSL_VERIFYPEER. If libcurl is built against NSS and
|
618
|
+
# CURLOPT_SSL_VERIFYPEER is zero, CURLOPT_SSL_VERIFYHOST is ignored.
|
325
619
|
#
|
326
620
|
# @example Set ssl_verifyhost option.
|
327
621
|
# easy.ssl_verifyhost = 1
|
@@ -333,7 +627,29 @@ module Ethon
|
|
333
627
|
Curl.set_option(:ssl_verifyhost, value_for(value, :int), handle)
|
334
628
|
end
|
335
629
|
|
336
|
-
#
|
630
|
+
# Pass a long as parameter. By default, curl assumes a value of 1.
|
631
|
+
# This option determines whether curl verifies the authenticity of the
|
632
|
+
# peer's certificate. A value of 1 means curl verifies; 0 (zero) means
|
633
|
+
# it doesn't.
|
634
|
+
# When negotiating a SSL connection, the server sends a certificate
|
635
|
+
# indicating its identity. Curl verifies whether the certificate is
|
636
|
+
# authentic, i.e. that you can trust that the server is who the
|
637
|
+
# certificate says it is. This trust is based on a chain of digital
|
638
|
+
# signatures, rooted in certification authority (CA) certificates you
|
639
|
+
# supply. curl uses a default bundle of CA certificates (the path for
|
640
|
+
# that is determined at build time) and you can specify alternate
|
641
|
+
# certificates with the CURLOPT_CAINFO option or the CURLOPT_CAPATH
|
642
|
+
# option.
|
643
|
+
# When CURLOPT_SSL_VERIFYPEER is nonzero, and the verification fails to
|
644
|
+
# prove that the certificate is authentic, the connection fails. When
|
645
|
+
# the option is zero, the peer certificate verification succeeds
|
646
|
+
# regardless.
|
647
|
+
# Authenticating the certificate is not by itself very useful. You
|
648
|
+
# typically want to ensure that the server, as authentically identified
|
649
|
+
# by its certificate, is the server you mean to be talking to. Use
|
650
|
+
# CURLOPT_SSL_VERIFYHOST to control that. The check that the host name
|
651
|
+
# in the certificate is valid for the host name you're connecting to is
|
652
|
+
# done independently of the CURLOPT_SSL_VERIFYPEER option.
|
337
653
|
#
|
338
654
|
# @example Set ssl_verifypeer option.
|
339
655
|
# easy.ssl_verifypeer = true
|
@@ -345,10 +661,16 @@ module Ethon
|
|
345
661
|
Curl.set_option(:ssl_verifypeer, value_for(value, :bool), handle)
|
346
662
|
end
|
347
663
|
|
348
|
-
#
|
664
|
+
# Pass a pointer to a zero terminated string as parameter. The string
|
665
|
+
# should be the file name of your certificate. The default format is
|
666
|
+
# "PEM" and can be changed with CURLOPT_SSLCERTTYPE.
|
667
|
+
# With NSS this can also be the nickname of the certificate you wish to
|
668
|
+
# authenticate with. If you want to use a file from the current
|
669
|
+
# directory, please precede it with "./" prefix, in order to avoid
|
670
|
+
# confusion with a nickname.
|
349
671
|
#
|
350
672
|
# @example Set sslcert option.
|
351
|
-
# easy.sslcert =
|
673
|
+
# easy.sslcert = "name"
|
352
674
|
#
|
353
675
|
# @param [ String ] value The value to set.
|
354
676
|
#
|
@@ -357,10 +679,12 @@ module Ethon
|
|
357
679
|
Curl.set_option(:sslcert, value_for(value, :string), handle)
|
358
680
|
end
|
359
681
|
|
360
|
-
#
|
682
|
+
# Pass a pointer to a zero terminated string as parameter. The string
|
683
|
+
# should be the format of your certificate. Supported formats are "PEM"
|
684
|
+
# and "DER". (Added in 7.9.3)
|
361
685
|
#
|
362
686
|
# @example Set sslcerttype option.
|
363
|
-
# easy.sslcerttype =
|
687
|
+
# easy.sslcerttype = "PEM"
|
364
688
|
#
|
365
689
|
# @param [ String ] value The value to set.
|
366
690
|
#
|
@@ -369,10 +693,12 @@ module Ethon
|
|
369
693
|
Curl.set_option(:sslcerttype, value_for(value, :string), handle)
|
370
694
|
end
|
371
695
|
|
372
|
-
#
|
696
|
+
# Pass a pointer to a zero terminated string as parameter. The string
|
697
|
+
# should be the file name of your private key. The default format is
|
698
|
+
# "PEM" and can be changed with CURLOPT_SSLKEYTYPE.
|
373
699
|
#
|
374
700
|
# @example Set sslkey option.
|
375
|
-
# easy.sslkey =
|
701
|
+
# easy.sslkey = "/path/to/file"
|
376
702
|
#
|
377
703
|
# @param [ String ] value The value to set.
|
378
704
|
#
|
@@ -381,10 +707,17 @@ module Ethon
|
|
381
707
|
Curl.set_option(:sslkey, value_for(value, :string), handle)
|
382
708
|
end
|
383
709
|
|
384
|
-
#
|
710
|
+
# Pass a pointer to a zero terminated string as parameter. The string
|
711
|
+
# should be the format of your private key. Supported formats are
|
712
|
+
# "PEM", "DER" and "ENG".
|
713
|
+
# The format "ENG" enables you to load the private key from a crypto
|
714
|
+
# engine. In this case CURLOPT_SSLKEY is used as an identifier passed
|
715
|
+
# to the engine. You have to set the crypto engine with
|
716
|
+
# CURLOPT_SSLENGINE. "DER" format key file currently does not work
|
717
|
+
# because of a bug in OpenSSL.
|
385
718
|
#
|
386
719
|
# @example Set sslkeytype option.
|
387
|
-
# easy.sslkeytype =
|
720
|
+
# easy.sslkeytype = "PEM"
|
388
721
|
#
|
389
722
|
# @param [ String ] value The value to set.
|
390
723
|
#
|
@@ -393,10 +726,12 @@ module Ethon
|
|
393
726
|
Curl.set_option(:sslkeytype, value_for(value, :string), handle)
|
394
727
|
end
|
395
728
|
|
729
|
+
# Pass a long as parameter to control what version of SSL/TLS to
|
730
|
+
# attempt to use. The available options are:
|
396
731
|
# Sets sslversion option.
|
397
732
|
#
|
398
733
|
# @example Set sslversion option.
|
399
|
-
# easy.sslversion =
|
734
|
+
# easy.sslversion = :sslv3
|
400
735
|
#
|
401
736
|
# @param [ $type_doc ] value The value to set.
|
402
737
|
#
|
@@ -405,7 +740,15 @@ module Ethon
|
|
405
740
|
Curl.set_option(:sslversion, value_for(value, :enum, :sslversion), handle)
|
406
741
|
end
|
407
742
|
|
408
|
-
#
|
743
|
+
# Pass a long as parameter containing the maximum time in seconds that
|
744
|
+
# you allow the libcurl transfer operation to take. Normally, name
|
745
|
+
# lookups can take a considerable time and limiting operations to less
|
746
|
+
# than a few minutes risk aborting perfectly normal operations. This
|
747
|
+
# option will cause curl to use the SIGALRM to enable time-outing
|
748
|
+
# system calls.
|
749
|
+
# In unix-like systems, this might cause signals to be used unless
|
750
|
+
# CURLOPT_NOSIGNAL is set.
|
751
|
+
# Default timeout is 0 (zero) which means it never times out.
|
409
752
|
#
|
410
753
|
# @example Set timeout option.
|
411
754
|
# easy.timeout = 1
|
@@ -417,7 +760,11 @@ module Ethon
|
|
417
760
|
Curl.set_option(:timeout, value_for(value, :int), handle)
|
418
761
|
end
|
419
762
|
|
420
|
-
#
|
763
|
+
# Like CURLOPT_TIMEOUT but takes number of milliseconds instead. If
|
764
|
+
# libcurl is built to use the standard system name resolver, that
|
765
|
+
# portion of the transfer will still use full-second resolution for
|
766
|
+
# timeouts with a minimum timeout allowed of one second. (Added in
|
767
|
+
# 7.16.2)
|
421
768
|
#
|
422
769
|
# @example Set timeout_ms option.
|
423
770
|
# easy.timeout_ms = 1
|
@@ -429,7 +776,18 @@ module Ethon
|
|
429
776
|
Curl.set_option(:timeout_ms, value_for(value, :int), handle)
|
430
777
|
end
|
431
778
|
|
432
|
-
#
|
779
|
+
# A parameter set to 1 tells the library to prepare for an upload. The
|
780
|
+
# CURLOPT_READDATA and CURLOPT_INFILESIZE or CURLOPT_INFILESIZE_LARGE
|
781
|
+
# options are also interesting for uploads. If the protocol is HTTP,
|
782
|
+
# uploading means using the PUT request unless you tell libcurl
|
783
|
+
# otherwise.
|
784
|
+
# Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue"
|
785
|
+
# header. You can disable this header with CURLOPT_HTTPHEADER as usual.
|
786
|
+
# If you use PUT to a HTTP 1.1 server, you can upload data without
|
787
|
+
# knowing the size before starting the transfer if you use chunked
|
788
|
+
# encoding. You enable this by adding a header like "Transfer-Encoding:
|
789
|
+
# chunked" with CURLOPT_HTTPHEADER. With HTTP 1.0 or without chunked
|
790
|
+
# transfer, you must specify the size.
|
433
791
|
#
|
434
792
|
# @example Set upload option.
|
435
793
|
# easy.upload = true
|
@@ -441,10 +799,153 @@ module Ethon
|
|
441
799
|
Curl.set_option(:upload, value_for(value, :bool), handle)
|
442
800
|
end
|
443
801
|
|
444
|
-
#
|
802
|
+
# Pass in a pointer to the actual URL to deal with. The parameter
|
803
|
+
# should be a string to a zero terminated string which must be
|
804
|
+
# URL-encoded in the following format:
|
805
|
+
# scheme://host:port/path
|
806
|
+
# For a greater explanation of the format please see RFC 3986.
|
807
|
+
# If the given URL lacks the scheme, or protocol, part ("http://" or
|
808
|
+
# "ftp://" etc), libcurl will attempt to resolve which protocol to use
|
809
|
+
# based on the given host mame. If the protocol is not supported,
|
810
|
+
# libcurl will return (CURLE_UNSUPPORTED_PROTOCOL) when you call
|
811
|
+
# curl_easy_perform(3) or curl_multi_perform(3). Use
|
812
|
+
# curl_version_info(3) for detailed information on which protocols are
|
813
|
+
# supported.
|
814
|
+
# The host part of the URL contains the address of the server that you
|
815
|
+
# want to connect to. This can be the fully qualified domain name of
|
816
|
+
# the server, the local network name of the machine on your network or
|
817
|
+
# the IP address of the server or machine represented by either an IPv4
|
818
|
+
# or IPv6 address. For example:
|
819
|
+
# http://www.example.com/
|
820
|
+
# http://hostname/
|
821
|
+
# http://192.168.0.1/
|
822
|
+
# http://[2001:1890:1112:1::20]/
|
823
|
+
# It is also possible to specify the user name and password as part of
|
824
|
+
# the host, for some protocols, when connecting to servers that require
|
825
|
+
# authentication.
|
826
|
+
# For example the following types of authentication support this:
|
827
|
+
# http://user:password@www.example.com
|
828
|
+
# ftp://user:password@ftp.example.com
|
829
|
+
# pop3://user:password@mail.example.com
|
830
|
+
# The port is optional and when not specified libcurl will use the
|
831
|
+
# default port based on the determined or specified protocol: 80 for
|
832
|
+
# HTTP, 21 for FTP and 25 for SMTP, etc. The following examples show
|
833
|
+
# how to specify the port:
|
834
|
+
# http://www.example.com:8080/ - This will connect to a web server
|
835
|
+
# using port 8080 rather than 80.
|
836
|
+
# smtp://mail.example.com:587/ - This will connect to a SMTP server on
|
837
|
+
# the alternative mail port.
|
838
|
+
# The path part of the URL is protocol specific and whilst some
|
839
|
+
# examples are given below this list is not conclusive:
|
840
|
+
# HTTP
|
841
|
+
# The path part of a HTTP request specifies the file to retrieve and
|
842
|
+
# from what directory. If the directory is not specified then the web
|
843
|
+
# server's root directory is used. If the file is omitted then the
|
844
|
+
# default document will be retrieved for either the directory specified
|
845
|
+
# or the root directory. The exact resource returned for each URL is
|
846
|
+
# entirely dependent on the server's configuration.
|
847
|
+
# http://www.example.com - This gets the main page from the web server.
|
848
|
+
# http://www.example.com/index.html - This returns the main page by
|
849
|
+
# explicitly requesting it.
|
850
|
+
# http://www.example.com/contactus/ - This returns the default document
|
851
|
+
# from the contactus directory.
|
852
|
+
# FTP
|
853
|
+
# The path part of an FTP request specifies the file to retrieve and
|
854
|
+
# from what directory. If the file part is omitted then libcurl
|
855
|
+
# downloads the directory listing for the directory specified. If the
|
856
|
+
# directory is omitted then the directory listing for the root / home
|
857
|
+
# directory will be returned.
|
858
|
+
# ftp://ftp.example.com - This retrieves the directory listing for the
|
859
|
+
# root directory.
|
860
|
+
# ftp://ftp.example.com/readme.txt - This downloads the file readme.txt
|
861
|
+
# from the root directory.
|
862
|
+
# ftp://ftp.example.com/libcurl/readme.txt - This downloads readme.txt
|
863
|
+
# from the libcurl directory.
|
864
|
+
# ftp://user:password@ftp.example.com/readme.txt - This retrieves the
|
865
|
+
# readme.txt file from the user's home directory. When a username and
|
866
|
+
# password is specified, everything that is specified in the path part
|
867
|
+
# is relative to the user's home directory. To retrieve files from the
|
868
|
+
# root directory or a directory underneath the root directory then the
|
869
|
+
# absolute path must be specified by prepending an additional forward
|
870
|
+
# slash to the beginning of the path.
|
871
|
+
# ftp://user:password@ftp.example.com//readme.txt - This retrieves the
|
872
|
+
# readme.txt from the root directory when logging in as a specified
|
873
|
+
# user.
|
874
|
+
# SMTP
|
875
|
+
# The path part of a SMTP request specifies the host name to present
|
876
|
+
# during communication with the mail server. If the path is omitted
|
877
|
+
# then libcurl will attempt to resolve the local computer's host name.
|
878
|
+
# However, this may not return the fully qualified domain name that is
|
879
|
+
# required by some mail servers and specifying this path allows you to
|
880
|
+
# set an alternative name, such as your machine's fully qualified
|
881
|
+
# domain name, which you might have obtained from an external function
|
882
|
+
# such as gethostname or getaddrinfo.
|
883
|
+
# smtp://mail.example.com - This connects to the mail server at
|
884
|
+
# example.com and sends your local computer's host name in the HELO /
|
885
|
+
# EHLO command.
|
886
|
+
# smtp://mail.example.com/client.example.com - This will send
|
887
|
+
# client.example.com in the HELO / EHLO command to the mail server at
|
888
|
+
# example.com.
|
889
|
+
# POP3
|
890
|
+
# The path part of a POP3 request specifies the mailbox (message) to
|
891
|
+
# retrieve. If the mailbox is not specified then a list of waiting
|
892
|
+
# messages is returned instead.
|
893
|
+
# pop3://user:password@mail.example.com - This lists the available
|
894
|
+
# messages pop3://user:password@mail.example.com/1 - This retrieves the
|
895
|
+
# first message
|
896
|
+
# SCP
|
897
|
+
# The path part of a SCP request specifies the file to retrieve and
|
898
|
+
# from what directory. The file part may not be omitted. The file is
|
899
|
+
# taken as an absolute path from the root directory on the server. To
|
900
|
+
# specify a path relative to the user's home directory on the server,
|
901
|
+
# prepend ~/ to the path portion. If the user name is not embedded in
|
902
|
+
# the URL, it can be set with the CURLOPT_USERPWD or CURLOPT_USERNAME
|
903
|
+
# option.
|
904
|
+
# scp://user@example.com/etc/issue - This specifies the file /etc/issue
|
905
|
+
# scp://example.com/~/my-file - This specifies the file my-file in the
|
906
|
+
# user's home directory on the server
|
907
|
+
# SFTP
|
908
|
+
# The path part of a SFTP request specifies the file to retrieve and
|
909
|
+
# from what directory. If the file part is omitted then libcurl
|
910
|
+
# downloads the directory listing for the directory specified. If the
|
911
|
+
# path ends in a / then a directory listing is returned instead of a
|
912
|
+
# file. If the path is omitted entirely then the directory listing for
|
913
|
+
# the root / home directory will be returned. If the user name is not
|
914
|
+
# embedded in the URL, it can be set with the CURLOPT_USERPWD or
|
915
|
+
# CURLOPT_USERNAME option.
|
916
|
+
# sftp://user:password@example.com/etc/issue - This specifies the file
|
917
|
+
# /etc/issue
|
918
|
+
# sftp://user@example.com/~/my-file - This specifies the file my-file
|
919
|
+
# in the user's home directory
|
920
|
+
# sftp://ssh.example.com/~/Documents/ - This requests a directory
|
921
|
+
# listing of the Documents directory under the user's home directory
|
922
|
+
# LDAP
|
923
|
+
# The path part of a LDAP request can be used to specify the:
|
924
|
+
# Distinguished Name, Attributes, Scope, Filter and Extension for a
|
925
|
+
# LDAP search. Each field is separated by a question mark and when that
|
926
|
+
# field is not required an empty string with the question mark
|
927
|
+
# separator should be included.
|
928
|
+
# ldap://ldap.example.com/o=My%20Organisation - This will perform a
|
929
|
+
# LDAP search with the DN as My Organisation.
|
930
|
+
# ldap://ldap.example.com/o=My%20Organisation?postalAddress - This will
|
931
|
+
# perform the same search but will only return postalAddress attributes.
|
932
|
+
# ldap://ldap.example.com/?rootDomainNamingContext - This specifies an
|
933
|
+
# empty DN and requests information about the rootDomainNamingContext
|
934
|
+
# attribute for an Active Directory server.
|
935
|
+
# For more information about the individual components of a LDAP URL
|
936
|
+
# please see RFC 4516.
|
937
|
+
# NOTES
|
938
|
+
# Starting with version 7.20.0, the fragment part of the URI will not
|
939
|
+
# be sent as part of the path, which was previously the case.
|
940
|
+
# CURLOPT_URL is the only option that must be set before
|
941
|
+
# curl_easy_perform(3) is called.
|
942
|
+
# CURLOPT_PROTOCOLS can be used to limit what protocols libcurl will
|
943
|
+
# use for this transfer, independent of what libcurl has been compiled
|
944
|
+
# to support. That may be useful if you accept the URL from an external
|
945
|
+
# source and want to limit the accessibility.
|
445
946
|
#
|
446
947
|
# @example Set url option.
|
447
|
-
# easy.url =
|
948
|
+
# easy.url = "www.example.com"
|
448
949
|
#
|
449
950
|
# @param [ String ] value The value to set.
|
450
951
|
#
|
@@ -454,10 +955,13 @@ module Ethon
|
|
454
955
|
Curl.set_option(:url, value_for(value, :string), handle)
|
455
956
|
end
|
456
957
|
|
457
|
-
#
|
958
|
+
# Pass a pointer to a zero terminated string as parameter. It will be
|
959
|
+
# used to set the User-Agent: header in the http request sent to the
|
960
|
+
# remote server. This can be used to fool servers or scripts. You can
|
961
|
+
# also set any custom header with CURLOPT_HTTPHEADER.
|
458
962
|
#
|
459
963
|
# @example Set useragent option.
|
460
|
-
# easy.useragent =
|
964
|
+
# easy.useragent = "UserAgent"
|
461
965
|
#
|
462
966
|
# @param [ String ] value The value to set.
|
463
967
|
#
|
@@ -466,10 +970,23 @@ module Ethon
|
|
466
970
|
Curl.set_option(:useragent, value_for(value, :string), handle)
|
467
971
|
end
|
468
972
|
|
469
|
-
#
|
973
|
+
# Pass a string as parameter, which should be [user name]:[password] to
|
974
|
+
# use for the connection. Use CURLOPT_HTTPAUTH to decide the
|
975
|
+
# authentication method.
|
976
|
+
# When using NTLM, you can set the domain by prepending it to the user
|
977
|
+
# name and separating the domain and name with a forward (/) or
|
978
|
+
# backward slash (\). Like this: "domain/user:password" or
|
979
|
+
# "domain\user:password". Some HTTP servers (on Windows) support this
|
980
|
+
# style even for Basic authentication.
|
981
|
+
# When using HTTP and CURLOPT_FOLLOWLOCATION, libcurl might perform
|
982
|
+
# several requests to possibly different hosts. libcurl will only send
|
983
|
+
# this user and password information to hosts using the initial host
|
984
|
+
# name (unless CURLOPT_UNRESTRICTED_AUTH is set), so if libcurl follows
|
985
|
+
# locations to other hosts it will not send the user and password to
|
986
|
+
# those. This is enforced to prevent accidental information leakage.
|
470
987
|
#
|
471
988
|
# @example Set userpwd option.
|
472
|
-
# easy.userpwd =
|
989
|
+
# easy.userpwd = "user:password"
|
473
990
|
#
|
474
991
|
# @param [ String ] value The value to set.
|
475
992
|
#
|
@@ -478,6 +995,13 @@ module Ethon
|
|
478
995
|
Curl.set_option(:userpwd, value_for(value, :string), handle)
|
479
996
|
end
|
480
997
|
|
998
|
+
# Set the parameter to 1 to get the library to display a lot of verbose
|
999
|
+
# information about its operations. Very useful for libcurl and/or
|
1000
|
+
# protocol debugging and understanding. The verbose information will be
|
1001
|
+
# sent to stderr, or the stream set with CURLOPT_STDERR.
|
1002
|
+
# You hardly ever want this set in production use, you will almost
|
1003
|
+
# always want this when you debug/report problems. Another neat option
|
1004
|
+
# for debugging is the CURLOPT_DEBUGFUNCTION.
|
481
1005
|
# Sets verbose option.
|
482
1006
|
#
|
483
1007
|
# @example Set verbose option.
|