taf2-curb 0.2.3 → 0.2.4
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/ext/curb.c +20 -20
- data/ext/curb.h +4 -3
- data/ext/curb.rb +2 -0
- data/ext/curb_easy.c +27 -11
- data/ext/curb_errors.c +7 -7
- data/ext/curb_multi.c +1 -1
- data/ext/extconf.rb +58 -2
- data/tests/helper.rb +39 -1
- data/tests/tc_curl_easy.rb +2 -31
- data/tests/tc_curl_multi.rb +2 -2
- metadata +3 -3
data/ext/curb.c
CHANGED
@@ -42,7 +42,7 @@ static VALUE ruby_curl_kerberos4_q(VALUE mod) {
|
|
42
42
|
* For libcurl versions < 7.10, always returns false.
|
43
43
|
*/
|
44
44
|
static VALUE ruby_curl_ssl_q(VALUE mod) {
|
45
|
-
#ifdef
|
45
|
+
#ifdef HAVE_CURL_VERSION_SSL
|
46
46
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
47
47
|
return((ver->features & CURL_VERSION_SSL) ? Qtrue : Qfalse);
|
48
48
|
#else
|
@@ -58,7 +58,7 @@ static VALUE ruby_curl_ssl_q(VALUE mod) {
|
|
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
|
61
|
+
#ifdef HAVE_CURL_VERSION_LIBZ
|
62
62
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
63
63
|
return((ver->features & CURL_VERSION_LIBZ) ? Qtrue : Qfalse);
|
64
64
|
#else
|
@@ -74,7 +74,7 @@ static VALUE ruby_curl_libz_q(VALUE mod) {
|
|
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
|
77
|
+
#ifdef HAVE_CURL_VERSION_NTLM
|
78
78
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
79
79
|
return((ver->features & CURL_VERSION_NTLM) ? Qtrue : Qfalse);
|
80
80
|
#else
|
@@ -90,7 +90,7 @@ static VALUE ruby_curl_ntlm_q(VALUE mod) {
|
|
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
|
93
|
+
#ifdef HAVE_CURL_VERSION_GSSNEGOTIATE
|
94
94
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
95
95
|
return((ver->features & CURL_VERSION_GSSNEGOTIATE) ? Qtrue : Qfalse);
|
96
96
|
#else
|
@@ -107,7 +107,7 @@ static VALUE ruby_curl_gssnegotiate_q(VALUE mod) {
|
|
107
107
|
* false.
|
108
108
|
*/
|
109
109
|
static VALUE ruby_curl_debug_q(VALUE mod) {
|
110
|
-
#ifdef
|
110
|
+
#ifdef HAVE_CURL_VERSION_DEBUG
|
111
111
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
112
112
|
return((ver->features & CURL_VERSION_DEBUG) ? Qtrue : Qfalse);
|
113
113
|
#else
|
@@ -125,7 +125,7 @@ static VALUE ruby_curl_debug_q(VALUE mod) {
|
|
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
|
128
|
+
#ifdef HAVE_CURL_VERSION_ASYNCHDNS
|
129
129
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
130
130
|
return((ver->features & CURL_VERSION_ASYNCHDNS) ? Qtrue : Qfalse);
|
131
131
|
#else
|
@@ -142,7 +142,7 @@ static VALUE ruby_curl_asyncdns_q(VALUE mod) {
|
|
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
|
145
|
+
#ifdef HAVE_CURL_VERSION_SPNEGO
|
146
146
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
147
147
|
return((ver->features & CURL_VERSION_SPNEGO) ? Qtrue : Qfalse);
|
148
148
|
#else
|
@@ -158,7 +158,7 @@ static VALUE ruby_curl_spnego_q(VALUE mod) {
|
|
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
|
161
|
+
#ifdef HAVE_CURL_VERSION_LARGEFILE
|
162
162
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
163
163
|
return((ver->features & CURL_VERSION_LARGEFILE) ? Qtrue : Qfalse);
|
164
164
|
#else
|
@@ -175,7 +175,7 @@ static VALUE ruby_curl_largefile_q(VALUE mod) {
|
|
175
175
|
* always returns false.
|
176
176
|
*/
|
177
177
|
static VALUE ruby_curl_idn_q(VALUE mod) {
|
178
|
-
#ifdef
|
178
|
+
#ifdef HAVE_CURL_VERSION_IDN
|
179
179
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
180
180
|
return((ver->features & CURL_VERSION_IDN) ? Qtrue : Qfalse);
|
181
181
|
#else
|
@@ -194,7 +194,7 @@ static VALUE ruby_curl_idn_q(VALUE mod) {
|
|
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
|
197
|
+
#ifdef HAVE_CURL_VERSION_SSPI
|
198
198
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
199
199
|
return((ver->features & CURL_VERSION_SSPI) ? Qtrue : Qfalse);
|
200
200
|
#else
|
@@ -210,7 +210,7 @@ static VALUE ruby_curl_sspi_q(VALUE mod) {
|
|
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
|
213
|
+
#ifdef HAVE_CURL_VERSION_CONV
|
214
214
|
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
|
215
215
|
return((ver->features & CURL_VERSION_CONV) ? Qtrue : Qfalse);
|
216
216
|
#else
|
@@ -254,63 +254,63 @@ void Init_curb_core() {
|
|
254
254
|
rb_define_const(mCurl, "CURLINFO_DATA_OUT", INT2FIX(CURLINFO_DATA_OUT));
|
255
255
|
|
256
256
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is an HTTP proxy. (libcurl >= 7.10) */
|
257
|
-
#ifdef
|
257
|
+
#ifdef HAVE_CURLPROXY_HTTP
|
258
258
|
rb_define_const(mCurl, "CURLPROXY_HTTP", INT2FIX(CURLPROXY_HTTP));
|
259
259
|
#else
|
260
260
|
rb_define_const(mCurl, "CURLPROXY_HTTP", INT2FIX(-1));
|
261
261
|
#endif
|
262
262
|
|
263
263
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS4 proxy. (libcurl >= 7.15.2) */
|
264
|
-
#ifdef
|
264
|
+
#ifdef HAVE_CURLPROXY_SOCKS4
|
265
265
|
rb_define_const(mCurl, "CURLPROXY_SOCKS4", INT2FIX(CURLPROXY_SOCKS4));
|
266
266
|
#else
|
267
267
|
rb_define_const(mCurl, "CURLPROXY_SOCKS4", INT2FIX(-2));
|
268
268
|
#endif
|
269
269
|
|
270
270
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS5 proxy. (libcurl >= 7.10) */
|
271
|
-
#ifdef
|
271
|
+
#ifdef HAVE_CURLPROXY_SOCKS5
|
272
272
|
rb_define_const(mCurl, "CURLPROXY_SOCKS5", INT2FIX(CURLPROXY_SOCKS5));
|
273
273
|
#else
|
274
274
|
rb_define_const(mCurl, "CURLPROXY_SOCKS5", INT2FIX(-2));
|
275
275
|
#endif
|
276
276
|
|
277
277
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use Basic authentication. */
|
278
|
-
#ifdef
|
278
|
+
#ifdef HAVE_CURLAUTH_BASIC
|
279
279
|
rb_define_const(mCurl, "CURLAUTH_BASIC", INT2FIX(CURLAUTH_BASIC));
|
280
280
|
#else
|
281
281
|
rb_define_const(mCurl, "CURLAUTH_BASIC", INT2FIX(0);
|
282
282
|
#endif
|
283
283
|
|
284
284
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, directs libcurl to use Digest authentication. */
|
285
|
-
#ifdef
|
285
|
+
#ifdef HAVE_CURLAUTH_DIGEST
|
286
286
|
rb_define_const(mCurl, "CURLAUTH_DIGEST", INT2FIX(CURLAUTH_DIGEST));
|
287
287
|
#else
|
288
288
|
rb_define_const(mCurl, "CURLAUTH_DIGEST", INT2FIX(0));
|
289
289
|
#endif
|
290
290
|
|
291
291
|
/* 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
|
292
|
+
#ifdef HAVE_CURLAUTH_GSSNEGOTIATE
|
293
293
|
rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE", INT2FIX(CURLAUTH_GSSNEGOTIATE));
|
294
294
|
#else
|
295
295
|
rb_define_const(mCurl, "CURLAUTH_GSSNEGOTIATE", INT2FIX(0));
|
296
296
|
#endif
|
297
297
|
|
298
298
|
/* 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
|
299
|
+
#ifdef HAVE_CURLAUTH_NTLM
|
300
300
|
rb_define_const(mCurl, "CURLAUTH_NTLM", INT2FIX(CURLAUTH_NTLM));
|
301
301
|
#else
|
302
302
|
rb_define_const(mCurl, "CURLAUTH_NTLM", INT2FIX(0));
|
303
303
|
#endif
|
304
304
|
|
305
305
|
/* 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
|
306
|
+
#ifdef HAVE_CURLAUTH_ANYSAFE
|
307
307
|
rb_define_const(mCurl, "CURLAUTH_ANYSAFE", INT2FIX(CURLAUTH_ANYSAFE));
|
308
308
|
#else
|
309
309
|
rb_define_const(mCurl, "CURLAUTH_ANYSAFE", INT2FIX(0));
|
310
310
|
#endif
|
311
311
|
|
312
312
|
/* When passed to Curl::Easy#http_auth_types or Curl::Easy#proxy_auth_types, allows libcurl to select any suitable authentication method. */
|
313
|
-
#ifdef
|
313
|
+
#ifdef HAVE_CURLAUTH_ANY
|
314
314
|
rb_define_const(mCurl, "CURLAUTH_ANY", INT2FIX(CURLAUTH_ANY));
|
315
315
|
#else
|
316
316
|
rb_define_const(mCurl, "CURLAUTH_ANY", INT2FIX(0));
|
data/ext/curb.h
CHANGED
@@ -11,6 +11,7 @@
|
|
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"
|
@@ -19,11 +20,11 @@
|
|
19
20
|
#include "curb_macros.h"
|
20
21
|
|
21
22
|
// These should be managed from the Rake 'release' task.
|
22
|
-
#define CURB_VERSION "0.2.
|
23
|
-
#define CURB_VER_NUM
|
23
|
+
#define CURB_VERSION "0.2.4.1"
|
24
|
+
#define CURB_VER_NUM 224
|
24
25
|
#define CURB_VER_MAJ 0
|
25
26
|
#define CURB_VER_MIN 2
|
26
|
-
#define CURB_VER_MIC
|
27
|
+
#define CURB_VER_MIC 4
|
27
28
|
#define CURB_VER_PATCH 0
|
28
29
|
|
29
30
|
|
data/ext/curb.rb
CHANGED
data/ext/curb_easy.c
CHANGED
@@ -1383,13 +1383,29 @@ VALUE ruby_curl_easy_cleanup( VALUE self, ruby_curl_easy *rbce, VALUE bodybuf, V
|
|
1383
1383
|
|
1384
1384
|
// Sort out the built-in body/header data.
|
1385
1385
|
if (bodybuf != Qnil) {
|
1386
|
-
|
1386
|
+
if (TYPE(bodybuf) == T_STRING) {
|
1387
|
+
rbce->body_data = rb_str_to_str(bodybuf);
|
1388
|
+
}
|
1389
|
+
else if (rb_respond_to(bodybuf, rb_intern("to_str"))) {
|
1390
|
+
rbce->body_data = rb_funcall(bodybuf, rb_intern("to_str"), 0);
|
1391
|
+
}
|
1392
|
+
else {
|
1393
|
+
rbce->body_data = Qnil;
|
1394
|
+
}
|
1387
1395
|
} else {
|
1388
1396
|
rbce->body_data = Qnil;
|
1389
1397
|
}
|
1390
1398
|
|
1391
1399
|
if (headerbuf != Qnil) {
|
1392
|
-
|
1400
|
+
if (TYPE(headerbuf) == T_STRING) {
|
1401
|
+
rbce->header_data = rb_str_to_str(headerbuf);
|
1402
|
+
}
|
1403
|
+
else if (rb_respond_to(headerbuf, rb_intern("to_str"))) {
|
1404
|
+
rbce->header_data = rb_funcall(headerbuf, rb_intern("to_str"), 0);
|
1405
|
+
}
|
1406
|
+
else {
|
1407
|
+
rbce->header_data = Qnil;
|
1408
|
+
}
|
1393
1409
|
} else {
|
1394
1410
|
rbce->header_data = Qnil;
|
1395
1411
|
}
|
@@ -1748,7 +1764,7 @@ static VALUE ruby_curl_easy_response_code_get(VALUE self) {
|
|
1748
1764
|
long code;
|
1749
1765
|
|
1750
1766
|
Data_Get_Struct(self, ruby_curl_easy, rbce);
|
1751
|
-
#ifdef
|
1767
|
+
#ifdef HAVE_CURLINFO_RESPONSE_CODE
|
1752
1768
|
curl_easy_getinfo(rbce->curl, CURLINFO_RESPONSE_CODE, &code);
|
1753
1769
|
#else
|
1754
1770
|
// old libcurl
|
@@ -1792,7 +1808,7 @@ static VALUE ruby_curl_easy_http_connect_code_get(VALUE self) {
|
|
1792
1808
|
* returned.
|
1793
1809
|
*/
|
1794
1810
|
static VALUE ruby_curl_easy_file_time_get(VALUE self) {
|
1795
|
-
#ifdef
|
1811
|
+
#ifdef HAVE_CURLINFO_FILETIME
|
1796
1812
|
ruby_curl_easy *rbce;
|
1797
1813
|
long time;
|
1798
1814
|
|
@@ -1906,7 +1922,7 @@ static VALUE ruby_curl_easy_start_transfer_time_get(VALUE self) {
|
|
1906
1922
|
* Requires libcurl 7.9.7 or higher, otherwise -1 is always returned.
|
1907
1923
|
*/
|
1908
1924
|
static VALUE ruby_curl_easy_redirect_time_get(VALUE self) {
|
1909
|
-
#ifdef
|
1925
|
+
#ifdef HAVE_CURLINFO_REDIRECT_TIME
|
1910
1926
|
ruby_curl_easy *rbce;
|
1911
1927
|
double time;
|
1912
1928
|
|
@@ -1929,7 +1945,7 @@ static VALUE ruby_curl_easy_redirect_time_get(VALUE self) {
|
|
1929
1945
|
* Requires libcurl 7.9.7 or higher, otherwise -1 is always returned.
|
1930
1946
|
*/
|
1931
1947
|
static VALUE ruby_curl_easy_redirect_count_get(VALUE self) {
|
1932
|
-
#ifdef
|
1948
|
+
#ifdef HAVE_CURLINFO_REDIRECT_COUNT
|
1933
1949
|
ruby_curl_easy *rbce;
|
1934
1950
|
long count;
|
1935
1951
|
|
@@ -2154,7 +2170,7 @@ Pass a pointer to a long to receive a bitmask indicating the authentication meth
|
|
2154
2170
|
* libcurl 7.12.2 or higher, otherwise 0 is always returned).
|
2155
2171
|
*/
|
2156
2172
|
static VALUE ruby_curl_easy_os_errno_get(VALUE self) {
|
2157
|
-
#ifdef
|
2173
|
+
#ifdef HAVE_CURLINFO_OS_ERRNO
|
2158
2174
|
ruby_curl_easy *rbce;
|
2159
2175
|
long result;
|
2160
2176
|
|
@@ -2183,7 +2199,7 @@ static VALUE ruby_curl_easy_os_errno_get(VALUE self) {
|
|
2183
2199
|
* (requires libcurl 7.12.3 or higher, otherwise -1 is always returned).
|
2184
2200
|
*/
|
2185
2201
|
static VALUE ruby_curl_easy_num_connects_get(VALUE self) {
|
2186
|
-
#ifdef
|
2202
|
+
#ifdef HAVE_CURLINFO_NUM_CONNECTS
|
2187
2203
|
ruby_curl_easy *rbce;
|
2188
2204
|
long result;
|
2189
2205
|
|
@@ -2224,14 +2240,14 @@ Pass a pointer to a long to receive the last socket used by this curl session. I
|
|
2224
2240
|
* (requires libcurl 7.15.4 or higher, otherwise +nil+ is always returned).
|
2225
2241
|
*/
|
2226
2242
|
static VALUE ruby_curl_easy_ftp_entry_path_get(VALUE self) {
|
2227
|
-
#ifdef
|
2243
|
+
#ifdef HAVE_CURLINFO_FTP_ENTRY_PATH
|
2228
2244
|
ruby_curl_easy *rbce;
|
2229
|
-
char* path;
|
2245
|
+
char* path = NULL;
|
2230
2246
|
|
2231
2247
|
Data_Get_Struct(self, ruby_curl_easy, rbce);
|
2232
2248
|
curl_easy_getinfo(rbce->curl, CURLINFO_FTP_ENTRY_PATH, &path);
|
2233
2249
|
|
2234
|
-
if (
|
2250
|
+
if (path && path[0]) { // curl returns NULL or empty string if none
|
2235
2251
|
return rb_str_new2(path);
|
2236
2252
|
} else {
|
2237
2253
|
return Qnil;
|
data/ext/curb_errors.c
CHANGED
@@ -320,37 +320,37 @@ void raise_curl_easy_error_exception(CURLcode code) {
|
|
320
320
|
break;
|
321
321
|
|
322
322
|
// recent additions, may not be present in all supported versions
|
323
|
-
#ifdef
|
323
|
+
#ifdef HAVE_CURLE_TFTP_NOTFOUND
|
324
324
|
case CURLE_TFTP_NOTFOUND: /* 68 - file not found on server */
|
325
325
|
exclz = eCurlErrTFTPNotFound;
|
326
326
|
break;
|
327
327
|
#endif
|
328
|
-
#ifdef
|
328
|
+
#ifdef HAVE_CURLE_TFTP_PERM
|
329
329
|
case CURLE_TFTP_PERM: /* 69 - permission problem on server */
|
330
330
|
exclz = eCurlErrTFTPPermission;
|
331
331
|
break;
|
332
332
|
#endif
|
333
|
-
#ifdef
|
333
|
+
#ifdef HAVE_CURLE_TFTP_DISKFULL
|
334
334
|
case CURLE_TFTP_DISKFULL: /* 70 - out of disk space on server */
|
335
335
|
exclz = eCurlErrTFTPDiskFull;
|
336
336
|
break;
|
337
337
|
#endif
|
338
|
-
#ifdef
|
338
|
+
#ifdef HAVE_CURLE_TFTP_ILLEGAL
|
339
339
|
case CURLE_TFTP_ILLEGAL: /* 71 - Illegal TFTP operation */
|
340
340
|
exclz = eCurlErrTFTPIllegalOperation;
|
341
341
|
break;
|
342
342
|
#endif
|
343
|
-
#ifdef
|
343
|
+
#ifdef HAVE_CURLE_TFTP_UNKNOWNID
|
344
344
|
case CURLE_TFTP_UNKNOWNID: /* 72 - Unknown transfer ID */
|
345
345
|
exclz = eCurlErrTFTPUnknownID;
|
346
346
|
break;
|
347
347
|
#endif
|
348
|
-
#ifdef
|
348
|
+
#ifdef HAVE_CURLE_TFTP_EXISTS
|
349
349
|
case CURLE_TFTP_EXISTS: /* 73 - File already exists */
|
350
350
|
exclz = eCurlErrTFTPFileExists;
|
351
351
|
break;
|
352
352
|
#endif
|
353
|
-
#ifdef
|
353
|
+
#ifdef HAVE_CURLE_TFTP_NOSUCHUSER
|
354
354
|
case CURLE_TFTP_NOSUCHUSER: /* 74 - No such user */
|
355
355
|
exclz = eCurlErrTFTPNotFound;
|
356
356
|
break;
|
data/ext/curb_multi.c
CHANGED
@@ -174,7 +174,7 @@ static void rb_curl_multi_read_info(VALUE self, CURLM *multi_handle) {
|
|
174
174
|
easy_handle = msg->easy_handle;
|
175
175
|
result = msg->data.result;
|
176
176
|
if (easy_handle) {
|
177
|
-
ecode = curl_easy_getinfo(easy_handle, CURLINFO_PRIVATE, &rbce);
|
177
|
+
ecode = curl_easy_getinfo(easy_handle, CURLINFO_PRIVATE, (char**)&rbce);
|
178
178
|
if (ecode != 0) {
|
179
179
|
raise_curl_easy_error_exception(ecode);
|
180
180
|
}
|
data/ext/extconf.rb
CHANGED
@@ -14,12 +14,68 @@ elsif !have_library('curl') or !have_header('curl/curl.h')
|
|
14
14
|
EOM
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
def define(s)
|
18
|
+
$defs.push( format("-D HAVE_%s", s.to_s.upcase) )
|
19
|
+
end
|
20
|
+
|
21
|
+
def have_constant(name)
|
22
|
+
checking_for name do
|
23
|
+
src = %{
|
24
|
+
#include <curl/curl.h>
|
25
|
+
int main() {
|
26
|
+
int test = (int)#{name.upcase};
|
27
|
+
return 0;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
if try_compile(src,"#{$CFLAGS} #{$LIBS}")
|
31
|
+
define name
|
32
|
+
true
|
33
|
+
else
|
34
|
+
false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
have_constant "curlinfo_redirect_time"
|
40
|
+
have_constant "curlinfo_response_code"
|
41
|
+
have_constant "curlinfo_filetime"
|
42
|
+
have_constant "curlinfo_redirect_count"
|
43
|
+
have_constant "curlinfo_os_errno"
|
44
|
+
have_constant "curlinfo_num_connects"
|
45
|
+
have_constant "curlinfo_ftp_entry_path"
|
46
|
+
have_constant "curl_version_ssl"
|
47
|
+
have_constant "curl_version_libz"
|
48
|
+
have_constant "curl_version_ntlm"
|
49
|
+
have_constant "curl_version_gssnegotiate"
|
50
|
+
have_constant "curl_version_debug"
|
51
|
+
have_constant "curl_version_asynchdns"
|
52
|
+
have_constant "curl_version_spnego"
|
53
|
+
have_constant "curl_version_largefile"
|
54
|
+
have_constant "curl_version_idn"
|
55
|
+
have_constant "curl_version_sspi"
|
56
|
+
have_constant "curl_version_conv"
|
57
|
+
have_constant "curlproxy_http"
|
58
|
+
have_constant "curlproxy_socks4"
|
59
|
+
have_constant "curlproxy_socks5"
|
60
|
+
have_constant "curlauth_basic"
|
61
|
+
have_constant "curlauth_digest"
|
62
|
+
have_constant "curlauth_gssnegotiate"
|
63
|
+
have_constant "curlauth_ntlm"
|
64
|
+
have_constant "curlauth_anysafe"
|
65
|
+
have_constant "curlauth_any"
|
66
|
+
have_constant "curle_tftp_notfound"
|
67
|
+
have_constant "curle_tftp_perm"
|
68
|
+
have_constant "curle_tftp_diskfull"
|
69
|
+
have_constant "curle_tftp_illegal"
|
70
|
+
have_constant "curle_tftp_unknownid"
|
71
|
+
have_constant "curle_tftp_exists"
|
72
|
+
have_constant "curle_tftp_nosuchuser"
|
73
|
+
|
19
74
|
$INSTALLFILES = [["curb.rb", "$(RUBYLIBDIR)", "../ext"], ["curl.rb", "$(RUBYLIBDIR)", "../ext"]]
|
20
75
|
|
21
76
|
if try_compile('int main() { return 0; }','-Wall')
|
22
77
|
$CFLAGS << ' -Wall'
|
23
78
|
end
|
24
79
|
|
80
|
+
create_header('curb_config.h')
|
25
81
|
create_makefile('curb_core')
|
data/tests/helper.rb
CHANGED
@@ -35,8 +35,12 @@ end
|
|
35
35
|
#
|
36
36
|
class TestServlet < WEBrick::HTTPServlet::AbstractServlet
|
37
37
|
|
38
|
+
def self.port=(p)
|
39
|
+
@port = p
|
40
|
+
end
|
41
|
+
|
38
42
|
def self.port
|
39
|
-
9129
|
43
|
+
(@port or 9129)
|
40
44
|
end
|
41
45
|
|
42
46
|
def self.path
|
@@ -69,3 +73,37 @@ class TestServlet < WEBrick::HTTPServlet::AbstractServlet
|
|
69
73
|
end
|
70
74
|
|
71
75
|
end
|
76
|
+
|
77
|
+
module TestServerMethods
|
78
|
+
def locked_file
|
79
|
+
File.join(File.dirname(__FILE__),"server_lock-#{@__port}")
|
80
|
+
end
|
81
|
+
|
82
|
+
def server_setup(port=9129,servlet=TestServlet)
|
83
|
+
@__port = port
|
84
|
+
if @server.nil? and !File.exist?(locked_file)
|
85
|
+
File.open(locked_file,'w') {|f| f << 'locked' }
|
86
|
+
|
87
|
+
# start up a webrick server for testing delete
|
88
|
+
@server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => File.expand_path(File.dirname(__FILE__))
|
89
|
+
|
90
|
+
@server.mount(servlet.path, servlet)
|
91
|
+
|
92
|
+
@test_thread = Thread.new { @server.start }
|
93
|
+
|
94
|
+
exit_code = lambda do
|
95
|
+
begin
|
96
|
+
#puts "stopping"
|
97
|
+
File.unlink locked_file if File.exist?(locked_file)
|
98
|
+
@server.shutdown unless @server.nil?
|
99
|
+
rescue Object => e
|
100
|
+
puts "Error #{__FILE__}:#{__LINE__}\n#{e.message}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
trap("INT"){exit_code.call}
|
105
|
+
at_exit{exit_code.call}
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
data/tests/tc_curl_easy.rb
CHANGED
@@ -486,39 +486,10 @@ class TestCurbCurlEasy < Test::Unit::TestCase
|
|
486
486
|
# assert_equal 'PUT', curl.body_str
|
487
487
|
# end
|
488
488
|
|
489
|
-
|
490
|
-
File.join(File.dirname(__FILE__),'server_lock')
|
491
|
-
end
|
489
|
+
include TestServerMethods
|
492
490
|
|
493
491
|
def setup
|
494
|
-
|
495
|
-
#puts "starting"
|
496
|
-
File.open(TestCurbCurlEasy.locked_file,'w') {|f| f << 'locked' }
|
497
|
-
|
498
|
-
# start up a webrick server for testing delete
|
499
|
-
@server = WEBrick::HTTPServer.new :Port => 9129, :DocumentRoot => File.expand_path(File.dirname(__FILE__))
|
500
|
-
|
501
|
-
@server.mount(TestServlet.path, TestServlet)
|
502
|
-
|
503
|
-
@test_thread = Thread.new { @server.start }
|
504
|
-
|
505
|
-
exit_code = lambda do
|
506
|
-
begin
|
507
|
-
#puts "stopping"
|
508
|
-
File.unlink TestCurbCurlEasy.locked_file if File.exist?(TestCurbCurlEasy.locked_file)
|
509
|
-
@server.shutdown unless @server.nil?
|
510
|
-
rescue Object => e
|
511
|
-
puts "Error #{__FILE__}:#{__LINE__}\n#{e.message}"
|
512
|
-
end
|
513
|
-
end
|
514
|
-
|
515
|
-
trap("INT"){exit_code.call}
|
516
|
-
at_exit{exit_code.call}
|
517
|
-
|
518
|
-
end
|
492
|
+
server_setup
|
519
493
|
end
|
520
494
|
|
521
|
-
def teardown
|
522
|
-
end
|
523
|
-
|
524
495
|
end
|
data/tests/tc_curl_multi.rb
CHANGED
@@ -197,9 +197,9 @@ class TestCurbCurlMulti < Test::Unit::TestCase
|
|
197
197
|
end
|
198
198
|
|
199
199
|
def self.test
|
200
|
-
|
200
|
+
ObjectSpace.garbage_collect
|
201
201
|
tfs = TestForScope.new
|
202
|
-
|
202
|
+
ObjectSpace.garbage_collect
|
203
203
|
tfs.t_method
|
204
204
|
ObjectSpace.garbage_collect
|
205
205
|
tfs.t_call
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taf2-curb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Bamford
|
@@ -18,8 +18,8 @@ description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindi
|
|
18
18
|
email: todd.fisher@gmail.com
|
19
19
|
executables: []
|
20
20
|
|
21
|
-
extensions:
|
22
|
-
|
21
|
+
extensions:
|
22
|
+
- ext/extconf.rb
|
23
23
|
extra_rdoc_files:
|
24
24
|
- LICENSE
|
25
25
|
- README
|