curb 0.8.4 → 0.9.11
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.
- checksums.yaml +7 -0
- data/README.markdown +277 -0
- data/Rakefile +29 -18
- data/ext/banned.h +32 -0
- data/ext/curb.c +161 -46
- data/ext/curb.h +14 -10
- data/ext/curb_easy.c +612 -97
- data/ext/curb_easy.h +6 -0
- data/ext/curb_errors.c +113 -16
- data/ext/curb_errors.h +8 -5
- data/ext/curb_macros.h +7 -7
- data/ext/curb_multi.c +175 -167
- data/ext/curb_multi.h +0 -1
- data/ext/curb_upload.c +2 -2
- data/ext/extconf.rb +52 -17
- data/lib/curb.rb +1 -0
- data/lib/curl/easy.rb +79 -59
- data/lib/curl/multi.rb +59 -20
- data/lib/curl.rb +15 -9
- data/tests/bug_crash_on_progress.rb +41 -1
- data/tests/bug_issue102.rb +1 -1
- data/tests/bug_issue277.rb +32 -0
- data/tests/helper.rb +102 -13
- data/tests/tc_curl.rb +31 -1
- data/tests/tc_curl_download.rb +4 -4
- data/tests/tc_curl_easy.rb +197 -42
- data/tests/tc_curl_easy_resolve.rb +16 -0
- data/tests/tc_curl_maxfilesize.rb +12 -0
- data/tests/tc_curl_multi.rb +82 -16
- data/tests/tc_curl_postfield.rb +29 -29
- data/tests/timeout.rb +10 -2
- metadata +51 -52
- data/README +0 -194
data/ext/curb.c
CHANGED
|
@@ -219,6 +219,22 @@ static VALUE ruby_curl_conv_q(VALUE mod) {
|
|
|
219
219
|
#endif
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
/*
|
|
223
|
+
* call-seq:
|
|
224
|
+
* Curl.http2? => true or false
|
|
225
|
+
*
|
|
226
|
+
* Returns true if the installed libcurl was built with support for HTTP2.
|
|
227
|
+
* For libcurl versions < 7.33.0, always returns false.
|
|
228
|
+
*/
|
|
229
|
+
static VALUE ruby_curl_http2_q(VALUE mod) {
|
|
230
|
+
#ifdef HAVE_CURL_VERSION_HTTP2
|
|
231
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
232
|
+
return((ver->features & CURL_VERSION_HTTP2) ? Qtrue : Qfalse);
|
|
233
|
+
#else
|
|
234
|
+
return Qfalse;
|
|
235
|
+
#endif
|
|
236
|
+
}
|
|
237
|
+
|
|
222
238
|
void Init_curb_core() {
|
|
223
239
|
// TODO we need to call curl_global_cleanup at exit!
|
|
224
240
|
curl_version_info_data *ver;
|
|
@@ -242,121 +258,156 @@ void Init_curb_core() {
|
|
|
242
258
|
rb_define_const(mCurl, "CURL_LONG_VERSION", curllongver);
|
|
243
259
|
|
|
244
260
|
/* Passed to on_debug handler to indicate that the data is informational text. */
|
|
245
|
-
rb_define_const(mCurl, "CURLINFO_TEXT",
|
|
261
|
+
rb_define_const(mCurl, "CURLINFO_TEXT", LONG2NUM(CURLINFO_TEXT));
|
|
246
262
|
|
|
247
263
|
/* Passed to on_debug handler to indicate that the data is header (or header-like) data received from the peer. */
|
|
248
|
-
rb_define_const(mCurl, "CURLINFO_HEADER_IN",
|
|
264
|
+
rb_define_const(mCurl, "CURLINFO_HEADER_IN", LONG2NUM(CURLINFO_HEADER_IN));
|
|
249
265
|
|
|
250
266
|
/* Passed to on_debug handler to indicate that the data is header (or header-like) data sent to the peer. */
|
|
251
|
-
rb_define_const(mCurl, "CURLINFO_HEADER_OUT",
|
|
267
|
+
rb_define_const(mCurl, "CURLINFO_HEADER_OUT", LONG2NUM(CURLINFO_HEADER_OUT));
|
|
252
268
|
|
|
253
269
|
/* Passed to on_debug handler to indicate that the data is protocol data received from the peer. */
|
|
254
|
-
rb_define_const(mCurl, "CURLINFO_DATA_IN",
|
|
270
|
+
rb_define_const(mCurl, "CURLINFO_DATA_IN", LONG2NUM(CURLINFO_DATA_IN));
|
|
255
271
|
|
|
256
272
|
/* Passed to on_debug handler to indicate that the data is protocol data sent to the peer. */
|
|
257
|
-
rb_define_const(mCurl, "CURLINFO_DATA_OUT",
|
|
273
|
+
rb_define_const(mCurl, "CURLINFO_DATA_OUT", LONG2NUM(CURLINFO_DATA_OUT));
|
|
258
274
|
|
|
259
|
-
#ifdef HAVE_CURLFTPMETHOD_MULTICWD
|
|
260
|
-
rb_define_const(mCurl, "CURL_MULTICWD",
|
|
275
|
+
#ifdef HAVE_CURLFTPMETHOD_MULTICWD
|
|
276
|
+
rb_define_const(mCurl, "CURL_MULTICWD", LONG2NUM(CURLFTPMETHOD_MULTICWD));
|
|
261
277
|
#endif
|
|
262
278
|
|
|
263
|
-
#ifdef HAVE_CURLFTPMETHOD_NOCWD
|
|
264
|
-
rb_define_const(mCurl, "CURL_NOCWD",
|
|
279
|
+
#ifdef HAVE_CURLFTPMETHOD_NOCWD
|
|
280
|
+
rb_define_const(mCurl, "CURL_NOCWD", LONG2NUM(CURLFTPMETHOD_NOCWD));
|
|
265
281
|
#endif
|
|
266
282
|
|
|
267
|
-
#ifdef HAVE_CURLFTPMETHOD_SINGLECWD
|
|
268
|
-
rb_define_const(mCurl, "CURL_SINGLECWD",
|
|
283
|
+
#ifdef HAVE_CURLFTPMETHOD_SINGLECWD
|
|
284
|
+
rb_define_const(mCurl, "CURL_SINGLECWD", LONG2NUM(CURLFTPMETHOD_SINGLECWD));
|
|
269
285
|
#endif
|
|
270
286
|
|
|
271
287
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is an HTTP proxy. (libcurl >= 7.10) */
|
|
272
288
|
#ifdef HAVE_CURLPROXY_HTTP
|
|
273
|
-
rb_define_const(mCurl, "CURLPROXY_HTTP",
|
|
289
|
+
rb_define_const(mCurl, "CURLPROXY_HTTP", LONG2NUM(CURLPROXY_HTTP));
|
|
274
290
|
#else
|
|
275
|
-
rb_define_const(mCurl, "CURLPROXY_HTTP",
|
|
291
|
+
rb_define_const(mCurl, "CURLPROXY_HTTP", LONG2NUM(-1));
|
|
276
292
|
#endif
|
|
277
293
|
|
|
278
294
|
#ifdef CURL_VERSION_SSL
|
|
279
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT",
|
|
280
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1",
|
|
281
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2",
|
|
282
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3",
|
|
283
|
-
|
|
284
|
-
rb_define_const(mCurl, "
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
rb_define_const(mCurl, "
|
|
295
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT", LONG2NUM(CURL_SSLVERSION_DEFAULT));
|
|
296
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1", LONG2NUM(CURL_SSLVERSION_TLSv1));
|
|
297
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2", LONG2NUM(CURL_SSLVERSION_SSLv2));
|
|
298
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3", LONG2NUM(CURL_SSLVERSION_SSLv3));
|
|
299
|
+
#if HAVE_CURL_SSLVERSION_TLSV1_0
|
|
300
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_0", LONG2NUM(CURL_SSLVERSION_TLSv1_0));
|
|
301
|
+
#endif
|
|
302
|
+
#if HAVE_CURL_SSLVERSION_TLSV1_1
|
|
303
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_1", LONG2NUM(CURL_SSLVERSION_TLSv1_1));
|
|
304
|
+
#endif
|
|
305
|
+
#if HAVE_CURL_SSLVERSION_TLSV1_2
|
|
306
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_2", LONG2NUM(CURL_SSLVERSION_TLSv1_2));
|
|
307
|
+
#endif
|
|
308
|
+
|
|
309
|
+
rb_define_const(mCurl, "CURL_USESSL_CONTROL", LONG2NUM(CURB_FTPSSL_CONTROL));
|
|
310
|
+
rb_define_const(mCurl, "CURL_USESSL_NONE", LONG2NUM(CURB_FTPSSL_NONE));
|
|
311
|
+
rb_define_const(mCurl, "CURL_USESSL_TRY", LONG2NUM(CURB_FTPSSL_TRY));
|
|
312
|
+
rb_define_const(mCurl, "CURL_USESSL_ALL", LONG2NUM(CURB_FTPSSL_ALL));
|
|
288
313
|
#else
|
|
289
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT",
|
|
290
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1",
|
|
291
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2",
|
|
292
|
-
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3",
|
|
314
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT", LONG2NUM(-1));
|
|
315
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1", LONG2NUM(-1));
|
|
316
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2", LONG2NUM(-1));
|
|
317
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3", LONG2NUM(-1));
|
|
318
|
+
#if HAVE_CURL_SSLVERSION_TLSv1_0
|
|
319
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_0", LONG2NUM(-1));
|
|
320
|
+
#endif
|
|
321
|
+
#if HAVE_CURL_SSLVERSION_TLSv1_1
|
|
322
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_1", LONG2NUM(-1));
|
|
323
|
+
#endif
|
|
324
|
+
#if HAVE_CURL_SSLVERSION_TLSv1_2
|
|
325
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1_2", LONG2NUM(-1));
|
|
326
|
+
#endif
|
|
293
327
|
|
|
294
|
-
rb_define_const(mCurl, "CURL_USESSL_CONTROL",
|
|
295
|
-
rb_define_const(mCurl, "CURL_USESSL_NONE",
|
|
296
|
-
rb_define_const(mCurl, "CURL_USESSL_TRY",
|
|
297
|
-
rb_define_const(mCurl, "CURL_USESSL_ALL",
|
|
328
|
+
rb_define_const(mCurl, "CURL_USESSL_CONTROL", LONG2NUM(-1));
|
|
329
|
+
rb_define_const(mCurl, "CURL_USESSL_NONE", LONG2NUM(-1));
|
|
330
|
+
rb_define_const(mCurl, "CURL_USESSL_TRY", LONG2NUM(-1));
|
|
331
|
+
rb_define_const(mCurl, "CURL_USESSL_ALL", LONG2NUM(-1));
|
|
298
332
|
#endif
|
|
299
333
|
|
|
300
334
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS4 proxy. (libcurl >= 7.15.2) */
|
|
301
335
|
#ifdef HAVE_CURLPROXY_SOCKS4
|
|
302
|
-
rb_define_const(mCurl, "CURLPROXY_SOCKS4",
|
|
336
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS4", LONG2NUM(CURLPROXY_SOCKS4));
|
|
337
|
+
#else
|
|
338
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS4", LONG2NUM(-2));
|
|
339
|
+
#endif
|
|
340
|
+
|
|
341
|
+
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS4A proxy. (libcurl >= 7.18.0) */
|
|
342
|
+
#ifdef HAVE_CURLPROXY_SOCKS4A
|
|
343
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS4A", LONG2NUM(CURLPROXY_SOCKS4A));
|
|
303
344
|
#else
|
|
304
|
-
rb_define_const(mCurl, "
|
|
345
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS4A", LONG2NUM(-2));
|
|
305
346
|
#endif
|
|
306
347
|
|
|
307
348
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS5 proxy. (libcurl >= 7.10) */
|
|
308
349
|
#ifdef HAVE_CURLPROXY_SOCKS5
|
|
309
|
-
rb_define_const(mCurl, "CURLPROXY_SOCKS5",
|
|
350
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS5", LONG2NUM(CURLPROXY_SOCKS5));
|
|
351
|
+
#else
|
|
352
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS5", LONG2NUM(-2));
|
|
353
|
+
#endif
|
|
354
|
+
|
|
355
|
+
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS5 proxy (and that the proxy should resolve the hostname). (libcurl >= 7.17.2) */
|
|
356
|
+
#ifdef HAVE_CURLPROXY_SOCKS5_HOSTNAME
|
|
357
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS5_HOSTNAME", LONG2NUM(CURLPROXY_SOCKS5_HOSTNAME));
|
|
310
358
|
#else
|
|
311
|
-
rb_define_const(mCurl, "
|
|
359
|
+
rb_define_const(mCurl, "CURLPROXY_SOCKS5_HOSTNAME", LONG2NUM(-2));
|
|
312
360
|
#endif
|
|
313
361
|
|
|
314
362
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use Basic authentication. */
|
|
315
363
|
#ifdef HAVE_CURLAUTH_BASIC
|
|
316
|
-
rb_define_const(mCurl, "CURLAUTH_BASIC",
|
|
364
|
+
rb_define_const(mCurl, "CURLAUTH_BASIC", LONG2NUM(CURLAUTH_BASIC));
|
|
317
365
|
#else
|
|
318
|
-
rb_define_const(mCurl, "CURLAUTH_BASIC",
|
|
366
|
+
rb_define_const(mCurl, "CURLAUTH_BASIC", LONG2NUM(0));
|
|
319
367
|
#endif
|
|
320
368
|
|
|
321
369
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use Digest authentication. */
|
|
322
370
|
#ifdef HAVE_CURLAUTH_DIGEST
|
|
323
|
-
rb_define_const(mCurl, "CURLAUTH_DIGEST",
|
|
371
|
+
rb_define_const(mCurl, "CURLAUTH_DIGEST", LONG2NUM(CURLAUTH_DIGEST));
|
|
324
372
|
#else
|
|
325
|
-
rb_define_const(mCurl, "CURLAUTH_DIGEST",
|
|
373
|
+
rb_define_const(mCurl, "CURLAUTH_DIGEST", LONG2NUM(0));
|
|
326
374
|
#endif
|
|
327
375
|
|
|
328
376
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use GSS Negotiate authentication. Requires a suitable GSS-API library. */
|
|
329
377
|
#ifdef HAVE_CURLAUTH_GSSNEGOTIATE
|
|
330
|
-
rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE",
|
|
378
|
+
rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE", LONG2NUM(CURLAUTH_GSSNEGOTIATE));
|
|
331
379
|
#else
|
|
332
|
-
rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE",
|
|
380
|
+
rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE", LONG2NUM(0));
|
|
333
381
|
#endif
|
|
334
382
|
|
|
335
383
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use HTTP NTLM authentication. Requires MS Windows or OpenSSL support. */
|
|
336
384
|
#ifdef HAVE_CURLAUTH_NTLM
|
|
337
|
-
rb_define_const(mCurl, "CURLAUTH_NTLM",
|
|
385
|
+
rb_define_const(mCurl, "CURLAUTH_NTLM", LONG2NUM(CURLAUTH_NTLM));
|
|
338
386
|
#else
|
|
339
|
-
rb_define_const(mCurl, "CURLAUTH_NTLM",
|
|
387
|
+
rb_define_const(mCurl, "CURLAUTH_NTLM", LONG2NUM(0));
|
|
340
388
|
#endif
|
|
341
389
|
|
|
342
390
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, allows libcurl to select any suitable authentication method except basic. */
|
|
343
391
|
#ifdef HAVE_CURLAUTH_ANYSAFE
|
|
344
|
-
rb_define_const(mCurl, "CURLAUTH_ANYSAFE",
|
|
392
|
+
rb_define_const(mCurl, "CURLAUTH_ANYSAFE", LONG2NUM(CURLAUTH_ANYSAFE));
|
|
345
393
|
#else
|
|
346
|
-
rb_define_const(mCurl, "CURLAUTH_ANYSAFE",
|
|
394
|
+
rb_define_const(mCurl, "CURLAUTH_ANYSAFE", LONG2NUM(0));
|
|
347
395
|
#endif
|
|
348
396
|
|
|
349
397
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, allows libcurl to select any suitable authentication method. */
|
|
350
398
|
#ifdef HAVE_CURLAUTH_ANY
|
|
351
|
-
rb_define_const(mCurl, "CURLAUTH_ANY",
|
|
399
|
+
rb_define_const(mCurl, "CURLAUTH_ANY", LONG2NUM(CURLAUTH_ANY));
|
|
352
400
|
#else
|
|
353
|
-
rb_define_const(mCurl, "CURLAUTH_ANY",
|
|
401
|
+
rb_define_const(mCurl, "CURLAUTH_ANY", LONG2NUM(0));
|
|
354
402
|
#endif
|
|
355
403
|
|
|
356
404
|
CURB_DEFINE(CURLOPT_VERBOSE);
|
|
357
405
|
CURB_DEFINE(CURLOPT_HEADER);
|
|
358
406
|
CURB_DEFINE(CURLOPT_NOPROGRESS);
|
|
359
407
|
CURB_DEFINE(CURLOPT_NOSIGNAL);
|
|
408
|
+
#if HAVE_CURLOPT_PATH_AS_IS
|
|
409
|
+
CURB_DEFINE(CURLOPT_PATH_AS_IS);
|
|
410
|
+
#endif
|
|
360
411
|
CURB_DEFINE(CURLOPT_WRITEFUNCTION);
|
|
361
412
|
CURB_DEFINE(CURLOPT_WRITEDATA);
|
|
362
413
|
CURB_DEFINE(CURLOPT_READFUNCTION);
|
|
@@ -541,6 +592,9 @@ void Init_curb_core() {
|
|
|
541
592
|
CURB_DEFINE(CURLOPT_REFERER);
|
|
542
593
|
CURB_DEFINE(CURLOPT_USERAGENT);
|
|
543
594
|
CURB_DEFINE(CURLOPT_HTTPHEADER);
|
|
595
|
+
#if HAVE_CURLOPT_PROXYHEADER
|
|
596
|
+
CURB_DEFINE(CURLOPT_PROXYHEADER);
|
|
597
|
+
#endif
|
|
544
598
|
#if HAVE_CURLOPT_HTTP200ALIASES
|
|
545
599
|
CURB_DEFINE(CURLOPT_HTTP200ALIASES);
|
|
546
600
|
#endif
|
|
@@ -562,6 +616,12 @@ void Init_curb_core() {
|
|
|
562
616
|
CURB_DEFINE(CURL_HTTP_VERSION_NONE);
|
|
563
617
|
CURB_DEFINE(CURL_HTTP_VERSION_1_0);
|
|
564
618
|
CURB_DEFINE(CURL_HTTP_VERSION_1_1);
|
|
619
|
+
#if LIBCURL_VERSION_NUM >= 0x072100 /* 7.33.0 */
|
|
620
|
+
CURB_DEFINE(CURL_HTTP_VERSION_2_0);
|
|
621
|
+
#endif
|
|
622
|
+
#if LIBCURL_VERSION_NUM >= 0x072f00 /* 7.47.0 */
|
|
623
|
+
CURB_DEFINE(CURL_HTTP_VERSION_2TLS);
|
|
624
|
+
#endif
|
|
565
625
|
#if HAVE_CURLOPT_IGNORE_CONTENT_LENGTH
|
|
566
626
|
CURB_DEFINE(CURLOPT_IGNORE_CONTENT_LENGTH);
|
|
567
627
|
#endif
|
|
@@ -863,6 +923,15 @@ void Init_curb_core() {
|
|
|
863
923
|
#if HAVE_CURL_SSLVERSION_SSLv3
|
|
864
924
|
CURB_DEFINE(CURL_SSLVERSION_SSLv3);
|
|
865
925
|
#endif
|
|
926
|
+
#if HAVE_CURL_SSLVERSION_TLSv1_0
|
|
927
|
+
CURB_DEFINE(CURL_SSLVERSION_TLSv1_0);
|
|
928
|
+
#endif
|
|
929
|
+
#if HAVE_CURL_SSLVERSION_TLSv1_1
|
|
930
|
+
CURB_DEFINE(CURL_SSLVERSION_TLSv1_1);
|
|
931
|
+
#endif
|
|
932
|
+
#if HAVE_CURL_SSLVERSION_TLSv1_2
|
|
933
|
+
CURB_DEFINE(CURL_SSLVERSION_TLSv1_2);
|
|
934
|
+
#endif
|
|
866
935
|
#if HAVE_CURLOPT_SSL_VERIFYPEER
|
|
867
936
|
CURB_DEFINE(CURLOPT_SSL_VERIFYPEER);
|
|
868
937
|
#endif
|
|
@@ -951,10 +1020,55 @@ void Init_curb_core() {
|
|
|
951
1020
|
CURB_DEFINE(CURLOPT_TELNETOPTIONS);
|
|
952
1021
|
#endif
|
|
953
1022
|
|
|
1023
|
+
#if HAVE_CURLOPT_GSSAPI_DELEGATION
|
|
1024
|
+
CURB_DEFINE(CURLOPT_GSSAPI_DELEGATION);
|
|
1025
|
+
#endif
|
|
1026
|
+
|
|
1027
|
+
#if HAVE_CURLGSSAPI_DELEGATION_FLAG
|
|
1028
|
+
CURB_DEFINE(CURLGSSAPI_DELEGATION_FLAG);
|
|
1029
|
+
#endif
|
|
1030
|
+
|
|
1031
|
+
#if HAVE_CURLGSSAPI_DELEGATION_POLICY_FLAG
|
|
1032
|
+
CURB_DEFINE(CURLGSSAPI_DELEGATION_POLICY_FLAG);
|
|
1033
|
+
#endif
|
|
1034
|
+
|
|
1035
|
+
#if HAVE_CURLOPT_UNIX_SOCKET_PATH
|
|
1036
|
+
CURB_DEFINE(CURLOPT_UNIX_SOCKET_PATH);
|
|
1037
|
+
#endif
|
|
1038
|
+
|
|
1039
|
+
#if HAVE_CURLOPT_PIPEWAIT
|
|
1040
|
+
CURB_DEFINE(CURLOPT_PIPEWAIT);
|
|
1041
|
+
#endif
|
|
1042
|
+
|
|
1043
|
+
#if HAVE_CURLOPT_TCP_KEEPALIVE
|
|
1044
|
+
CURB_DEFINE(CURLOPT_TCP_KEEPALIVE);
|
|
1045
|
+
CURB_DEFINE(CURLOPT_TCP_KEEPIDLE);
|
|
1046
|
+
CURB_DEFINE(CURLOPT_TCP_KEEPINTVL);
|
|
1047
|
+
#endif
|
|
1048
|
+
|
|
1049
|
+
#if HAVE_CURLOPT_HAPROXYPROTOCOL
|
|
1050
|
+
CURB_DEFINE(CURLOPT_HAPROXYPROTOCOL);
|
|
1051
|
+
#endif
|
|
1052
|
+
|
|
1053
|
+
#if LIBCURL_VERSION_NUM >= 0x072B00 /* 7.43.0 */
|
|
1054
|
+
CURB_DEFINE(CURLPIPE_NOTHING);
|
|
1055
|
+
CURB_DEFINE(CURLPIPE_HTTP1);
|
|
1056
|
+
CURB_DEFINE(CURLPIPE_MULTIPLEX);
|
|
1057
|
+
|
|
1058
|
+
rb_define_const(mCurl, "PIPE_NOTHING", LONG2NUM(CURLPIPE_NOTHING));
|
|
1059
|
+
rb_define_const(mCurl, "PIPE_HTTP1", LONG2NUM(CURLPIPE_HTTP1));
|
|
1060
|
+
rb_define_const(mCurl, "PIPE_MULTIPLEX", LONG2NUM(CURLPIPE_MULTIPLEX));
|
|
1061
|
+
#endif
|
|
1062
|
+
|
|
1063
|
+
#if LIBCURL_VERSION_NUM >= 0x072100 /* 7.33.0 */
|
|
1064
|
+
rb_define_const(mCurl, "HTTP_2_0", LONG2NUM(CURL_HTTP_VERSION_2_0));
|
|
1065
|
+
#endif
|
|
954
1066
|
rb_define_const(mCurl, "HTTP_1_1", LONG2NUM(CURL_HTTP_VERSION_1_1));
|
|
955
1067
|
rb_define_const(mCurl, "HTTP_1_0", LONG2NUM(CURL_HTTP_VERSION_1_0));
|
|
956
1068
|
rb_define_const(mCurl, "HTTP_NONE", LONG2NUM(CURL_HTTP_VERSION_NONE));
|
|
957
1069
|
|
|
1070
|
+
|
|
1071
|
+
|
|
958
1072
|
rb_define_singleton_method(mCurl, "ipv6?", ruby_curl_ipv6_q, 0);
|
|
959
1073
|
rb_define_singleton_method(mCurl, "kerberos4?", ruby_curl_kerberos4_q, 0);
|
|
960
1074
|
rb_define_singleton_method(mCurl, "ssl?", ruby_curl_ssl_q, 0);
|
|
@@ -968,6 +1082,7 @@ void Init_curb_core() {
|
|
|
968
1082
|
rb_define_singleton_method(mCurl, "idn?", ruby_curl_idn_q, 0);
|
|
969
1083
|
rb_define_singleton_method(mCurl, "sspi?", ruby_curl_sspi_q, 0);
|
|
970
1084
|
rb_define_singleton_method(mCurl, "conv?", ruby_curl_conv_q, 0);
|
|
1085
|
+
rb_define_singleton_method(mCurl, "http2?", ruby_curl_http2_q, 0);
|
|
971
1086
|
|
|
972
1087
|
init_curb_errors();
|
|
973
1088
|
init_curb_easy();
|
data/ext/curb.h
CHANGED
|
@@ -9,8 +9,16 @@
|
|
|
9
9
|
#define __CURB_H
|
|
10
10
|
|
|
11
11
|
#include <ruby.h>
|
|
12
|
+
|
|
13
|
+
#ifdef HAVE_RUBY_IO_H
|
|
14
|
+
#include "ruby/io.h"
|
|
15
|
+
#else
|
|
16
|
+
#include "rubyio.h" // ruby 1.8
|
|
17
|
+
#endif
|
|
18
|
+
|
|
12
19
|
#include <curl/curl.h>
|
|
13
20
|
|
|
21
|
+
#include "banned.h"
|
|
14
22
|
#include "curb_config.h"
|
|
15
23
|
#include "curb_easy.h"
|
|
16
24
|
#include "curb_errors.h"
|
|
@@ -20,11 +28,11 @@
|
|
|
20
28
|
#include "curb_macros.h"
|
|
21
29
|
|
|
22
30
|
// These should be managed from the Rake 'release' task.
|
|
23
|
-
#define CURB_VERSION "0.
|
|
24
|
-
#define CURB_VER_NUM
|
|
31
|
+
#define CURB_VERSION "0.9.11"
|
|
32
|
+
#define CURB_VER_NUM 9011
|
|
25
33
|
#define CURB_VER_MAJ 0
|
|
26
|
-
#define CURB_VER_MIN
|
|
27
|
-
#define CURB_VER_MIC
|
|
34
|
+
#define CURB_VER_MIN 9
|
|
35
|
+
#define CURB_VER_MIC 11
|
|
28
36
|
#define CURB_VER_PATCH 0
|
|
29
37
|
|
|
30
38
|
|
|
@@ -37,12 +45,8 @@
|
|
|
37
45
|
#define RSTRING_PTR(x) RSTRING(x)->ptr
|
|
38
46
|
#endif
|
|
39
47
|
|
|
40
|
-
#ifndef
|
|
41
|
-
#
|
|
42
|
-
#define RHASH_LEN(hash) RHASH(hash)->ntbl->num_entries
|
|
43
|
-
#else
|
|
44
|
-
#define RHASH_LEN(hash) RHASH(hash)->tbl->num_entries
|
|
45
|
-
#endif
|
|
48
|
+
#ifndef RHASH_SIZE
|
|
49
|
+
#define RHASH_SIZE(hash) RHASH(hash)->tbl->num_entries
|
|
46
50
|
#endif
|
|
47
51
|
|
|
48
52
|
extern VALUE mCurl;
|