curb 0.1.4 → 0.7.15
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.
- data/README +131 -60
- data/Rakefile +81 -68
- data/doc.rb +1 -1
- data/ext/curb.c +107 -70
- data/ext/curb.h +23 -10
- data/ext/curb_easy.c +2156 -908
- data/ext/curb_easy.h +41 -28
- data/ext/curb_errors.c +258 -92
- data/ext/curb_errors.h +25 -2
- data/ext/curb_macros.h +41 -0
- data/ext/curb_multi.c +565 -0
- data/ext/curb_multi.h +26 -0
- data/ext/curb_postfield.c +68 -44
- data/ext/curb_upload.c +80 -0
- data/ext/curb_upload.h +30 -0
- data/ext/extconf.rb +159 -7
- data/lib/curb.rb +308 -0
- data/{ext → lib}/curl.rb +0 -1
- data/tests/bug_curb_easy_blocks_ruby_threads.rb +52 -0
- data/tests/bug_curb_easy_post_with_string_no_content_length_header.rb +83 -0
- data/tests/bug_instance_post_differs_from_class_post.rb +1 -1
- data/tests/bug_multi_segfault.rb +14 -0
- data/tests/bug_postfields_crash.rb +26 -0
- data/tests/bug_postfields_crash2.rb +57 -0
- data/tests/bugtests.rb +9 -0
- data/tests/helper.rb +168 -0
- data/tests/mem_check.rb +65 -0
- data/tests/require_last_or_segfault_script.rb +2 -2
- data/tests/tc_curl_download.rb +75 -0
- data/tests/tc_curl_easy.rb +464 -9
- data/tests/tc_curl_multi.rb +466 -0
- data/tests/tc_curl_postfield.rb +4 -2
- data/tests/timeout.rb +100 -0
- data/tests/timeout_server.rb +33 -0
- metadata +103 -56
- data/ext/curb.rb +0 -46
- data/samples/gmail.rb +0 -48
data/ext/curb.c
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* Curb - Libcurl(3) bindings for Ruby.
|
|
2
|
-
* Copyright (c)2006 Ross Bamford.
|
|
2
|
+
* Copyright (c)2006 Ross Bamford.
|
|
3
3
|
* Licensed under the Ruby License. See LICENSE for details.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* $Id: curb.c 35 2006-12-23 15:22:19Z roscopeco $
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
#include "curb.h"
|
|
9
9
|
|
|
10
10
|
VALUE mCurl;
|
|
@@ -14,36 +14,36 @@ VALUE mCurl;
|
|
|
14
14
|
/*
|
|
15
15
|
* call-seq:
|
|
16
16
|
* Curl.ipv6? => true or false
|
|
17
|
-
*
|
|
18
|
-
* Returns true if the installed libcurl supports IPv6.
|
|
17
|
+
*
|
|
18
|
+
* Returns true if the installed libcurl supports IPv6.
|
|
19
19
|
*/
|
|
20
20
|
static VALUE ruby_curl_ipv6_q(VALUE mod) {
|
|
21
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
21
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
22
22
|
return((ver->features & CURL_VERSION_IPV6) ? Qtrue : Qfalse);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/*
|
|
26
26
|
* call-seq:
|
|
27
27
|
* Curl.kerberos4? => true or false
|
|
28
|
-
*
|
|
28
|
+
*
|
|
29
29
|
* Returns true if the installed libcurl supports Kerberos4 authentication
|
|
30
|
-
* with FTP connections.
|
|
30
|
+
* with FTP connections.
|
|
31
31
|
*/
|
|
32
32
|
static VALUE ruby_curl_kerberos4_q(VALUE mod) {
|
|
33
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
33
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
34
34
|
return((ver->features & CURL_VERSION_KERBEROS4) ? Qtrue : Qfalse);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/*
|
|
38
38
|
* call-seq:
|
|
39
39
|
* Curl.ssl? => true or false
|
|
40
|
-
*
|
|
40
|
+
*
|
|
41
41
|
* Returns true if the installed libcurl supports SSL connections.
|
|
42
42
|
* For libcurl versions < 7.10, always returns false.
|
|
43
43
|
*/
|
|
44
44
|
static VALUE ruby_curl_ssl_q(VALUE mod) {
|
|
45
|
-
#ifdef
|
|
46
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
45
|
+
#ifdef HAVE_CURL_VERSION_SSL
|
|
46
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
47
47
|
return((ver->features & CURL_VERSION_SSL) ? Qtrue : Qfalse);
|
|
48
48
|
#else
|
|
49
49
|
return Qfalse;
|
|
@@ -53,13 +53,13 @@ static VALUE ruby_curl_ssl_q(VALUE mod) {
|
|
|
53
53
|
/*
|
|
54
54
|
* call-seq:
|
|
55
55
|
* Curl.libz? => true or false
|
|
56
|
-
*
|
|
56
|
+
*
|
|
57
57
|
* Returns true if the installed libcurl supports HTTP deflate
|
|
58
58
|
* using libz. For libcurl versions < 7.10, always returns false.
|
|
59
59
|
*/
|
|
60
60
|
static VALUE ruby_curl_libz_q(VALUE mod) {
|
|
61
|
-
#ifdef
|
|
62
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
61
|
+
#ifdef HAVE_CURL_VERSION_LIBZ
|
|
62
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
63
63
|
return((ver->features & CURL_VERSION_LIBZ) ? Qtrue : Qfalse);
|
|
64
64
|
#else
|
|
65
65
|
return Qfalse;
|
|
@@ -69,13 +69,13 @@ static VALUE ruby_curl_libz_q(VALUE mod) {
|
|
|
69
69
|
/*
|
|
70
70
|
* call-seq:
|
|
71
71
|
* Curl.ntlm? => true or false
|
|
72
|
-
*
|
|
72
|
+
*
|
|
73
73
|
* Returns true if the installed libcurl supports HTTP NTLM.
|
|
74
74
|
* For libcurl versions < 7.10.6, always returns false.
|
|
75
75
|
*/
|
|
76
76
|
static VALUE ruby_curl_ntlm_q(VALUE mod) {
|
|
77
|
-
#ifdef
|
|
78
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
77
|
+
#ifdef HAVE_CURL_VERSION_NTLM
|
|
78
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
79
79
|
return((ver->features & CURL_VERSION_NTLM) ? Qtrue : Qfalse);
|
|
80
80
|
#else
|
|
81
81
|
return Qfalse;
|
|
@@ -85,13 +85,13 @@ static VALUE ruby_curl_ntlm_q(VALUE mod) {
|
|
|
85
85
|
/*
|
|
86
86
|
* call-seq:
|
|
87
87
|
* Curl.gssnegotiate? => true or false
|
|
88
|
-
*
|
|
88
|
+
*
|
|
89
89
|
* Returns true if the installed libcurl supports HTTP GSS-Negotiate.
|
|
90
90
|
* For libcurl versions < 7.10.6, always returns false.
|
|
91
91
|
*/
|
|
92
92
|
static VALUE ruby_curl_gssnegotiate_q(VALUE mod) {
|
|
93
|
-
#ifdef
|
|
94
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
93
|
+
#ifdef HAVE_CURL_VERSION_GSSNEGOTIATE
|
|
94
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
95
95
|
return((ver->features & CURL_VERSION_GSSNEGOTIATE) ? Qtrue : Qfalse);
|
|
96
96
|
#else
|
|
97
97
|
return Qfalse;
|
|
@@ -101,14 +101,14 @@ static VALUE ruby_curl_gssnegotiate_q(VALUE mod) {
|
|
|
101
101
|
/*
|
|
102
102
|
* call-seq:
|
|
103
103
|
* Curl.debug? => true or false
|
|
104
|
-
*
|
|
105
|
-
* Returns true if the installed libcurl was built with extra debug
|
|
104
|
+
*
|
|
105
|
+
* Returns true if the installed libcurl was built with extra debug
|
|
106
106
|
* capabilities built-in. For libcurl versions < 7.10.6, always returns
|
|
107
107
|
* false.
|
|
108
108
|
*/
|
|
109
109
|
static VALUE ruby_curl_debug_q(VALUE mod) {
|
|
110
|
-
#ifdef
|
|
111
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
110
|
+
#ifdef HAVE_CURL_VERSION_DEBUG
|
|
111
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
112
112
|
return((ver->features & CURL_VERSION_DEBUG) ? Qtrue : Qfalse);
|
|
113
113
|
#else
|
|
114
114
|
return Qfalse;
|
|
@@ -118,15 +118,15 @@ static VALUE ruby_curl_debug_q(VALUE mod) {
|
|
|
118
118
|
/*
|
|
119
119
|
* call-seq:
|
|
120
120
|
* Curl.asyncdns? => true or false
|
|
121
|
-
*
|
|
121
|
+
*
|
|
122
122
|
* Returns true if the installed libcurl was built with support for
|
|
123
123
|
* asynchronous name lookups, which allows more exact timeouts (even
|
|
124
124
|
* on Windows) and less blocking when using the multi interface.
|
|
125
125
|
* For libcurl versions < 7.10.7, always returns false.
|
|
126
126
|
*/
|
|
127
127
|
static VALUE ruby_curl_asyncdns_q(VALUE mod) {
|
|
128
|
-
#ifdef
|
|
129
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
128
|
+
#ifdef HAVE_CURL_VERSION_ASYNCHDNS
|
|
129
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
130
130
|
return((ver->features & CURL_VERSION_ASYNCHDNS) ? Qtrue : Qfalse);
|
|
131
131
|
#else
|
|
132
132
|
return Qfalse;
|
|
@@ -136,14 +136,14 @@ static VALUE ruby_curl_asyncdns_q(VALUE mod) {
|
|
|
136
136
|
/*
|
|
137
137
|
* call-seq:
|
|
138
138
|
* Curl.spnego? => true or false
|
|
139
|
-
*
|
|
139
|
+
*
|
|
140
140
|
* Returns true if the installed libcurl was built with support for SPNEGO
|
|
141
141
|
* authentication (Simple and Protected GSS-API Negotiation Mechanism, defined
|
|
142
142
|
* in RFC 2478). For libcurl versions < 7.10.8, always returns false.
|
|
143
143
|
*/
|
|
144
144
|
static VALUE ruby_curl_spnego_q(VALUE mod) {
|
|
145
|
-
#ifdef
|
|
146
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
145
|
+
#ifdef HAVE_CURL_VERSION_SPNEGO
|
|
146
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
147
147
|
return((ver->features & CURL_VERSION_SPNEGO) ? Qtrue : Qfalse);
|
|
148
148
|
#else
|
|
149
149
|
return Qfalse;
|
|
@@ -153,13 +153,13 @@ static VALUE ruby_curl_spnego_q(VALUE mod) {
|
|
|
153
153
|
/*
|
|
154
154
|
* call-seq:
|
|
155
155
|
* Curl.largefile? => true or false
|
|
156
|
-
*
|
|
156
|
+
*
|
|
157
157
|
* Returns true if the installed libcurl was built with support for large
|
|
158
158
|
* files. For libcurl versions < 7.11.1, always returns false.
|
|
159
159
|
*/
|
|
160
160
|
static VALUE ruby_curl_largefile_q(VALUE mod) {
|
|
161
|
-
#ifdef
|
|
162
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
161
|
+
#ifdef HAVE_CURL_VERSION_LARGEFILE
|
|
162
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
163
163
|
return((ver->features & CURL_VERSION_LARGEFILE) ? Qtrue : Qfalse);
|
|
164
164
|
#else
|
|
165
165
|
return Qfalse;
|
|
@@ -169,14 +169,14 @@ static VALUE ruby_curl_largefile_q(VALUE mod) {
|
|
|
169
169
|
/*
|
|
170
170
|
* call-seq:
|
|
171
171
|
* Curl.idn? => true or false
|
|
172
|
-
*
|
|
173
|
-
* Returns true if the installed libcurl was built with support for IDNA,
|
|
174
|
-
* domain names with international letters. For libcurl versions < 7.12.0,
|
|
172
|
+
*
|
|
173
|
+
* Returns true if the installed libcurl was built with support for IDNA,
|
|
174
|
+
* domain names with international letters. For libcurl versions < 7.12.0,
|
|
175
175
|
* always returns false.
|
|
176
176
|
*/
|
|
177
177
|
static VALUE ruby_curl_idn_q(VALUE mod) {
|
|
178
|
-
#ifdef
|
|
179
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
178
|
+
#ifdef HAVE_CURL_VERSION_IDN
|
|
179
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
180
180
|
return((ver->features & CURL_VERSION_IDN) ? Qtrue : Qfalse);
|
|
181
181
|
#else
|
|
182
182
|
return Qfalse;
|
|
@@ -186,16 +186,16 @@ static VALUE ruby_curl_idn_q(VALUE mod) {
|
|
|
186
186
|
/*
|
|
187
187
|
* call-seq:
|
|
188
188
|
* Curl.sspi? => true or false
|
|
189
|
-
*
|
|
189
|
+
*
|
|
190
190
|
* Returns true if the installed libcurl was built with support for SSPI.
|
|
191
191
|
* This is only available on Windows and makes libcurl use Windows-provided
|
|
192
192
|
* functions for NTLM authentication. It also allows libcurl to use the current
|
|
193
|
-
* user and the current user's password without the app having to pass them on.
|
|
193
|
+
* user and the current user's password without the app having to pass them on.
|
|
194
194
|
* For libcurl versions < 7.13.2, always returns false.
|
|
195
195
|
*/
|
|
196
196
|
static VALUE ruby_curl_sspi_q(VALUE mod) {
|
|
197
|
-
#ifdef
|
|
198
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
197
|
+
#ifdef HAVE_CURL_VERSION_SSPI
|
|
198
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
199
199
|
return((ver->features & CURL_VERSION_SSPI) ? Qtrue : Qfalse);
|
|
200
200
|
#else
|
|
201
201
|
return Qfalse;
|
|
@@ -205,13 +205,13 @@ static VALUE ruby_curl_sspi_q(VALUE mod) {
|
|
|
205
205
|
/*
|
|
206
206
|
* call-seq:
|
|
207
207
|
* Curl.conv? => true or false
|
|
208
|
-
*
|
|
209
|
-
* Returns true if the installed libcurl was built with support for character
|
|
208
|
+
*
|
|
209
|
+
* Returns true if the installed libcurl was built with support for character
|
|
210
210
|
* conversions. For libcurl versions < 7.15.4, always returns false.
|
|
211
211
|
*/
|
|
212
212
|
static VALUE ruby_curl_conv_q(VALUE mod) {
|
|
213
|
-
#ifdef
|
|
214
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
213
|
+
#ifdef HAVE_CURL_VERSION_CONV
|
|
214
|
+
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
215
215
|
return((ver->features & CURL_VERSION_CONV) ? Qtrue : Qfalse);
|
|
216
216
|
#else
|
|
217
217
|
return Qfalse;
|
|
@@ -220,102 +220,138 @@ static VALUE ruby_curl_conv_q(VALUE mod) {
|
|
|
220
220
|
|
|
221
221
|
void Init_curb_core() {
|
|
222
222
|
// TODO we need to call curl_global_cleanup at exit!
|
|
223
|
-
|
|
224
|
-
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
|
223
|
+
curl_version_info_data *ver;
|
|
225
224
|
VALUE curlver, curllongver, curlvernum;
|
|
226
225
|
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
curl_global_init(CURL_GLOBAL_ALL);
|
|
227
|
+
ver = curl_version_info(CURLVERSION_NOW);
|
|
228
|
+
|
|
229
|
+
mCurl = rb_define_module("Curl");
|
|
230
|
+
|
|
229
231
|
curlver = rb_str_new2(ver->version);
|
|
230
232
|
curllongver = rb_str_new2(curl_version());
|
|
231
233
|
curlvernum = LONG2NUM(LIBCURL_VERSION_NUM);
|
|
232
|
-
|
|
233
|
-
rb_define_const(mCurl, "CURB_VERSION", rb_str_new2(CURB_VERSION));
|
|
234
|
+
|
|
235
|
+
rb_define_const(mCurl, "CURB_VERSION", rb_str_new2(CURB_VERSION));
|
|
234
236
|
rb_define_const(mCurl, "VERSION", curlver);
|
|
235
237
|
rb_define_const(mCurl, "CURL_VERSION", curlver);
|
|
236
238
|
rb_define_const(mCurl, "VERNUM", curlvernum);
|
|
237
239
|
rb_define_const(mCurl, "CURL_VERNUM", curlvernum);
|
|
238
|
-
rb_define_const(mCurl, "LONG_VERSION", curllongver);
|
|
239
|
-
rb_define_const(mCurl, "CURL_LONG_VERSION", curllongver);
|
|
240
|
+
rb_define_const(mCurl, "LONG_VERSION", curllongver);
|
|
241
|
+
rb_define_const(mCurl, "CURL_LONG_VERSION", curllongver);
|
|
240
242
|
|
|
241
243
|
/* Passed to on_debug handler to indicate that the data is informational text. */
|
|
242
244
|
rb_define_const(mCurl, "CURLINFO_TEXT", INT2FIX(CURLINFO_TEXT));
|
|
243
|
-
|
|
245
|
+
|
|
244
246
|
/* Passed to on_debug handler to indicate that the data is header (or header-like) data received from the peer. */
|
|
245
247
|
rb_define_const(mCurl, "CURLINFO_HEADER_IN", INT2FIX(CURLINFO_HEADER_IN));
|
|
246
|
-
|
|
248
|
+
|
|
247
249
|
/* Passed to on_debug handler to indicate that the data is header (or header-like) data sent to the peer. */
|
|
248
250
|
rb_define_const(mCurl, "CURLINFO_HEADER_OUT", INT2FIX(CURLINFO_HEADER_OUT));
|
|
249
|
-
|
|
251
|
+
|
|
250
252
|
/* Passed to on_debug handler to indicate that the data is protocol data received from the peer. */
|
|
251
253
|
rb_define_const(mCurl, "CURLINFO_DATA_IN", INT2FIX(CURLINFO_DATA_IN));
|
|
252
|
-
|
|
254
|
+
|
|
253
255
|
/* Passed to on_debug handler to indicate that the data is protocol data sent to the peer. */
|
|
254
256
|
rb_define_const(mCurl, "CURLINFO_DATA_OUT", INT2FIX(CURLINFO_DATA_OUT));
|
|
255
257
|
|
|
258
|
+
#ifdef HAVE_CURLFTPMETHOD_MULTICWD
|
|
259
|
+
rb_define_const(mCurl, "CURL_MULTICWD", INT2FIX(CURLFTPMETHOD_MULTICWD));
|
|
260
|
+
#endif
|
|
261
|
+
|
|
262
|
+
#ifdef HAVE_CURLFTPMETHOD_NOCWD
|
|
263
|
+
rb_define_const(mCurl, "CURL_NOCWD", INT2FIX(CURLFTPMETHOD_NOCWD));
|
|
264
|
+
#endif
|
|
265
|
+
|
|
266
|
+
#ifdef HAVE_CURLFTPMETHOD_SINGLECWD
|
|
267
|
+
rb_define_const(mCurl, "CURL_SINGLECWD", INT2FIX(CURLFTPMETHOD_SINGLECWD));
|
|
268
|
+
#endif
|
|
269
|
+
|
|
256
270
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is an HTTP proxy. (libcurl >= 7.10) */
|
|
257
|
-
#ifdef
|
|
271
|
+
#ifdef HAVE_CURLPROXY_HTTP
|
|
258
272
|
rb_define_const(mCurl, "CURLPROXY_HTTP", INT2FIX(CURLPROXY_HTTP));
|
|
259
273
|
#else
|
|
260
274
|
rb_define_const(mCurl, "CURLPROXY_HTTP", INT2FIX(-1));
|
|
261
275
|
#endif
|
|
262
276
|
|
|
277
|
+
#ifdef CURL_VERSION_SSL
|
|
278
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT", INT2FIX(CURL_SSLVERSION_DEFAULT));
|
|
279
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1", INT2FIX(CURL_SSLVERSION_TLSv1));
|
|
280
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2", INT2FIX(CURL_SSLVERSION_SSLv2));
|
|
281
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3", INT2FIX(CURL_SSLVERSION_SSLv3));
|
|
282
|
+
|
|
283
|
+
rb_define_const(mCurl, "CURL_USESSL_CONTROL", INT2FIX(CURB_FTPSSL_CONTROL));
|
|
284
|
+
rb_define_const(mCurl, "CURL_USESSL_NONE", INT2FIX(CURB_FTPSSL_NONE));
|
|
285
|
+
rb_define_const(mCurl, "CURL_USESSL_TRY", INT2FIX(CURB_FTPSSL_TRY));
|
|
286
|
+
rb_define_const(mCurl, "CURL_USESSL_ALL", INT2FIX(CURB_FTPSSL_ALL));
|
|
287
|
+
#else
|
|
288
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_DEFAULT", INT2FIX(-1));
|
|
289
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_TLSv1", INT2FIX(-1));
|
|
290
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv2", INT2FIX(-1));
|
|
291
|
+
rb_define_const(mCurl, "CURL_SSLVERSION_SSLv3", INT2FIX(-1));
|
|
292
|
+
|
|
293
|
+
rb_define_const(mCurl, "CURL_USESSL_CONTROL", INT2FIX(-1));
|
|
294
|
+
rb_define_const(mCurl, "CURL_USESSL_NONE", INT2FIX(-1));
|
|
295
|
+
rb_define_const(mCurl, "CURL_USESSL_TRY", INT2FIX(-1));
|
|
296
|
+
rb_define_const(mCurl, "CURL_USESSL_ALL", INT2FIX(-1));
|
|
297
|
+
#endif
|
|
298
|
+
|
|
263
299
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS4 proxy. (libcurl >= 7.15.2) */
|
|
264
|
-
#ifdef
|
|
300
|
+
#ifdef HAVE_CURLPROXY_SOCKS4
|
|
265
301
|
rb_define_const(mCurl, "CURLPROXY_SOCKS4", INT2FIX(CURLPROXY_SOCKS4));
|
|
266
302
|
#else
|
|
267
303
|
rb_define_const(mCurl, "CURLPROXY_SOCKS4", INT2FIX(-2));
|
|
268
304
|
#endif
|
|
269
305
|
|
|
270
306
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS5 proxy. (libcurl >= 7.10) */
|
|
271
|
-
#ifdef
|
|
307
|
+
#ifdef HAVE_CURLPROXY_SOCKS5
|
|
272
308
|
rb_define_const(mCurl, "CURLPROXY_SOCKS5", INT2FIX(CURLPROXY_SOCKS5));
|
|
273
309
|
#else
|
|
274
310
|
rb_define_const(mCurl, "CURLPROXY_SOCKS5", INT2FIX(-2));
|
|
275
311
|
#endif
|
|
276
312
|
|
|
277
313
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use Basic authentication. */
|
|
278
|
-
#ifdef
|
|
314
|
+
#ifdef HAVE_CURLAUTH_BASIC
|
|
279
315
|
rb_define_const(mCurl, "CURLAUTH_BASIC", INT2FIX(CURLAUTH_BASIC));
|
|
280
316
|
#else
|
|
281
|
-
rb_define_const(mCurl, "CURLAUTH_BASIC", INT2FIX(0);
|
|
317
|
+
rb_define_const(mCurl, "CURLAUTH_BASIC", INT2FIX(0));
|
|
282
318
|
#endif
|
|
283
319
|
|
|
284
320
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use Digest authentication. */
|
|
285
|
-
#ifdef
|
|
321
|
+
#ifdef HAVE_CURLAUTH_DIGEST
|
|
286
322
|
rb_define_const(mCurl, "CURLAUTH_DIGEST", INT2FIX(CURLAUTH_DIGEST));
|
|
287
323
|
#else
|
|
288
324
|
rb_define_const(mCurl, "CURLAUTH_DIGEST", INT2FIX(0));
|
|
289
325
|
#endif
|
|
290
326
|
|
|
291
327
|
/* 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. */
|
|
292
|
-
#ifdef
|
|
328
|
+
#ifdef HAVE_CURLAUTH_GSSNEGOTIATE
|
|
293
329
|
rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE", INT2FIX(CURLAUTH_GSSNEGOTIATE));
|
|
294
330
|
#else
|
|
295
331
|
rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE", INT2FIX(0));
|
|
296
332
|
#endif
|
|
297
333
|
|
|
298
334
|
/* 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. */
|
|
299
|
-
#ifdef
|
|
335
|
+
#ifdef HAVE_CURLAUTH_NTLM
|
|
300
336
|
rb_define_const(mCurl, "CURLAUTH_NTLM", INT2FIX(CURLAUTH_NTLM));
|
|
301
337
|
#else
|
|
302
338
|
rb_define_const(mCurl, "CURLAUTH_NTLM", INT2FIX(0));
|
|
303
339
|
#endif
|
|
304
340
|
|
|
305
341
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, allows libcurl to select any suitable authentication method except basic. */
|
|
306
|
-
#ifdef
|
|
342
|
+
#ifdef HAVE_CURLAUTH_ANYSAFE
|
|
307
343
|
rb_define_const(mCurl, "CURLAUTH_ANYSAFE", INT2FIX(CURLAUTH_ANYSAFE));
|
|
308
344
|
#else
|
|
309
345
|
rb_define_const(mCurl, "CURLAUTH_ANYSAFE", INT2FIX(0));
|
|
310
346
|
#endif
|
|
311
347
|
|
|
312
348
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, allows libcurl to select any suitable authentication method. */
|
|
313
|
-
#ifdef
|
|
349
|
+
#ifdef HAVE_CURLAUTH_ANY
|
|
314
350
|
rb_define_const(mCurl, "CURLAUTH_ANY", INT2FIX(CURLAUTH_ANY));
|
|
315
351
|
#else
|
|
316
352
|
rb_define_const(mCurl, "CURLAUTH_ANY", INT2FIX(0));
|
|
317
353
|
#endif
|
|
318
|
-
|
|
354
|
+
|
|
319
355
|
rb_define_singleton_method(mCurl, "ipv6?", ruby_curl_ipv6_q, 0);
|
|
320
356
|
rb_define_singleton_method(mCurl, "kerberos4?", ruby_curl_kerberos4_q, 0);
|
|
321
357
|
rb_define_singleton_method(mCurl, "ssl?", ruby_curl_ssl_q, 0);
|
|
@@ -333,4 +369,5 @@ void Init_curb_core() {
|
|
|
333
369
|
init_curb_errors();
|
|
334
370
|
init_curb_easy();
|
|
335
371
|
init_curb_postfield();
|
|
372
|
+
init_curb_multi();
|
|
336
373
|
}
|
data/ext/curb.h
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Curb - Libcurl(3) bindings for Ruby.
|
|
2
|
-
* Copyright (c)2006 Ross Bamford.
|
|
2
|
+
* Copyright (c)2006 Ross Bamford.
|
|
3
3
|
* Licensed under the Ruby License. See LICENSE for details.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* $Id: curb.h 39 2006-12-23 15:28:45Z roscopeco $
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -11,24 +11,38 @@
|
|
|
11
11
|
#include <ruby.h>
|
|
12
12
|
#include <curl/curl.h>
|
|
13
13
|
|
|
14
|
+
#include "curb_config.h"
|
|
14
15
|
#include "curb_easy.h"
|
|
15
16
|
#include "curb_errors.h"
|
|
16
17
|
#include "curb_postfield.h"
|
|
18
|
+
#include "curb_multi.h"
|
|
17
19
|
|
|
18
20
|
#include "curb_macros.h"
|
|
19
21
|
|
|
20
22
|
// These should be managed from the Rake 'release' task.
|
|
21
|
-
#define CURB_VERSION "0.
|
|
22
|
-
#define CURB_VER_NUM
|
|
23
|
+
#define CURB_VERSION "0.7.15"
|
|
24
|
+
#define CURB_VER_NUM 715
|
|
23
25
|
#define CURB_VER_MAJ 0
|
|
24
|
-
#define CURB_VER_MIN
|
|
25
|
-
#define CURB_VER_MIC
|
|
26
|
-
#define CURB_VER_PATCH
|
|
26
|
+
#define CURB_VER_MIN 7
|
|
27
|
+
#define CURB_VER_MIC 1
|
|
28
|
+
#define CURB_VER_PATCH 5
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
// Maybe not yet defined in Ruby
|
|
30
|
-
#ifndef RSTRING_LEN
|
|
31
|
-
#define RSTRING_LEN(x) RSTRING(x)->len
|
|
32
|
+
#ifndef RSTRING_LEN
|
|
33
|
+
#define RSTRING_LEN(x) RSTRING(x)->len
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
#ifndef RSTRING_PTR
|
|
37
|
+
#define RSTRING_PTR(x) RSTRING(x)->ptr
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#ifndef RHASH_LEN
|
|
41
|
+
#ifdef HAVE_RUBY19_HASH
|
|
42
|
+
#define RHASH_LEN(hash) RHASH(hash)->ntbl->num_entries
|
|
43
|
+
#else
|
|
44
|
+
#define RHASH_LEN(hash) RHASH(hash)->tbl->num_entries
|
|
45
|
+
#endif
|
|
32
46
|
#endif
|
|
33
47
|
|
|
34
48
|
extern VALUE mCurl;
|
|
@@ -36,4 +50,3 @@ extern VALUE mCurl;
|
|
|
36
50
|
extern void Init_curb_core();
|
|
37
51
|
|
|
38
52
|
#endif
|
|
39
|
-
|