curl_ffi 0.0.2

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