gus-curb 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +51 -0
  3. data/README.markdown +230 -0
  4. data/Rakefile +320 -0
  5. data/doc.rb +42 -0
  6. data/ext/curb.c +997 -0
  7. data/ext/curb.h +48 -0
  8. data/ext/curb_easy.c +3466 -0
  9. data/ext/curb_easy.h +90 -0
  10. data/ext/curb_errors.c +660 -0
  11. data/ext/curb_errors.h +132 -0
  12. data/ext/curb_macros.h +159 -0
  13. data/ext/curb_multi.c +641 -0
  14. data/ext/curb_multi.h +26 -0
  15. data/ext/curb_postfield.c +523 -0
  16. data/ext/curb_postfield.h +40 -0
  17. data/ext/curb_upload.c +80 -0
  18. data/ext/curb_upload.h +30 -0
  19. data/ext/extconf.rb +392 -0
  20. data/lib/curb.rb +1 -0
  21. data/lib/curl.rb +64 -0
  22. data/lib/curl/easy.rb +480 -0
  23. data/lib/curl/multi.rb +248 -0
  24. data/tests/alltests.rb +3 -0
  25. data/tests/bug_crash_on_debug.rb +39 -0
  26. data/tests/bug_crash_on_progress.rb +73 -0
  27. data/tests/bug_curb_easy_blocks_ruby_threads.rb +52 -0
  28. data/tests/bug_curb_easy_post_with_string_no_content_length_header.rb +83 -0
  29. data/tests/bug_instance_post_differs_from_class_post.rb +53 -0
  30. data/tests/bug_issue102.rb +17 -0
  31. data/tests/bug_multi_segfault.rb +14 -0
  32. data/tests/bug_postfields_crash.rb +26 -0
  33. data/tests/bug_postfields_crash2.rb +57 -0
  34. data/tests/bug_require_last_or_segfault.rb +40 -0
  35. data/tests/bugtests.rb +9 -0
  36. data/tests/helper.rb +204 -0
  37. data/tests/mem_check.rb +65 -0
  38. data/tests/require_last_or_segfault_script.rb +36 -0
  39. data/tests/signals.rb +33 -0
  40. data/tests/tc_curl.rb +39 -0
  41. data/tests/tc_curl_download.rb +75 -0
  42. data/tests/tc_curl_easy.rb +1038 -0
  43. data/tests/tc_curl_easy_setopt.rb +31 -0
  44. data/tests/tc_curl_multi.rb +485 -0
  45. data/tests/tc_curl_postfield.rb +143 -0
  46. data/tests/timeout.rb +100 -0
  47. data/tests/timeout_server.rb +33 -0
  48. data/tests/unittests.rb +2 -0
  49. metadata +123 -0
