curl_ffi 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +32 -0
- data/Rakefile +30 -0
- data/curl_ffi.gemspec +27 -17
- data/examples/evented_multi.rb +1 -1
- data/examples/perform_multi.rb +1 -1
- data/examples/select_multi.rb +1 -1
- data/lib/bindings.rb +985 -0
- data/lib/curl_ffi/version.rb +1 -1
- data/lib/curl_ffi.rb +2 -7
- data/spec/{curl → curl_ffi}/easy_spec.rb +14 -14
- data/spec/{curl → curl_ffi}/multi_spec.rb +17 -17
- data/spec/spec_helper.rb +5 -2
- metadata +10 -10
- data/lib/curl_ffi/curl_bindings.rb +0 -985
data/lib/bindings.rb
ADDED
@@ -0,0 +1,985 @@
|
|
1
|
+
module CurlFFI
|
2
|
+
extend FFI::Library
|
3
|
+
|
4
|
+
ffi_lib "libcurl"
|
5
|
+
|
6
|
+
# @todo This might have to be changed for different systems
|
7
|
+
typedef :long_long, :curl_off_t
|
8
|
+
|
9
|
+
if FFI::Platform.windows?
|
10
|
+
typedef :uint, :curl_socket_t
|
11
|
+
SOCKET_BAD = 4294967295
|
12
|
+
else
|
13
|
+
typedef :int, :curl_socket_t
|
14
|
+
SOCKET_BAD = -1
|
15
|
+
end
|
16
|
+
|
17
|
+
SOCKET_TIMEOUT = SOCKET_BAD
|
18
|
+
|
19
|
+
OPTION_LONG = 0
|
20
|
+
OPTION_OBJECTPOINT = 10000
|
21
|
+
OPTION_FUNCTIONPOINT = 20000
|
22
|
+
OPTION_OFF_T = 30000
|
23
|
+
|
24
|
+
INFO_STRING = 0x100000
|
25
|
+
INFO_LONG = 0x200000
|
26
|
+
INFO_DOUBLE = 0x300000
|
27
|
+
INFO_SLIST = 0x400000
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
CODE = enum :code, [
|
34
|
+
:OK, 0,
|
35
|
+
:UNSUPPORTED_PROTOCOL, 1,
|
36
|
+
:FAILED_INIT, 2,
|
37
|
+
:URL_MALFORMAT, 3,
|
38
|
+
|
39
|
+
:COULDNT_RESOLVE_PROXY, 5,
|
40
|
+
:COULDNT_RESOLVE_HOST, 6,
|
41
|
+
:COULDNT_CONNECT, 7,
|
42
|
+
:FTP_WEIRD_SERVER_REPLY, 8,
|
43
|
+
|
44
|
+
# a service was denied by the server due to lack of access when login fails this is not returned.
|
45
|
+
:REMOTE_ACCESS_DENIED, 9,
|
46
|
+
|
47
|
+
:FTP_WEIRD_PASS_REPLY, 11,
|
48
|
+
:FTP_WEIRD_PASV_REPLY, 13,
|
49
|
+
:FTP_WEIRD_227_FORMAT, 14,
|
50
|
+
:FTP_CANT_GET_HOST, 15,
|
51
|
+
:FTP_COULDNT_SET_TYPE, 17,
|
52
|
+
:PARTIAL_FILE, 18,
|
53
|
+
:FTP_COULDNT_RETR_FILE, 19,
|
54
|
+
# quote command failure
|
55
|
+
:QUOTE_ERROR, 21,
|
56
|
+
:HTTP_RETURNED_ERROR, 22,
|
57
|
+
:WRITE_ERROR, 23,
|
58
|
+
# failed upload "command"
|
59
|
+
:UPLOAD_FAILED, 25,
|
60
|
+
# couldn't open/read from file
|
61
|
+
:READ_ERROR, 26,
|
62
|
+
# Note: :OUT_OF_MEMORY may sometimes indicate a conversion error
|
63
|
+
# instead of a memory allocation error if CURL_DOES_CONVERSIONS
|
64
|
+
# is defined
|
65
|
+
:OUT_OF_MEMORY, 27,
|
66
|
+
|
67
|
+
:OPERATION_TIMEDOUT, 28,
|
68
|
+
:FTP_PORT_FAILED, 30,
|
69
|
+
:FTP_COULDNT_USE_REST, 31,
|
70
|
+
:RANGE_ERROR, 33,
|
71
|
+
:HTTP_POST_ERROR, 34,
|
72
|
+
:SSL_CONNECT_ERROR, 35,
|
73
|
+
:BAD_DOWNLOAD_RESUME, 36,
|
74
|
+
:FILE_COULDNT_READ_FILE, 37,
|
75
|
+
:LDAP_CANNOT_BIND, 38,
|
76
|
+
:LDAP_SEARCH_FAILED, 39,
|
77
|
+
:FUNCTION_NOT_FOUND, 41,
|
78
|
+
:ABORTED_BY_CALLBACK, 42,
|
79
|
+
:BAD_FUNCTION_ARGUMENT, 43,
|
80
|
+
:INTERFACE_FAILED, 45,
|
81
|
+
:TOO_MANY_REDIRECTS, 47,
|
82
|
+
:UNKNOWN_TELNET_OPTION, 48,
|
83
|
+
:TELNET_OPTION_SYNTAX, 49,
|
84
|
+
# peer's certificate or fingerprint wasn't verified fine
|
85
|
+
:PEER_FAILED_VERIFICATION, 51,
|
86
|
+
|
87
|
+
# when this is a specific error
|
88
|
+
:GOT_NOTHING, 52,
|
89
|
+
# SSL crypto engine not found
|
90
|
+
:SSL_ENGINE_NOTFOUND, 53,
|
91
|
+
# can not set SSL crypto engine as default
|
92
|
+
:SSL_ENGINE_SETFAILED, 54,
|
93
|
+
|
94
|
+
# failed sending network data
|
95
|
+
:SEND_ERROR, 55,
|
96
|
+
# failure in receiving network data
|
97
|
+
:RECV_ERROR, 56,
|
98
|
+
# problem with the local certificate
|
99
|
+
:SSL_CERTPROBLEM, 58,
|
100
|
+
# couldn't use specified cipher
|
101
|
+
:SSL_CIPHER, 59,
|
102
|
+
# problem with the CA cert (path?)
|
103
|
+
:SSL_CACERT, 60,
|
104
|
+
# Unrecognized transfer encoding
|
105
|
+
:BAD_CONTENT_ENCODING, 61,
|
106
|
+
# Invalid LDAP URL
|
107
|
+
:LDAP_INVALID_URL, 62,
|
108
|
+
# Maximum file size exceeded
|
109
|
+
:FILESIZE_EXCEEDED, 63,
|
110
|
+
# Requested FTP SSL level failed
|
111
|
+
:USE_SSL_FAILED, 64,
|
112
|
+
# Sending the data requires a rewind that failed
|
113
|
+
:SEND_FAIL_REWIND, 65,
|
114
|
+
|
115
|
+
# failed to initialise ENGINE
|
116
|
+
:SSL_ENGINE_INITFAILED, 66,
|
117
|
+
# user, password or similar was not accepted and we failed to login
|
118
|
+
:LOGIN_DENIED, 67,
|
119
|
+
|
120
|
+
# file not found on server
|
121
|
+
:TFTP_NOTFOUND, 68,
|
122
|
+
# permission problem on server
|
123
|
+
:TFTP_PERM, 69,
|
124
|
+
# out of disk space on server
|
125
|
+
:REMOTE_DISK_FULL, 70,
|
126
|
+
# Illegal TFTP operation
|
127
|
+
:TFTP_ILLEGAL, 71,
|
128
|
+
# Unknown transfer ID
|
129
|
+
:TFTP_UNKNOWNID, 72,
|
130
|
+
# File already exists
|
131
|
+
:REMOTE_FILE_EXISTS, 73,
|
132
|
+
# No such user
|
133
|
+
:TFTP_NOSUCHUSER, 74,
|
134
|
+
# conversion failed
|
135
|
+
:CONV_FAILED, 75,
|
136
|
+
# caller must register conversion callbacks using curl_easy_setopt options
|
137
|
+
# CURLOPT_CONV_FROM_NETWORK_FUNCTION,
|
138
|
+
# CURLOPT_CONV_TO_NETWORK_FUNCTION, and
|
139
|
+
# CURLOPT_CONV_FROM_UTF8_FUNCTION
|
140
|
+
:CONV_REQD, 76,
|
141
|
+
|
142
|
+
# could not load CACERT file, missing or wrong format
|
143
|
+
:SSL_CACERT_BADFILE, 77,
|
144
|
+
|
145
|
+
# remote file not found
|
146
|
+
:REMOTE_FILE_NOT_FOUND, 78,
|
147
|
+
|
148
|
+
# error from the SSH layer, somewhat generic so the error message will be of
|
149
|
+
# interest when this has happened
|
150
|
+
:SSH, 79,
|
151
|
+
|
152
|
+
# Failed to shut down the SSL connection
|
153
|
+
:SSL_SHUTDOWN_FAILED, 80,
|
154
|
+
|
155
|
+
# socket is not ready for send/recv, wait till it's ready and try again (Added in 7.18.2)
|
156
|
+
:AGAIN, 81,
|
157
|
+
|
158
|
+
# could not load CRL file, missing or wrong format (Added in 7.19.0)
|
159
|
+
:SSL_CRL_BADFILE, 82,
|
160
|
+
|
161
|
+
# Issuer check failed. (Added in 7.19.0)
|
162
|
+
:SSL_ISSUER_ERROR, 83,
|
163
|
+
# a PRET command failed
|
164
|
+
:FTP_PRET_FAILED, 84,
|
165
|
+
# mismatch of RTSP CSeq numbers
|
166
|
+
:RTSP_CSEQ_ERROR, 85,
|
167
|
+
# mismatch of RTSP Session Identifiers
|
168
|
+
:RTSP_SESSION_ERROR, 86,
|
169
|
+
# unable to parse FTP file list
|
170
|
+
:FTP_BAD_FILE_LIST, 87,
|
171
|
+
# chunk callback reported error
|
172
|
+
:CHUNK_FAILED, 88
|
173
|
+
]
|
174
|
+
|
175
|
+
MULTI_CODE = enum :multi_code, [
|
176
|
+
:CALL_MULTI_PERFORM, -1,
|
177
|
+
:OK, 0,
|
178
|
+
:BAD_HANDLE, 1,
|
179
|
+
:BAD_EASY_HANDLE, 2,
|
180
|
+
:OUT_OF_MEMORY, 3,
|
181
|
+
:INTERNAL_ERROR, 4,
|
182
|
+
:BAD_SOCKET, 5,
|
183
|
+
:UNKNOWN_OPTION, 6
|
184
|
+
]
|
185
|
+
|
186
|
+
MESSAGE = enum :message, [
|
187
|
+
:DONE, 1
|
188
|
+
]
|
189
|
+
|
190
|
+
OPTION = enum :option, [
|
191
|
+
# This is the FILE* or void* the regular output should be written to.
|
192
|
+
:FILE, OPTION_OBJECTPOINT + 1,
|
193
|
+
|
194
|
+
# The full URL to get/put
|
195
|
+
:URL, OPTION_OBJECTPOINT + 2,
|
196
|
+
|
197
|
+
# Port number to connect to, if other than default.
|
198
|
+
:PORT, OPTION_LONG + 3,
|
199
|
+
|
200
|
+
# Name of proxy to use.
|
201
|
+
:PROXY, OPTION_OBJECTPOINT + 4,
|
202
|
+
|
203
|
+
# "name:password" to use when fetching.
|
204
|
+
:USERPWD, OPTION_OBJECTPOINT + 5,
|
205
|
+
|
206
|
+
# "name:password" to use with proxy.
|
207
|
+
:PROXYUSERPWD, OPTION_OBJECTPOINT + 6,
|
208
|
+
|
209
|
+
# Range to get, specified as an ASCII string.
|
210
|
+
:RANGE, OPTION_OBJECTPOINT + 7,
|
211
|
+
|
212
|
+
# Specified file stream to upload from (use as input):
|
213
|
+
:INFILE, OPTION_OBJECTPOINT + 9,
|
214
|
+
|
215
|
+
# Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
|
216
|
+
# bytes big. If this is not used, error messages go to stderr instead:
|
217
|
+
:ERRORBUFFER, OPTION_OBJECTPOINT + 10,
|
218
|
+
|
219
|
+
# Function that will be called to store the output (instead of fwrite). The
|
220
|
+
# parameters will use fwrite() syntax, make sure to follow them.
|
221
|
+
:WRITEFUNCTION, OPTION_FUNCTIONPOINT + 11,
|
222
|
+
|
223
|
+
# Function that will be called to read the input (instead of fread). The
|
224
|
+
# parameters will use fread() syntax, make sure to follow them.
|
225
|
+
:READFUNCTION, OPTION_FUNCTIONPOINT + 12,
|
226
|
+
|
227
|
+
# Time-out the read operation after this amount of seconds
|
228
|
+
:TIMEOUT, OPTION_LONG + 13,
|
229
|
+
|
230
|
+
# If the CURLOPT_INFILE is used, this can be used to inform libcurl about
|
231
|
+
# how large the file being sent really is. That allows better error
|
232
|
+
# checking and better verifies that the upload was successful. -1 means
|
233
|
+
# unknown size.
|
234
|
+
#
|
235
|
+
# For large file support, there is also a _LARGE version of the key
|
236
|
+
# which takes an off_t type, allowing platforms with larger off_t
|
237
|
+
# sizes to handle larger files. See below for INFILESIZE_LARGE.
|
238
|
+
:INFILESIZE, OPTION_LONG + 14,
|
239
|
+
|
240
|
+
# POST static input fields.
|
241
|
+
:POSTFIELDS, OPTION_OBJECTPOINT + 15,
|
242
|
+
|
243
|
+
# Set the referrer page (needed by some CGIs)
|
244
|
+
:REFERER, OPTION_OBJECTPOINT + 16,
|
245
|
+
|
246
|
+
# Set the FTP PORT string (interface name, named or numerical IP address)
|
247
|
+
# Use i.e '-' to use default address.
|
248
|
+
:FTPPORT, OPTION_OBJECTPOINT + 17,
|
249
|
+
|
250
|
+
# Set the User-Agent string (examined by some CGIs)
|
251
|
+
:USERAGENT, OPTION_OBJECTPOINT + 18,
|
252
|
+
|
253
|
+
# If the download receives less than "low speed limit" bytes/second
|
254
|
+
# during "low speed time" seconds, the operations is aborted.
|
255
|
+
# You could i.e if you have a pretty high speed connection, abort if
|
256
|
+
# it is less than 2000 bytes/sec during 20 seconds.
|
257
|
+
|
258
|
+
# Set the "low speed limit"
|
259
|
+
:LOW_SPEED_LIMIT, OPTION_LONG + 19,
|
260
|
+
|
261
|
+
# Set the "low speed time"
|
262
|
+
:LOW_SPEED_TIME, OPTION_LONG + 20,
|
263
|
+
|
264
|
+
# Set the continuation offset.
|
265
|
+
#
|
266
|
+
# Note there is also a _LARGE version of this key which uses
|
267
|
+
# off_t types, allowing for large file offsets on platforms which
|
268
|
+
# use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
|
269
|
+
:RESUME_FROM, OPTION_LONG + 21,
|
270
|
+
|
271
|
+
# Set cookie in request:
|
272
|
+
:COOKIE, OPTION_OBJECTPOINT + 22,
|
273
|
+
|
274
|
+
# This points to a linked list of headers, struct curl_slist kind
|
275
|
+
:HTTPHEADER, OPTION_OBJECTPOINT + 23,
|
276
|
+
|
277
|
+
# This points to a linked list of post entries, struct curl_httppost
|
278
|
+
:HTTPPOST, OPTION_OBJECTPOINT + 24,
|
279
|
+
|
280
|
+
# name of the file keeping your private SSL-certificate
|
281
|
+
:SSLCERT, OPTION_OBJECTPOINT + 25,
|
282
|
+
|
283
|
+
# password for the SSL or SSH private key
|
284
|
+
:KEYPASSWD, OPTION_OBJECTPOINT + 26,
|
285
|
+
|
286
|
+
# send TYPE parameter?
|
287
|
+
:CRLF, OPTION_LONG + 27,
|
288
|
+
|
289
|
+
# send linked-list of QUOTE commands
|
290
|
+
:QUOTE, OPTION_OBJECTPOINT + 28,
|
291
|
+
|
292
|
+
# send FILE# or void# to store headers to, if you use a callback it
|
293
|
+
# is simply passed to the callback unmodified
|
294
|
+
:WRITEHEADER, OPTION_OBJECTPOINT + 29,
|
295
|
+
|
296
|
+
# point to a file to read the initial cookies from, also enables
|
297
|
+
# "cookie awareness"
|
298
|
+
:COOKIEFILE, OPTION_OBJECTPOINT + 31,
|
299
|
+
|
300
|
+
# What version to specifically try to use.
|
301
|
+
# See CURL_SSLVERSION defines below.
|
302
|
+
:SSLVERSION, OPTION_LONG + 32,
|
303
|
+
|
304
|
+
# What kind of HTTP time condition to use, see defines
|
305
|
+
:TIMECONDITION, OPTION_LONG + 33,
|
306
|
+
|
307
|
+
# Time to use with the above condition. Specified in number of seconds
|
308
|
+
# since 1 Jan 1970
|
309
|
+
:TIMEVALUE, OPTION_LONG + 34,
|
310
|
+
|
311
|
+
# Custom request, for customizing the get command like
|
312
|
+
# HTTP: DELETE, TRACE and others
|
313
|
+
# FTP: to use a different list command
|
314
|
+
:CUSTOMREQUEST, OPTION_OBJECTPOINT + 36,
|
315
|
+
|
316
|
+
# HTTP request, for odd commands like DELETE, TRACE and others
|
317
|
+
:STDERR, OPTION_OBJECTPOINT + 37,
|
318
|
+
|
319
|
+
# send linked-list of post-transfer QUOTE commands
|
320
|
+
:POSTQUOTE, OPTION_OBJECTPOINT + 39,
|
321
|
+
|
322
|
+
# Pass a pointer to string of the output using full variable-replacement
|
323
|
+
# as described elsewhere.
|
324
|
+
:WRITEINFO, OPTION_OBJECTPOINT + 40,
|
325
|
+
|
326
|
+
:VERBOSE, OPTION_LONG + 41, # talk a lot
|
327
|
+
:HEADER, OPTION_LONG + 42, # throw the header out too
|
328
|
+
:NOPROGRESS, OPTION_LONG + 43, # shut off the progress meter
|
329
|
+
:NOBODY, OPTION_LONG + 44, # use HEAD to get http document
|
330
|
+
:FAILONERROR, OPTION_LONG + 45, # no output on http error codes >= 300
|
331
|
+
:UPLOAD, OPTION_LONG + 46, # this is an upload
|
332
|
+
:POST, OPTION_LONG + 47, # HTTP POST method
|
333
|
+
:DIRLISTONLY, OPTION_LONG + 48, # return bare names when listing directories
|
334
|
+
|
335
|
+
:APPEND, OPTION_LONG + 50, # Append instead of overwrite on upload!
|
336
|
+
|
337
|
+
# Specify whether to read the user+password from the .netrc or the URL.
|
338
|
+
# This must be one of the CURL_NETRC_* enums below.
|
339
|
+
:NETRC, OPTION_LONG + 51,
|
340
|
+
|
341
|
+
:FOLLOWLOCATION, OPTION_LONG + 52, # use Location: Luke!
|
342
|
+
|
343
|
+
:TRANSFERTEXT, OPTION_LONG + 53, # transfer data in text/ASCII format
|
344
|
+
:PUT, OPTION_LONG + 54, # HTTP PUT
|
345
|
+
|
346
|
+
# 55 = OBSOLETE
|
347
|
+
|
348
|
+
# Function that will be called instead of the internal progress display
|
349
|
+
# function. This function should be defined as the curl_progress_callback
|
350
|
+
# prototype defines.
|
351
|
+
:PROGRESSFUNCTION, OPTION_FUNCTIONPOINT + 56,
|
352
|
+
|
353
|
+
# Data passed to the progress callback
|
354
|
+
:PROGRESSDATA, OPTION_OBJECTPOINT + 57,
|
355
|
+
|
356
|
+
# We want the referrer field set automatically when following locations
|
357
|
+
:AUTOREFERER, OPTION_LONG + 58,
|
358
|
+
|
359
|
+
# Port of the proxy, can be set in the proxy string as well with:
|
360
|
+
# "[host]:[port]"
|
361
|
+
:PROXYPORT, OPTION_LONG + 59,
|
362
|
+
|
363
|
+
# size of the POST input data, if strlen() is not good to use
|
364
|
+
:POSTFIELDSIZE, OPTION_LONG + 60,
|
365
|
+
|
366
|
+
# tunnel non-http operations through a HTTP proxy
|
367
|
+
:HTTPPROXYTUNNEL, OPTION_LONG + 61,
|
368
|
+
|
369
|
+
# Set the interface string to use as outgoing network interface
|
370
|
+
:INTERFACE, OPTION_OBJECTPOINT + 62,
|
371
|
+
|
372
|
+
# Set the krb4/5 security level, this also enables krb4/5 awareness. This
|
373
|
+
# is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
|
374
|
+
# is set but doesn't match one of these, 'private' will be used.
|
375
|
+
:KRBLEVEL, OPTION_OBJECTPOINT + 63,
|
376
|
+
|
377
|
+
# Set if we should verify the peer in ssl handshake, set 1 to verify.
|
378
|
+
:SSL_VERIFYPEER, OPTION_LONG + 64,
|
379
|
+
|
380
|
+
# The CApath or CAfile used to validate the peer certificate
|
381
|
+
# this option is used only if SSL_VERIFYPEER is true
|
382
|
+
:CAINFO, OPTION_OBJECTPOINT + 65,
|
383
|
+
|
384
|
+
# Maximum number of http redirects to follow
|
385
|
+
:MAXREDIRS, OPTION_LONG + 68,
|
386
|
+
|
387
|
+
# Pass a OPTION_long set to 1 to get the date of the requested document (if
|
388
|
+
# possible)! Pass a zero to shut it off.
|
389
|
+
:FILETIME, OPTION_LONG + 69,
|
390
|
+
|
391
|
+
# This points to a linked list of telnet options
|
392
|
+
:TELNETOPTIONS, OPTION_OBJECTPOINT + 70,
|
393
|
+
|
394
|
+
# Max amount of cached alive connections
|
395
|
+
:MAXCONNECTS, OPTION_LONG + 71,
|
396
|
+
|
397
|
+
# What policy to use when closing connections when the cache is filled up
|
398
|
+
:CLOSEPOLICY, OPTION_LONG + 72,
|
399
|
+
|
400
|
+
# Set to explicitly use a new connection for the upcoming transfer.
|
401
|
+
# Do not use this unless you're absolutely sure of this, as it makes the
|
402
|
+
# operation slower and is less friendly for the network.
|
403
|
+
:FRESH_CONNECT, OPTION_LONG + 74,
|
404
|
+
|
405
|
+
# Set to explicitly forbid the upcoming transfer's connection to be re-used
|
406
|
+
# when done. Do not use this unless you're absolutely sure of this, as it
|
407
|
+
# makes the operation slower and is less friendly for the network.
|
408
|
+
:FORBID_REUSE, OPTION_LONG + 75,
|
409
|
+
|
410
|
+
# Set to a file name that contains random data for libcurl to use to
|
411
|
+
# seed the random engine when doing SSL connects.
|
412
|
+
:RANDOM_FILE, OPTION_OBJECTPOINT + 76,
|
413
|
+
|
414
|
+
# Set to the Entropy Gathering Daemon socket pathname
|
415
|
+
:EGDSOCKET, OPTION_OBJECTPOINT + 77,
|
416
|
+
|
417
|
+
# Time-out connect operations after this amount of seconds, if connects
|
418
|
+
# are OK within this time, then fine... This only aborts the connect
|
419
|
+
# phase. [Only works on unix-style/SIGALRM operating systems]
|
420
|
+
:CONNECTTIMEOUT, OPTION_LONG + 78,
|
421
|
+
|
422
|
+
# Function that will be called to store headers (instead of fwrite). The
|
423
|
+
# parameters will use fwrite() syntax, make sure to follow them.
|
424
|
+
:HEADERFUNCTION, OPTION_FUNCTIONPOINT + 79,
|
425
|
+
|
426
|
+
# Set this to force the HTTP request to get back to GET. Only really usable
|
427
|
+
# if POST, PUT or a custom request have been used first.
|
428
|
+
:HTTPGET, OPTION_LONG + 80,
|
429
|
+
|
430
|
+
# Set if we should verify the Common name from the peer certificate in ssl
|
431
|
+
# handshake, set 1 to check existence, 2 to ensure that it matches the
|
432
|
+
# provided hostname.
|
433
|
+
:SSL_VERIFYHOST, OPTION_LONG + 81,
|
434
|
+
|
435
|
+
# Specify which file name to write all known cookies in after completed
|
436
|
+
# operation. Set file name to "-" (dash) to make it go to stdout.
|
437
|
+
:COOKIEJAR, OPTION_OBJECTPOINT + 82,
|
438
|
+
|
439
|
+
# Specify which SSL ciphers to use
|
440
|
+
:SSL_CIPHER_LIST, OPTION_OBJECTPOINT + 83,
|
441
|
+
|
442
|
+
# Specify which HTTP version to use! This must be set to one of the
|
443
|
+
# CURL_HTTP_VERSION* enums set below.
|
444
|
+
:HTTP_VERSION, OPTION_LONG + 84,
|
445
|
+
|
446
|
+
# Specifically switch on or off the FTP engine's use of the EPSV command. By
|
447
|
+
# default, that one will always be attempted before the more traditional
|
448
|
+
# PASV command.
|
449
|
+
:FTP_USE_EPSV, OPTION_LONG + 85,
|
450
|
+
|
451
|
+
# type of the file keeping your SSL-certificate ("DER", "PEM", "ENG")
|
452
|
+
:SSLCERTTYPE, OPTION_OBJECTPOINT + 86,
|
453
|
+
|
454
|
+
# name of the file keeping your private SSL-key
|
455
|
+
:SSLKEY, OPTION_OBJECTPOINT + 87,
|
456
|
+
|
457
|
+
# type of the file keeping your private SSL-key ("DER", "PEM", "ENG")
|
458
|
+
:SSLKEYTYPE, OPTION_OBJECTPOINT + 88,
|
459
|
+
|
460
|
+
# crypto engine for the SSL-sub system
|
461
|
+
:SSLENGINE, OPTION_OBJECTPOINT + 89,
|
462
|
+
|
463
|
+
# set the crypto engine for the SSL-sub system as default
|
464
|
+
# the param has no meaning...
|
465
|
+
:SSLENGINE_DEFAULT, OPTION_LONG + 90,
|
466
|
+
|
467
|
+
# Non-zero value means to use the global dns cache
|
468
|
+
:DNS_USE_GLOBAL_CACHE, OPTION_LONG + 91, # To become OBSOLETE soon
|
469
|
+
|
470
|
+
# DNS cache timeout
|
471
|
+
:DNS_CACHE_TIMEOUT, OPTION_LONG + 92,
|
472
|
+
|
473
|
+
# send linked-list of pre-transfer QUOTE commands
|
474
|
+
:PREQUOTE, OPTION_OBJECTPOINT + 93,
|
475
|
+
|
476
|
+
# set the debug function
|
477
|
+
:DEBUGFUNCTION, OPTION_FUNCTIONPOINT + 94,
|
478
|
+
|
479
|
+
# set the data for the debug function
|
480
|
+
:DEBUGDATA, OPTION_OBJECTPOINT + 95,
|
481
|
+
|
482
|
+
# mark this as start of a cookie session
|
483
|
+
:COOKIESESSION, OPTION_LONG + 96,
|
484
|
+
|
485
|
+
# The CApath directory used to validate the peer certificate
|
486
|
+
# this option is used only if SSL_VERIFYPEER is true
|
487
|
+
:CAPATH, OPTION_OBJECTPOINT + 97,
|
488
|
+
|
489
|
+
# Instruct libcurl to use a smaller receive buffer
|
490
|
+
:BUFFERSIZE, OPTION_LONG + 98,
|
491
|
+
|
492
|
+
# Instruct libcurl to not use any signal/alarm handlers, even when using
|
493
|
+
# timeouts. This option is useful for multi-threaded applications.
|
494
|
+
# See libcurl-the-guide for more background information.
|
495
|
+
:NOSIGNAL, OPTION_LONG + 99,
|
496
|
+
|
497
|
+
# Provide a CURLShare for mutexing non-ts data
|
498
|
+
:SHARE, OPTION_OBJECTPOINT + 100,
|
499
|
+
|
500
|
+
# indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
|
501
|
+
# CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5.
|
502
|
+
:PROXYTYPE, OPTION_LONG + 101,
|
503
|
+
|
504
|
+
# Set the Accept-Encoding string. Use this to tell a server you would like
|
505
|
+
# the response to be compressed.
|
506
|
+
:ENCODING, OPTION_OBJECTPOINT + 102,
|
507
|
+
|
508
|
+
# Set pointer to private data
|
509
|
+
:PRIVATE, OPTION_OBJECTPOINT + 103,
|
510
|
+
|
511
|
+
# Set aliases for HTTP 200 in the HTTP Response header
|
512
|
+
:HTTP200ALIASES, OPTION_OBJECTPOINT + 104,
|
513
|
+
|
514
|
+
# Continue to send authentication (user+password) when following locations,
|
515
|
+
# even when hostname changed. This can potentially send off the name
|
516
|
+
# and password to whatever host the server decides.
|
517
|
+
:UNRESTRICTED_AUTH, OPTION_LONG + 105,
|
518
|
+
|
519
|
+
# Specifically switch on or off the FTP engine's use of the EPRT command ( it
|
520
|
+
# also disables the LPRT attempt). By default, those ones will always be
|
521
|
+
# attempted before the good old traditional PORT command.
|
522
|
+
:FTP_USE_EPRT, OPTION_LONG + 106,
|
523
|
+
|
524
|
+
# Set this to a bitmask value to enable the particular authentications
|
525
|
+
# methods you like. Use this in combination with CURLOPT_USERPWD.
|
526
|
+
# Note that setting multiple bits may cause extra network round-trips.
|
527
|
+
:HTTPAUTH, OPTION_LONG + 107,
|
528
|
+
|
529
|
+
# Set the ssl context callback function, currently only for OpenSSL ssl_ctx
|
530
|
+
# in second argument. The function must be matching the
|
531
|
+
# curl_ssl_ctx_callback proto.
|
532
|
+
:SSL_CTX_FUNCTION, OPTION_FUNCTIONPOINT + 108,
|
533
|
+
|
534
|
+
# Set the userdata for the ssl context callback function's third
|
535
|
+
# argument
|
536
|
+
:SSL_CTX_DATA, OPTION_OBJECTPOINT + 109,
|
537
|
+
|
538
|
+
# FTP Option that causes missing dirs to be created on the remote server.
|
539
|
+
# In 7.19.4 we introduced the convenience enums for this option using the
|
540
|
+
# CURLFTP_CREATE_DIR prefix.
|
541
|
+
:FTP_CREATE_MISSING_DIRS, OPTION_LONG + 110,
|
542
|
+
|
543
|
+
# Set this to a bitmask value to enable the particular authentications
|
544
|
+
# methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
|
545
|
+
# Note that setting multiple bits may cause extra network round-trips.
|
546
|
+
:PROXYAUTH, OPTION_LONG + 111,
|
547
|
+
|
548
|
+
# FTP option that changes the timeout, in seconds, associated with
|
549
|
+
# getting a response. This is different from transfer timeout time and
|
550
|
+
# essentially places a demand on the FTP server to acknowledge commands
|
551
|
+
# in a timely manner.
|
552
|
+
:FTP_RESPONSE_TIMEOUT, OPTION_LONG + 112,
|
553
|
+
:CURLOPT_SERVER_RESPONSE_TIMEOUT, OPTION_LONG + 112,
|
554
|
+
|
555
|
+
# Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
|
556
|
+
# tell libcurl to resolve names to those IP versions only. This only has
|
557
|
+
# affect on systems with support for more than one, i.e IPv4 _and_ IPv6.
|
558
|
+
:IPRESOLVE, OPTION_LONG + 113,
|
559
|
+
|
560
|
+
# Set this option to limit the size of a file that will be downloaded from
|
561
|
+
# an HTTP or FTP server.
|
562
|
+
|
563
|
+
# Note there is also _LARGE version which adds large file support for
|
564
|
+
# platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below.
|
565
|
+
:MAXFILESIZE, OPTION_LONG + 114,
|
566
|
+
|
567
|
+
# See the comment for INFILESIZE above, but in short, specifies
|
568
|
+
# the size of the file being uploaded. -1 means unknown.
|
569
|
+
:INFILESIZE_LARGE, OPTION_OFF_T + 115,
|
570
|
+
|
571
|
+
# Sets the continuation offset. There is also a OPTION_LONG version of this;
|
572
|
+
# look above for RESUME_FROM.
|
573
|
+
:RESUME_FROM_LARGE, OPTION_OFF_T + 116,
|
574
|
+
|
575
|
+
# Sets the maximum size of data that will be downloaded from
|
576
|
+
# an HTTP or FTP server. See MAXFILESIZE above for the OPTION_LONG version.
|
577
|
+
|
578
|
+
:MAXFILESIZE_LARGE, OPTION_OFF_T + 117,
|
579
|
+
|
580
|
+
# Set this option to the file name of your .netrc file you want libcurl
|
581
|
+
# to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
|
582
|
+
# a poor attempt to find the user's home directory and check for a .netrc
|
583
|
+
# file in there.
|
584
|
+
:NETRC_FILE, OPTION_OBJECTPOINT + 118,
|
585
|
+
|
586
|
+
# Enable SSL/TLS for FTP, pick one of:
|
587
|
+
# CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise
|
588
|
+
# CURLFTPSSL_CONTROL - SSL for the control connection or fail
|
589
|
+
# CURLFTPSSL_ALL - SSL for all communication or fail
|
590
|
+
|
591
|
+
:USE_SSL, OPTION_LONG + 119,
|
592
|
+
|
593
|
+
# The _LARGE version of the standard POSTFIELDSIZE option
|
594
|
+
:POSTFIELDSIZE_LARGE, OPTION_OFF_T + 120,
|
595
|
+
|
596
|
+
# Enable/disable the TCP Nagle algorithm
|
597
|
+
:TCP_NODELAY, OPTION_LONG + 121,
|
598
|
+
|
599
|
+
# When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
|
600
|
+
# can be used to change libcurl's default action which is to first try
|
601
|
+
# "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
|
602
|
+
# response has been received.
|
603
|
+
#
|
604
|
+
# Available parameters are:
|
605
|
+
# CURLFTPAUTH_DEFAULT - let libcurl decide
|
606
|
+
# CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
|
607
|
+
# CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
|
608
|
+
:FTPSSLAUTH, OPTION_LONG + 129,
|
609
|
+
|
610
|
+
:IOCTLFUNCTION, OPTION_FUNCTIONPOINT + 130,
|
611
|
+
:IOCTLDATA, OPTION_OBJECTPOINT + 131,
|
612
|
+
|
613
|
+
# zero terminated string for pass on to the FTP server when asked for
|
614
|
+
# "account" info
|
615
|
+
:FTP_ACCOUNT, OPTION_OBJECTPOINT + 134,
|
616
|
+
|
617
|
+
# feed cookies into cookie engine
|
618
|
+
:COOKIELIST, OPTION_OBJECTPOINT + 135,
|
619
|
+
|
620
|
+
# ignore Content-Length
|
621
|
+
:IGNORE_CONTENT_LENGTH, OPTION_LONG + 136,
|
622
|
+
|
623
|
+
# Set to non-zero to skip the IP address received in a 227 PASV FTP server
|
624
|
+
# response. Typically used for FTP-SSL purposes but is not restricted to
|
625
|
+
# that. libcurl will then instead use the same IP address it used for the
|
626
|
+
# control connection.
|
627
|
+
:FTP_SKIP_PASV_IP, OPTION_LONG + 137,
|
628
|
+
|
629
|
+
# Select "file method" to use when doing FTP, see the curl_ftpmethod
|
630
|
+
# above.
|
631
|
+
:FTP_FILEMETHOD, OPTION_LONG + 138,
|
632
|
+
|
633
|
+
# Local port number to bind the socket to
|
634
|
+
:LOCALPORT, OPTION_LONG + 139,
|
635
|
+
|
636
|
+
# Number of ports to try, including the first one set with LOCALPORT.
|
637
|
+
# Thus, setting it to 1 will make no additional attempts but the first.
|
638
|
+
|
639
|
+
:LOCALPORTRANGE, OPTION_LONG + 140,
|
640
|
+
|
641
|
+
# no transfer, set up connection and let application use the socket by
|
642
|
+
# extracting it with CURLINFO_LASTSOCKET
|
643
|
+
:CONNECT_ONLY, OPTION_LONG + 141,
|
644
|
+
|
645
|
+
# Function that will be called to convert from the
|
646
|
+
# network encoding (instead of using the iconv calls in libcurl)
|
647
|
+
:CONV_FROM_NETWORK_FUNCTION, OPTION_FUNCTIONPOINT + 142,
|
648
|
+
|
649
|
+
# Function that will be called to convert to the
|
650
|
+
# network encoding (instead of using the iconv calls in libcurl)
|
651
|
+
:CONV_TO_NETWORK_FUNCTION, OPTION_FUNCTIONPOINT + 143,
|
652
|
+
|
653
|
+
# Function that will be called to convert from UTF8
|
654
|
+
# (instead of using the iconv calls in libcurl)
|
655
|
+
# Note that this is used only for SSL certificate processing
|
656
|
+
:CONV_FROM_UTF8_FUNCTION, OPTION_FUNCTIONPOINT + 144,
|
657
|
+
|
658
|
+
# if the connection proceeds too quickly then need to slow it down
|
659
|
+
# limit-rate: maximum number of bytes per second to send or receive
|
660
|
+
:MAX_SEND_SPEED_LARGE, OPTION_OFF_T + 145,
|
661
|
+
:MAX_RECV_SPEED_LARGE, OPTION_OFF_T + 146,
|
662
|
+
|
663
|
+
# Pointer to command string to send if USER/PASS fails.
|
664
|
+
:FTP_ALTERNATIVE_TO_USER, OPTION_OBJECTPOINT + 147,
|
665
|
+
|
666
|
+
# callback function for setting socket options
|
667
|
+
:SOCKOPTFUNCTION, OPTION_FUNCTIONPOINT + 148,
|
668
|
+
:SOCKOPTDATA, OPTION_OBJECTPOINT + 149,
|
669
|
+
|
670
|
+
# set to 0 to disable session ID re-use for this transfer, default is
|
671
|
+
# enabled (== 1)
|
672
|
+
:SSL_SESSIONID_CACHE, OPTION_LONG + 150,
|
673
|
+
|
674
|
+
# allowed SSH authentication methods
|
675
|
+
:SSH_AUTH_TYPES, OPTION_LONG + 151,
|
676
|
+
|
677
|
+
# Used by scp/sftp to do public/private key authentication
|
678
|
+
:SSH_PUBLIC_KEYFILE, OPTION_OBJECTPOINT + 152,
|
679
|
+
:SSH_PRIVATE_KEYFILE, OPTION_OBJECTPOINT + 153,
|
680
|
+
|
681
|
+
# Send CCC (Clear Command Channel) after authentication
|
682
|
+
:FTP_SSL_CCC, OPTION_LONG + 154,
|
683
|
+
|
684
|
+
# Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution
|
685
|
+
:TIMEOUT_MS, OPTION_LONG + 155,
|
686
|
+
:CONNECTTIMEOUT_MS, OPTION_LONG + 156,
|
687
|
+
|
688
|
+
# set to zero to disable the libcurl's decoding and thus pass the raw body
|
689
|
+
# data to the application even when it is encoded/compressed
|
690
|
+
:HTTP_TRANSFER_DECODING, OPTION_LONG + 157,
|
691
|
+
:HTTP_CONTENT_DECODING, OPTION_LONG + 158,
|
692
|
+
|
693
|
+
# Permission used when creating new files and directories on the remote
|
694
|
+
# server for protocols that support it, SFTP/SCP/FILE
|
695
|
+
:NEW_FILE_PERMS, OPTION_LONG + 159,
|
696
|
+
:NEW_DIRECTORY_PERMS, OPTION_LONG + 160,
|
697
|
+
|
698
|
+
# Set the behaviour of POST when redirecting. Values must be set to one
|
699
|
+
# of CURL_REDIR* defines below. This used to be called CURLOPT_POST301
|
700
|
+
:POSTREDIR, OPTION_LONG + 161,
|
701
|
+
|
702
|
+
# used by scp/sftp to verify the host's public key
|
703
|
+
:SSH_HOST_PUBLIC_KEY_MD5, OPTION_OBJECTPOINT + 162,
|
704
|
+
|
705
|
+
# Callback function for opening socket (instead of socket(2)). Optionally,
|
706
|
+
# callback is able change the address or refuse to connect returning
|
707
|
+
# CURL_SOCKET_BAD. The callback should have type
|
708
|
+
# curl_opensocket_callback
|
709
|
+
:OPENSOCKETFUNCTION, OPTION_FUNCTIONPOINT + 163,
|
710
|
+
:OPENSOCKETDATA, OPTION_OBJECTPOINT + 164,
|
711
|
+
|
712
|
+
# POST volatile input fields.
|
713
|
+
:COPYPOSTFIELDS, OPTION_OBJECTPOINT + 165,
|
714
|
+
|
715
|
+
# set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy
|
716
|
+
:PROXY_TRANSFER_MODE, OPTION_LONG + 166,
|
717
|
+
|
718
|
+
# Callback function for seeking in the input stream
|
719
|
+
:SEEKFUNCTION, OPTION_FUNCTIONPOINT + 167,
|
720
|
+
:SEEKDATA, OPTION_OBJECTPOINT + 168,
|
721
|
+
|
722
|
+
# CRL file
|
723
|
+
:CRLFILE, OPTION_OBJECTPOINT + 169,
|
724
|
+
|
725
|
+
# Issuer certificate
|
726
|
+
:ISSUERCERT, OPTION_OBJECTPOINT + 170,
|
727
|
+
|
728
|
+
# (IPv6) Address scope
|
729
|
+
:ADDRESS_SCOPE, OPTION_LONG + 171,
|
730
|
+
|
731
|
+
# Collect certificate chain info and allow it to get retrievable with
|
732
|
+
# CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
|
733
|
+
# working with OpenSSL-powered builds.
|
734
|
+
:CERTINFO, OPTION_LONG + 172,
|
735
|
+
|
736
|
+
# "name" and "pwd" to use when fetching.
|
737
|
+
:USERNAME, OPTION_OBJECTPOINT + 173,
|
738
|
+
:PASSWORD, OPTION_OBJECTPOINT + 174,
|
739
|
+
|
740
|
+
# "name" and "pwd" to use with Proxy when fetching.
|
741
|
+
:PROXYUSERNAME, OPTION_OBJECTPOINT + 175,
|
742
|
+
:PROXYPASSWORD, OPTION_OBJECTPOINT + 176,
|
743
|
+
|
744
|
+
# Comma separated list of hostnames defining no-proxy zones. These should
|
745
|
+
# match both hostnames directly, and hostnames within a domain. For
|
746
|
+
# example, local.com will match local.com and www.local.com, but NOT
|
747
|
+
# notlocal.com or www.notlocal.com. For compatibility with other
|
748
|
+
# implementations of this, .local.com will be considered to be the same as
|
749
|
+
# local.com. A single# is the only valid wildcard, and effectively
|
750
|
+
# disables the use of proxy.
|
751
|
+
:NOPROXY, OPTION_OBJECTPOINT + 177,
|
752
|
+
|
753
|
+
# block size for TFTP transfers
|
754
|
+
:TFTP_BLKSIZE, OPTION_LONG + 178,
|
755
|
+
|
756
|
+
# Socks Service
|
757
|
+
:SOCKS5_GSSAPI_SERVICE, OPTION_OBJECTPOINT + 179,
|
758
|
+
|
759
|
+
# Socks Service
|
760
|
+
:SOCKS5_GSSAPI_NEC, OPTION_LONG + 180,
|
761
|
+
|
762
|
+
# set the bitmask for the protocols that are allowed to be used for the
|
763
|
+
# transfer, which thus helps the app which takes URLs from users or other
|
764
|
+
# external inputs and want to restrict what protocol(s) to deal
|
765
|
+
# with. Defaults to CURLPROTO_ALL.
|
766
|
+
:PROTOCOLS, OPTION_LONG + 181,
|
767
|
+
|
768
|
+
# set the bitmask for the protocols that libcurl is allowed to follow to,
|
769
|
+
# as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
|
770
|
+
# to be set in both bitmasks to be allowed to get redirected to. Defaults
|
771
|
+
# to all protocols except FILE and SCP.
|
772
|
+
:REDIR_PROTOCOLS, OPTION_LONG + 182,
|
773
|
+
|
774
|
+
# set the SSH knownhost file name to use
|
775
|
+
:SSH_KNOWNHOSTS, OPTION_OBJECTPOINT + 183,
|
776
|
+
|
777
|
+
# set the SSH host key callback, must point to a curl_sshkeycallback
|
778
|
+
# function
|
779
|
+
:SSH_KEYFUNCTION, OPTION_FUNCTIONPOINT + 184,
|
780
|
+
|
781
|
+
# set the SSH host key callback custom pointer
|
782
|
+
:SSH_KEYDATA, OPTION_OBJECTPOINT + 185,
|
783
|
+
|
784
|
+
# set the SMTP mail originator
|
785
|
+
:MAIL_FROM, OPTION_OBJECTPOINT + 186,
|
786
|
+
|
787
|
+
# set the SMTP mail receiver(s)
|
788
|
+
:MAIL_RCPT, OPTION_OBJECTPOINT + 187,
|
789
|
+
|
790
|
+
# FTP: send PRET before PASV
|
791
|
+
:FTP_USE_PRET, OPTION_LONG + 188,
|
792
|
+
|
793
|
+
# RTSP request method (OPTIONS, SETUP, PLAY, etc...)
|
794
|
+
:RTSP_REQUEST, OPTION_LONG + 189,
|
795
|
+
|
796
|
+
# The RTSP session identifier
|
797
|
+
:RTSP_SESSION_ID, OPTION_OBJECTPOINT + 190,
|
798
|
+
|
799
|
+
# The RTSP stream URI
|
800
|
+
:RTSP_STREAM_URI, OPTION_OBJECTPOINT + 191,
|
801
|
+
|
802
|
+
# The Transport: header to use in RTSP requests
|
803
|
+
:RTSP_TRANSPORT, OPTION_OBJECTPOINT + 192,
|
804
|
+
|
805
|
+
# Manually initialize the client RTSP CSeq for this handle
|
806
|
+
:RTSP_CLIENT_CSEQ, OPTION_LONG + 193,
|
807
|
+
|
808
|
+
# Manually initialize the server RTSP CSeq for this handle
|
809
|
+
:RTSP_SERVER_CSEQ, OPTION_LONG + 194,
|
810
|
+
|
811
|
+
# The stream to pass to INTERLEAVEFUNCTION.
|
812
|
+
:INTERLEAVEDATA, OPTION_OBJECTPOINT + 195,
|
813
|
+
|
814
|
+
# Let the application define a custom write method for RTP data
|
815
|
+
:INTERLEAVEFUNCTION, OPTION_FUNCTIONPOINT + 196,
|
816
|
+
|
817
|
+
# Turn on wildcard matching
|
818
|
+
:WILDCARDMATCH, OPTION_LONG + 197,
|
819
|
+
|
820
|
+
# Directory matching callback called before downloading of an
|
821
|
+
# individual file (chunk) started
|
822
|
+
:CHUNK_BGN_FUNCTION, OPTION_FUNCTIONPOINT + 198,
|
823
|
+
|
824
|
+
# Directory matching callback called after the file (chunk)
|
825
|
+
# was downloaded, or skipped
|
826
|
+
:CHUNK_END_FUNCTION, OPTION_FUNCTIONPOINT + 199,
|
827
|
+
|
828
|
+
# Change match (fnmatch-like) callback for wildcard matching
|
829
|
+
:FNMATCH_FUNCTION, OPTION_FUNCTIONPOINT + 200,
|
830
|
+
|
831
|
+
# Let the application define custom chunk data pointer
|
832
|
+
:CHUNK_DATA, OPTION_OBJECTPOINT + 201,
|
833
|
+
|
834
|
+
# FNMATCH_FUNCTION user pointer
|
835
|
+
:FNMATCH_DATA, OPTION_OBJECTPOINT + 202,
|
836
|
+
]
|
837
|
+
|
838
|
+
MULTI_OPTION = enum :multi_option, [
|
839
|
+
:SOCKETFUNCTION, 1 + OPTION_FUNCTIONPOINT,
|
840
|
+
:SOCKETDATA, 2 + OPTION_OBJECTPOINT,
|
841
|
+
:PIPELINING, 3 + OPTION_LONG,
|
842
|
+
:TIMERFUNCTION, 4 + OPTION_FUNCTIONPOINT,
|
843
|
+
:TIMERDATA, 5 + OPTION_OBJECTPOINT,
|
844
|
+
:MAXCONNECTS, 6 + OPTION_LONG
|
845
|
+
]
|
846
|
+
|
847
|
+
INFO = enum :info, [
|
848
|
+
:EFFECTIVE_URL, INFO_STRING + 1,
|
849
|
+
:RESPONSE_CODE, INFO_LONG + 2,
|
850
|
+
:TOTAL_TIME, INFO_DOUBLE + 3,
|
851
|
+
:NAMELOOKUP_TIME, INFO_DOUBLE + 4,
|
852
|
+
:CONNECT_TIME, INFO_DOUBLE + 5,
|
853
|
+
:PRETRANSFER_TIME, INFO_DOUBLE + 6,
|
854
|
+
:SIZE_UPLOAD, INFO_DOUBLE + 7,
|
855
|
+
:SIZE_DOWNLOAD, INFO_DOUBLE + 8,
|
856
|
+
:SPEED_DOWNLOAD, INFO_DOUBLE + 9,
|
857
|
+
:SPEED_UPLOAD, INFO_DOUBLE + 10,
|
858
|
+
:HEADER_SIZE, INFO_LONG + 11,
|
859
|
+
:REQUEST_SIZE, INFO_LONG + 12,
|
860
|
+
:SSL_VERIFYRESULT, INFO_LONG + 13,
|
861
|
+
:FILETIME, INFO_LONG + 14,
|
862
|
+
:CONTENT_LENGTH_DOWNLOAD, INFO_DOUBLE + 15,
|
863
|
+
:CONTENT_LENGTH_UPLOAD, INFO_DOUBLE + 16,
|
864
|
+
:STARTTRANSFER_TIME, INFO_DOUBLE + 17,
|
865
|
+
:CONTENT_TYPE, INFO_STRING + 18,
|
866
|
+
:REDIRECT_TIME, INFO_DOUBLE + 19,
|
867
|
+
:REDIRECT_COUNT, INFO_LONG + 20,
|
868
|
+
:PRIVATE, INFO_STRING + 21,
|
869
|
+
:HTTP_CONNECTCODE, INFO_LONG + 22,
|
870
|
+
:HTTPAUTH_AVAIL, INFO_LONG + 23,
|
871
|
+
:PROXYAUTH_AVAIL, INFO_LONG + 24,
|
872
|
+
:OS_ERRNO, INFO_LONG + 25,
|
873
|
+
:NUM_CONNECTS, INFO_LONG + 26,
|
874
|
+
:SSL_ENGINES, INFO_SLIST + 27,
|
875
|
+
:COOKIELIST, INFO_SLIST + 28,
|
876
|
+
:LASTSOCKET, INFO_LONG + 29,
|
877
|
+
:FTP_ENTRY_PATH, INFO_STRING + 30,
|
878
|
+
:REDIRECT_URL, INFO_STRING + 31,
|
879
|
+
:PRIMARY_IP, INFO_STRING + 32,
|
880
|
+
:APPCONNECT_TIME, INFO_DOUBLE + 33,
|
881
|
+
:CERTINFO, INFO_SLIST + 34,
|
882
|
+
:CONDITION_UNMET, INFO_LONG + 35,
|
883
|
+
:RTSP_SESSION_ID, INFO_STRING + 36,
|
884
|
+
:RTSP_CLIENT_CSEQ, INFO_LONG + 37,
|
885
|
+
:RTSP_SERVER_CSEQ, INFO_LONG + 38,
|
886
|
+
:RTSP_CSEQ_RECV, INFO_LONG + 39,
|
887
|
+
:PRIMARY_PORT, INFO_LONG + 40,
|
888
|
+
:LOCAL_IP, INFO_STRING + 41,
|
889
|
+
:LOCAL_PORT, INFO_LONG + 42
|
890
|
+
]
|
891
|
+
|
892
|
+
|
893
|
+
|
894
|
+
|
895
|
+
class MessageData < FFI::Union
|
896
|
+
layout :whatever, :pointer,
|
897
|
+
:result, :code
|
898
|
+
end
|
899
|
+
|
900
|
+
class Message < FFI::Struct
|
901
|
+
layout :msg, :message,
|
902
|
+
:easy_handle, :pointer,
|
903
|
+
:data, MessageData
|
904
|
+
end
|
905
|
+
|
906
|
+
# Returns a char * - needs to be freed manually using curl_free
|
907
|
+
attach_function :easy_escape, :curl_easy_escape, [:pointer, :string, :int], :pointer
|
908
|
+
attach_function :easy_init, :curl_easy_init, [], :pointer
|
909
|
+
attach_function :easy_cleanup, :curl_easy_cleanup, [:pointer], :void
|
910
|
+
attach_function :easy_duphandle, :curl_easy_duphandle, [:pointer], :pointer
|
911
|
+
attach_function :easy_getinfo, :curl_easy_getinfo, [:pointer, :info, :pointer], :code
|
912
|
+
attach_function :easy_pause, :curl_easy_pause, [:pointer, :int], :code
|
913
|
+
attach_function :easy_perform, :curl_easy_perform, [:pointer], :code
|
914
|
+
attach_function :easy_recv, :curl_easy_recv, [:pointer, :pointer, :size_t, :size_t], :code
|
915
|
+
attach_function :easy_reset, :curl_easy_reset, [:pointer], :void
|
916
|
+
attach_function :easy_send, :curl_easy_send, [:pointer, :string, :size_t, :pointer], :code
|
917
|
+
|
918
|
+
attach_function :easy_setopt_long, :curl_easy_setopt, [:pointer, :option, :long], :code
|
919
|
+
attach_function :easy_setopt_string, :curl_easy_setopt, [:pointer, :option, :string], :code
|
920
|
+
attach_function :easy_setopt_pointer, :curl_easy_setopt, [:pointer, :option, :pointer], :code
|
921
|
+
attach_function :easy_setopt_curl_off_t, :curl_easy_setopt, [:pointer, :option, :curl_off_t], :code
|
922
|
+
|
923
|
+
def self.easy_setopt(handle, option, value)
|
924
|
+
option = OPTION[option] if option.is_a?(Symbol)
|
925
|
+
|
926
|
+
if option >= OPTION_OFF_T
|
927
|
+
self.easy_setopt_curl_off_t(handle, option, value)
|
928
|
+
elsif option >= OPTION_FUNCTIONPOINT
|
929
|
+
self.easy_setopt_pointer(handle, option, value)
|
930
|
+
elsif option >= OPTION_OBJECTPOINT
|
931
|
+
if value.respond_to?(:to_str)
|
932
|
+
self.easy_setopt_string(handle, option, value.to_str)
|
933
|
+
else
|
934
|
+
self.easy_setopt_pointer(handle, option, value)
|
935
|
+
end
|
936
|
+
elsif option >= OPTION_LONG
|
937
|
+
self.easy_setopt_long(handle, option, value)
|
938
|
+
end
|
939
|
+
end
|
940
|
+
|
941
|
+
attach_function :easy_strerror, :curl_easy_strerror, [:code], :string
|
942
|
+
|
943
|
+
# Returns a char * that has to be freed using curl_free
|
944
|
+
attach_function :easy_unescape, :curl_easy_unescape, [:pointer, :string, :int, :pointer], :pointer
|
945
|
+
attach_function :multi_add_handle, :curl_multi_add_handle, [:pointer, :pointer], :multi_code
|
946
|
+
attach_function :multi_assign, :curl_multi_assign, [:pointer, :curl_socket_t, :pointer], :multi_code
|
947
|
+
attach_function :multi_cleanup, :curl_multi_cleanup, [:pointer], :void
|
948
|
+
attach_function :multi_fdset, :curl_multi_fdset, [:pointer, :pointer, :pointer, :pointer, :pointer], :multi_code
|
949
|
+
attach_function :multi_info_read, :curl_multi_info_read, [:pointer, :pointer], :pointer
|
950
|
+
attach_function :multi_init, :curl_multi_init, [], :pointer
|
951
|
+
attach_function :multi_perform, :curl_multi_perform, [:pointer, :pointer], :multi_code
|
952
|
+
attach_function :multi_remove_handle, :curl_multi_remove_handle, [:pointer, :pointer], :multi_code
|
953
|
+
|
954
|
+
attach_function :multi_setopt_long, :curl_multi_setopt, [:pointer, :multi_option, :long], :multi_code
|
955
|
+
attach_function :multi_setopt_string, :curl_multi_setopt, [:pointer, :multi_option, :string], :multi_code
|
956
|
+
attach_function :multi_setopt_pointer, :curl_multi_setopt, [:pointer, :multi_option, :pointer], :multi_code
|
957
|
+
attach_function :multi_setopt_curl_off_t, :curl_multi_setopt, [:pointer, :multi_option, :curl_off_t], :multi_code
|
958
|
+
|
959
|
+
def self.multi_setopt(handle, option, value)
|
960
|
+
option = MULTI_OPTION[option] if option.is_a?(Symbol)
|
961
|
+
|
962
|
+
if option >= OPTION_OFF_T
|
963
|
+
self.multi_setopt_curl_off_t(handle, option, value)
|
964
|
+
elsif option >= OPTION_FUNCTIONPOINT
|
965
|
+
self.multi_setopt_pointer(handle, option, value)
|
966
|
+
elsif option >= OPTION_OBJECTPOINT
|
967
|
+
if value.respond_to?(:to_str)
|
968
|
+
self.multi_setopt_string(handle, option, value.to_str)
|
969
|
+
else
|
970
|
+
self.multi_setopt_pointer(handle, option, value)
|
971
|
+
end
|
972
|
+
elsif option >= OPTION_LONG
|
973
|
+
self.multi_setopt_long(handle, option, value)
|
974
|
+
end
|
975
|
+
end
|
976
|
+
|
977
|
+
attach_function :multi_socket_action, :curl_multi_socket_action, [:pointer, :curl_socket_t, :int, :pointer], :multi_code
|
978
|
+
attach_function :multi_strerror, :curl_multi_strerror, [:multi_code], :string
|
979
|
+
attach_function :multi_timeout, :curl_multi_timeout, [:pointer, :pointer], :multi_code
|
980
|
+
|
981
|
+
attach_function :free, :curl_free, [:pointer], :void
|
982
|
+
|
983
|
+
attach_function :slist_append, :curl_slist_append, [:pointer, :string], :pointer
|
984
|
+
attach_function :slist_free_all, :curl_slist_free_all, [:pointer], :void
|
985
|
+
end
|