@@ -0,0 +1,40 @@
1
+ /* curb_postfield.h - Field class for POST method
2
+ * Copyright (c)2006 Ross Bamford.
3
+ * Licensed under the Ruby License. See LICENSE for details.
4
+ *
5
+ * $Id: curb_postfield.h 4 2006-11-17 18:35:31Z roscopeco $
6
+ */
7
+ #ifndef __CURB_POSTFIELD_H
8
+ #define __CURB_POSTFIELD_H
9
+
10
+ #include "curb.h"
11
+
12
+ /*
13
+ * postfield doesn't actually wrap a curl_httppost - instead,
14
+ * it just holds together some ruby objects and has a C-side
15
+ * method to add it to a given form list during the perform.
16
+ */
17
+ typedef struct {
18
+ /* Objects we associate */
19
+ VALUE name;
20
+ VALUE content;
21
+ VALUE content_type;
22
+ VALUE content_proc;
23
+ VALUE local_file;
24
+ VALUE remote_file;
25
+
26
+ /* this will sometimes hold a string, which is the result
27
+ * of the content_proc invocation. We need it to hang around.
28
+ */
29
+ VALUE buffer_str;
30
+ } ruby_curl_postfield;
31
+
32
+ extern VALUE cCurlPostField;
33
+
34
+ void append_to_form(VALUE self,
35
+ struct curl_httppost **first,
36
+ struct curl_httppost **last);
37
+
38
+ void init_curb_postfield();
39
+
40
+ #endif
@@ -0,0 +1,80 @@
1
+ /* curb_upload.c - Curl upload handle
2
+ * Copyright (c)2009 Todd A Fisher.
3
+ * Licensed under the Ruby License. See LICENSE for details.
4
+ */
5
+ #include "curb_upload.h"
6
+ extern VALUE mCurl;
7
+ VALUE cCurlUpload;
8
+
9
+ #ifdef RDOC_NEVER_DEFINED
10
+ mCurl = rb_define_module("Curl");
11
+ #endif
12
+
13
+ static void curl_upload_mark(ruby_curl_upload *rbcu) {
14
+ if (rbcu->stream && !NIL_P(rbcu->stream)) rb_gc_mark(rbcu->stream);
15
+ }
16
+ static void curl_upload_free(ruby_curl_upload *rbcu) {
17
+ free(rbcu);
18
+ }
19
+
20
+ /*
21
+ * call-seq:
22
+ * internal class for sending large file uploads
23
+ */
24
+ VALUE ruby_curl_upload_new(VALUE klass) {
25
+ VALUE upload;
26
+ ruby_curl_upload *rbcu = ALLOC(ruby_curl_upload);
27
+ rbcu->stream = Qnil;
28
+ rbcu->offset = 0;
29
+ upload = Data_Wrap_Struct(klass, curl_upload_mark, curl_upload_free, rbcu);
30
+ return upload;
31
+ }
32
+
33
+ /*
34
+ * call-seq:
35
+ * internal class for sending large file uploads
36
+ */
37
+ VALUE ruby_curl_upload_stream_set(VALUE self, VALUE stream) {
38
+ ruby_curl_upload *rbcu;
39
+ Data_Get_Struct(self, ruby_curl_upload, rbcu);
40
+ rbcu->stream = stream;
41
+ return stream;
42
+ }
43
+ /*
44
+ * call-seq:
45
+ * internal class for sending large file uploads
46
+ */
47
+ VALUE ruby_curl_upload_stream_get(VALUE self) {
48
+ ruby_curl_upload *rbcu;
49
+ Data_Get_Struct(self, ruby_curl_upload, rbcu);
50
+ return rbcu->stream;
51
+ }
52
+ /*
53
+ * call-seq:
54
+ * internal class for sending large file uploads
55
+ */
56
+ VALUE ruby_curl_upload_offset_set(VALUE self, VALUE offset) {
57
+ ruby_curl_upload *rbcu;
58
+ Data_Get_Struct(self, ruby_curl_upload, rbcu);
59
+ rbcu->offset = FIX2LONG(offset);
60
+ return offset;
61
+ }
62
+ /*
63
+ * call-seq:
64
+ * internal class for sending large file uploads
65
+ */
66
+ VALUE ruby_curl_upload_offset_get(VALUE self) {
67
+ ruby_curl_upload *rbcu;
68
+ Data_Get_Struct(self, ruby_curl_upload, rbcu);
69
+ return INT2FIX(rbcu->offset);
70
+ }
71
+
72
+ /* =================== INIT LIB =====================*/
73
+ void init_curb_upload() {
74
+ cCurlUpload = rb_define_class_under(mCurl, "Upload", rb_cObject);
75
+ rb_define_singleton_method(cCurlUpload, "new", ruby_curl_upload_new, 0);
76
+ rb_define_method(cCurlUpload, "stream=", ruby_curl_upload_stream_set, 1);
77
+ rb_define_method(cCurlUpload, "stream", ruby_curl_upload_stream_get, 0);
78
+ rb_define_method(cCurlUpload, "offset=", ruby_curl_upload_offset_set, 1);
79
+ rb_define_method(cCurlUpload, "offset", ruby_curl_upload_offset_get, 0);
80
+ }
@@ -0,0 +1,30 @@
1
+ /* curb_upload.h - Curl upload handle
2
+ * Copyright (c)2009 Todd A Fisher.
3
+ * Licensed under the Ruby License. See LICENSE for details.
4
+ */
5
+ #ifndef __CURB_UPLOAD_H
6
+ #define __CURB_UPLOAD_H
7
+
8
+ #include "curb.h"
9
+
10
+ #include <curl/easy.h>
11
+
12
+ /*
13
+ * Maintain the state of an upload e.g. for putting large streams with very little memory
14
+ * out to a server. via PUT requests
15
+ */
16
+ typedef struct {
17
+ VALUE stream;
18
+ size_t offset;
19
+ } ruby_curl_upload;
20
+
21
+ extern VALUE cCurlUpload;
22
+ void init_curb_upload();
23
+
24
+ VALUE ruby_curl_upload_new(VALUE klass);
25
+ VALUE ruby_curl_upload_stream_set(VALUE self, VALUE stream);
26
+ VALUE ruby_curl_upload_stream_get(VALUE self);
27
+ VALUE ruby_curl_upload_offset_set(VALUE self, VALUE offset);
28
+ VALUE ruby_curl_upload_offset_get(VALUE self);
29
+
30
+ #endif
@@ -0,0 +1,392 @@
1
+ require 'mkmf'
2
+
3
+ dir_config('curl')
4
+
5
+ if find_executable('curl-config')
6
+ $CFLAGS << " #{`curl-config --cflags`.strip} -g"
7
+ if ENV['STATIC_BUILD']
8
+ $LIBS << " #{`curl-config --static-libs`.strip}"
9
+ else
10
+ $LIBS << " #{`curl-config --libs`.strip}"
11
+ end
12
+ ca_bundle_path=`curl-config --ca`.strip
13
+ if !ca_bundle_path.nil? and ca_bundle_path != ''
14
+ $defs.push( %{-D HAVE_CURL_CONFIG_CA} )
15
+ $defs.push( %{-D CURL_CONFIG_CA='#{ca_bundle_path.inspect}'} )
16
+ end
17
+ elsif !have_library('curl') or !have_header('curl/curl.h')
18
+ fail <<-EOM
19
+ Can't find libcurl or curl/curl.h
20
+
21
+ Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
22
+ options to extconf.
23
+ EOM
24
+ end
25
+
26
+ # Check arch flags
27
+ # TODO: detect mismatched arch types when libcurl mac ports is mixed with native mac ruby or vice versa
28
+ #archs = $CFLAGS.scan(/-arch\s(.*?)\s/).first # get the first arch flag
29
+ #if archs and archs.size >= 1
30
+ # # need to reduce the number of archs...
31
+ # # guess the first one is correct... at least the first one is probably the ruby installed arch...
32
+ # # this could lead to compiled binaries that crash at runtime...
33
+ # $CFLAGS.gsub!(/-arch\s(.*?)\s/,' ')
34
+ # $CFLAGS << " -arch #{archs.first}"
35
+ # puts "Selected arch: #{archs.first}"
36
+ #end
37
+
38
+ def define(s, v=1)
39
+ $defs.push( format("-D HAVE_%s=%d", s.to_s.upcase, v) )
40
+ end
41
+
42
+ def have_constant(name)
43
+ sname = name.is_a?(Symbol) ? name.to_s : name.upcase
44
+ checking_for name do
45
+ src = %{
46
+ #include <curl/curl.h>
47
+ int main() {
48
+ int test = (int)#{sname};
49
+ return 0;
50
+ }
51
+ }
52
+ if try_compile(src,"#{$CFLAGS} #{$LIBS}")
53
+ define name
54
+ true
55
+ else
56
+ #define name, 0
57
+ false
58
+ end
59
+ end
60
+ end
61
+
62
+ have_constant "curlinfo_appconnect_time"
63
+ have_constant "curlinfo_redirect_time"
64
+ have_constant "curlinfo_response_code"
65
+ have_constant "curlinfo_filetime"
66
+ have_constant "curlinfo_redirect_count"
67
+ have_constant "curlinfo_os_errno"
68
+ have_constant "curlinfo_num_connects"
69
+ have_constant "curlinfo_ftp_entry_path"
70
+ have_constant "curl_version_ssl"
71
+ have_constant "curl_version_libz"
72
+ have_constant "curl_version_ntlm"
73
+ have_constant "curl_version_gssnegotiate"
74
+ have_constant "curl_version_debug"
75
+ have_constant "curl_version_asynchdns"
76
+ have_constant "curl_version_spnego"
77
+ have_constant "curl_version_largefile"
78
+ have_constant "curl_version_idn"
79
+ have_constant "curl_version_sspi"
80
+ have_constant "curl_version_conv"
81
+ have_constant "curlproxy_http"
82
+ have_constant "curlproxy_socks4"
83
+ have_constant "curlproxy_socks4a"
84
+ have_constant "curlproxy_socks5"
85
+ have_constant "curlauth_basic"
86
+ have_constant "curlauth_digest"
87
+ have_constant "curlauth_gssnegotiate"
88
+ have_constant "curlauth_ntlm"
89
+ have_constant "curlauth_anysafe"
90
+ have_constant "curlauth_any"
91
+ have_constant "curle_tftp_notfound"
92
+ have_constant "curle_tftp_perm"
93
+ have_constant "curle_tftp_diskfull"
94
+ have_constant "curle_tftp_illegal"
95
+ have_constant "curle_tftp_unknownid"
96
+ have_constant "curle_tftp_exists"
97
+ have_constant "curle_tftp_nosuchuser"
98
+ # older versions of libcurl 7.12
99
+ have_constant "curle_send_fail_rewind"
100
+ have_constant "curle_ssl_engine_initfailed"
101
+ have_constant "curle_login_denied"
102
+
103
+ # older than 7.16.3
104
+ have_constant "curlmopt_maxconnects"
105
+
106
+ have_constant "curlopt_seekfunction"
107
+ have_constant "curlopt_seekdata"
108
+ have_constant "curlopt_sockoptfunction"
109
+ have_constant "curlopt_sockoptdata"
110
+ have_constant "curlopt_opensocketfunction"
111
+ have_constant "curlopt_opensocketdata"
112
+
113
+ # additional consts
114
+ have_constant "curle_conv_failed"
115
+ have_constant "curle_conv_reqd"
116
+ have_constant "curle_ssl_cacert_badfile"
117
+ have_constant "curle_remote_file_not_found"
118
+ have_constant "curle_ssh"
119
+ have_constant "curle_ssl_shutdown_failed"
120
+ have_constant "curle_again"
121
+ have_constant "curle_ssl_crl_badfile"
122
+ have_constant "curle_ssl_issuer_error"
123
+
124
+ # added in 7.18.2
125
+ have_constant "curlinfo_redirect_url"
126
+
127
+ # username/password added in 7.19.1
128
+ have_constant "curlopt_username"
129
+ have_constant "curlopt_password"
130
+ have_constant "curlinfo_primary_ip"
131
+
132
+ # ie quirk added in 7.19.3
133
+ have_constant "curlauth_digest_ie"
134
+
135
+ # added in 7.15.1
136
+ have_constant "curlftpmethod_multicwd"
137
+ have_constant "curlftpmethod_nocwd"
138
+ have_constant "curlftpmethod_singlecwd"
139
+
140
+ # centos 4.5 build of libcurl
141
+ have_constant "curlm_bad_socket"
142
+ have_constant "curlm_unknown_option"
143
+ have_func("curl_multi_timeout")
144
+ have_func("curl_multi_fdset")
145
+ have_func("curl_multi_perform")
146
+
147
+ # constants
148
+ have_constant "curlopt_interleavefunction"
149
+ have_constant "curlopt_interleavedata"
150
+ have_constant "curlopt_chunk_bgn_function"
151
+ have_constant "curlopt_chunk_end_function"
152
+ have_constant "curlopt_chunk_data"
153
+ have_constant "curlopt_fnmatch_function"
154
+ have_constant "curlopt_fnmatch_data"
155
+ have_constant "curlopt_errorbuffer"
156
+ have_constant "curlopt_stderr"
157
+ have_constant "curlopt_failonerror"
158
+ have_constant "curlopt_url"
159
+ have_constant "curlopt_protocols"
160
+ have_constant "curlopt_redir_protocols"
161
+ have_constant "curlopt_proxy"
162
+ have_constant "curlopt_proxyport"
163
+ have_constant "curlopt_proxytype"
164
+ have_constant "curlopt_noproxy"
165
+ have_constant "curlopt_httpproxytunnel"
166
+ have_constant "curlopt_socks5_gssapi_service"
167
+ have_constant "curlopt_socks5_gssapi_nec"
168
+ have_constant "curlopt_interface"
169
+ have_constant "curlopt_localport"
170
+ have_constant "curlopt_dns_cache_timeout"
171
+ have_constant "curlopt_dns_use_global_cache"
172
+ have_constant "curlopt_buffersize"
173
+ have_constant "curlopt_port"
174
+ have_constant "curlopt_tcp_nodelay"
175
+ have_constant "curlopt_address_scope"
176
+ have_constant "curlopt_netrc"
177
+ have_constant "curl_netrc_optional"
178
+ have_constant "curl_netrc_ignored"
179
+ have_constant "curl_netrc_required"
180
+ have_constant "curlopt_netrc_file"
181
+ have_constant "curlopt_userpwd"
182
+ have_constant "curlopt_proxyuserpwd"
183
+ have_constant "curlopt_username"
184
+ have_constant "curlopt_password"
185
+ have_constant "curlopt_password"
186
+ have_constant "curlopt_password"
187
+ have_constant "curlopt_httpauth"
188
+ have_constant "curlauth_digest_ie"
189
+ have_constant "curlauth_only"
190
+ have_constant "curlopt_tlsauth_type"
191
+ have_constant "curlopt_tlsauth_srp"
192
+ have_constant "curlopt_tlsauth_username"
193
+ have_constant "curlopt_tlsauth_password"
194
+ have_constant "curlopt_proxyauth"
195
+ have_constant "curlopt_autoreferer"
196
+ have_constant "curlopt_encoding"
197
+ have_constant "curlopt_followlocation"
198
+ have_constant "curlopt_unrestricted_auth"
199
+ have_constant "curlopt_maxredirs"
200
+ have_constant "curlopt_postredir"
201
+ have_constant "curlopt_put"
202
+ have_constant "curlopt_post"
203
+ have_constant "curlopt_postfields"
204
+ have_constant "curlopt_postfieldsize"
205
+ have_constant "curlopt_postfieldsize_large"
206
+ have_constant "curlopt_copypostfields"
207
+ have_constant "curlopt_httppost"
208
+ have_constant "curlopt_referer"
209
+ have_constant "curlopt_useragent"
210
+ have_constant "curlopt_httpheader"
211
+ have_constant "curlopt_http200aliases"
212
+ have_constant "curlopt_cookie"
213
+ have_constant "curlopt_cookiefile"
214
+ have_constant "curlopt_cookiejar"
215
+ have_constant "curlopt_cookiesession"
216
+ have_constant "curlopt_cookielist"
217
+ have_constant "curlopt_httpget"
218
+ have_constant "curlopt_http_version"
219
+ have_constant "curl_http_version_none"
220
+ have_constant "curl_http_version_1_0"
221
+ have_constant "curl_http_version_1_1"
222
+ have_constant "curlopt_ignore_content_length"
223
+ have_constant "curlopt_http_content_decoding"
224
+ have_constant "curlopt_http_transfer_decoding"
225
+ have_constant "curlopt_mail_from"
226
+ have_constant "curlopt_mail_rcpt"
227
+ have_constant "curlopt_tftp_blksize"
228
+ have_constant "curlopt_ftpport"
229
+ have_constant "curlopt_quote"
230
+ have_constant "curlopt_postquote"
231
+ have_constant "curlopt_prequote"
232
+ have_constant "curlopt_dirlistonly"
233
+ have_constant "curlopt_append"
234
+ have_constant "curlopt_ftp_use_eprt"
235
+ have_constant "curlopt_ftp_use_epsv"
236
+ have_constant "curlopt_ftp_use_pret"
237
+ have_constant "curlopt_ftp_create_missing_dirs"
238
+ have_constant "curlopt_ftp_response_timeout"
239
+ have_constant "curlopt_ftp_alternative_to_user"
240
+ have_constant "curlopt_ftp_skip_pasv_ip"
241
+ have_constant "curlopt_ftpsslauth"
242
+ have_constant "curlftpauth_default"
243
+ have_constant "curlftpauth_ssl"
244
+ have_constant "curlftpauth_tls"
245
+ have_constant "curlopt_ftp_ssl_ccc"
246
+ have_constant "curlftpssl_ccc_none"
247
+ have_constant "curlftpssl_ccc_passive"
248
+ have_constant "curlftpssl_ccc_active"
249
+ have_constant "curlopt_ftp_account"
250
+ have_constant "curlopt_ftp_filemethod"
251
+ have_constant "curlftpmethod_multicwd"
252
+ have_constant "curlftpmethod_nocwd"
253
+ have_constant "curlftpmethod_singlecwd"
254
+ have_constant "curlopt_rtsp_request"
255
+ have_constant "curl_rtspreq_options"
256
+ have_constant "curl_rtspreq_describe"
257
+ have_constant "curl_rtspreq_announce"
258
+ have_constant "curl_rtspreq_setup"
259
+ have_constant "curl_rtspreq_play"
260
+ have_constant "curl_rtspreq_pause"
261
+ have_constant "curl_rtspreq_teardown"
262
+ have_constant "curl_rtspreq_get_parameter"
263
+ have_constant "curl_rtspreq_set_parameter"
264
+ have_constant "curl_rtspreq_record"
265
+ have_constant "curl_rtspreq_receive"
266
+ have_constant "curlopt_rtsp_session_id"
267
+ have_constant "curlopt_rtsp_stream_uri"
268
+ have_constant "curlopt_rtsp_transport"
269
+ have_constant "curlopt_rtsp_header"
270
+ have_constant "curlopt_rtsp_client_cseq"
271
+ have_constant "curlopt_rtsp_server_cseq"
272
+ have_constant "curlopt_transfertext"
273
+ have_constant "curlopt_proxy_transfer_mode"
274
+ have_constant "curlopt_crlf"
275
+ have_constant "curlopt_range"
276
+ have_constant "curlopt_resume_from"
277
+ have_constant "curlopt_resume_from_large"
278
+ have_constant "curlopt_customrequest"
279
+ have_constant "curlopt_filetime"
280
+ have_constant "curlopt_nobody"
281
+ have_constant "curlopt_infilesize"
282
+ have_constant "curlopt_infilesize_large"
283
+ have_constant "curlopt_upload"
284
+ have_constant "curlopt_maxfilesize"
285
+ have_constant "curlopt_maxfilesize_large"
286
+ have_constant "curlopt_timecondition"
287
+ have_constant "curlopt_timevalue"
288
+ have_constant "curlopt_timeout"
289
+ have_constant "curlopt_timeout_ms"
290
+ have_constant "curlopt_low_speed_limit"
291
+ have_constant "curlopt_low_speed_time"
292
+ have_constant "curlopt_max_send_speed_large"
293
+ have_constant "curlopt_max_recv_speed_large"
294
+ have_constant "curlopt_maxconnects"
295
+ have_constant "curlopt_closepolicy"
296
+ have_constant "curlopt_fresh_connect"
297
+ have_constant "curlopt_forbid_reuse"
298
+ have_constant "curlopt_connecttimeout"
299
+ have_constant "curlopt_connecttimeout_ms"
300
+ have_constant "curlopt_ipresolve"
301
+ have_constant "curl_ipresolve_whatever"
302
+ have_constant "curl_ipresolve_v4"
303
+ have_constant "curl_ipresolve_v6"
304
+ have_constant "curlopt_connect_only"
305
+ have_constant "curlopt_use_ssl"
306
+ have_constant "curlusessl_none"
307
+ have_constant "curlusessl_try"
308
+ have_constant "curlusessl_control"
309
+ have_constant "curlusessl_all"
310
+ have_constant "curlopt_resolve"
311
+ have_constant "curlopt_sslcert"
312
+ have_constant "curlopt_sslcerttype"
313
+ have_constant "curlopt_sslkey"
314
+ have_constant "curlopt_sslkeytype"
315
+ have_constant "curlopt_keypasswd"
316
+ have_constant "curlopt_sslengine"
317
+ have_constant "curlopt_sslengine_default"
318
+ have_constant "curlopt_sslversion"
319
+ have_constant "curl_sslversion_default"
320
+ have_constant :CURL_SSLVERSION_TLSv1
321
+ have_constant :CURL_SSLVERSION_SSLv2
322
+ have_constant :CURL_SSLVERSION_SSLv3
323
+ have_constant "curlopt_ssl_verifypeer"
324
+ have_constant "curlopt_cainfo"
325
+ have_constant "curlopt_issuercert"
326
+ have_constant "curlopt_capath"
327
+ have_constant "curlopt_crlfile"
328
+ have_constant "curlopt_ssl_verifyhost"
329
+ have_constant "curlopt_certinfo"
330
+ have_constant "curlopt_random_file"
331
+ have_constant "curlopt_egdsocket"
332
+ have_constant "curlopt_ssl_cipher_list"
333
+ have_constant "curlopt_ssl_sessionid_cache"
334
+ have_constant "curlopt_krblevel"
335
+ have_constant "curlopt_ssh_auth_types"
336
+ have_constant "curlopt_ssh_host_public_key_md5"
337
+ have_constant "curlopt_ssh_public_keyfile"
338
+ have_constant "curlopt_ssh_private_keyfile"
339
+ have_constant "curlopt_ssh_knownhosts"
340
+ have_constant "curlopt_ssh_keyfunction"
341
+ have_constant "curlkhstat_fine_add_to_file"
342
+ have_constant "curlkhstat_fine"
343
+ have_constant "curlkhstat_reject"
344
+ have_constant "curlkhstat_defer"
345
+ have_constant "curlopt_ssh_keydata"
346
+ have_constant "curlopt_private"
347
+ have_constant "curlopt_share"
348
+ have_constant "curlopt_new_file_perms"
349
+ have_constant "curlopt_new_directory_perms"
350
+ have_constant "curlopt_telnetoptions"
351
+ # was obsoleted in August 2007 for 7.17.0, reused in April 2011 for 7.21.5
352
+ have_constant "curle_not_built_in"
353
+
354
+ have_constant "curle_obsolete" # removed in 7.24 ?
355
+
356
+ # gssapi/spnego delegation related constants
357
+ have_constant "curlopt_gssapi_delegation"
358
+ have_constant "curlgssapi_delegation_policy_flag"
359
+ have_constant "curlgssapi_delegation_flag"
360
+
361
+ have_constant "CURLM_ADDED_ALREADY"
362
+
363
+ if try_compile('int main() { return 0; }','-Wall')
364
+ $CFLAGS << ' -Wall'
365
+ end
366
+
367
+ # do some checking to detect ruby 1.8 hash.c vs ruby 1.9 hash.c
368
+ def test_for(name, const, src)
369
+ checking_for name do
370
+ if try_compile(src,"#{$CFLAGS} #{$LIBS}")
371
+ define const
372
+ true
373
+ else
374
+ false
375
+ end
376
+ end
377
+ end
378
+
379
+ test_for("curl_easy_escape", "CURL_EASY_ESCAPE", %{
380
+ #include <curl/curl.h>
381
+ int main() {
382
+ CURL *easy = curl_easy_init();
383
+ curl_easy_escape(easy,"hello",5);
384
+ return 0;
385
+ }
386
+ })
387
+
388
+ have_func('rb_thread_blocking_region')
389
+ have_header('ruby/thread.h') && have_func('rb_thread_call_without_gvl', 'ruby/thread.h')
390
+
391
+ create_header('curb_config.h')
392
+ create_makefile('curb_core')