ghazel-curb 0.6.2.3 → 0.7.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +8 -1
- data/Rakefile +20 -1
- data/ext/curb.c +34 -0
- data/ext/curb.h +6 -4
- data/ext/curb_easy.c +627 -181
- data/ext/curb_easy.h +28 -2
- data/ext/curb_errors.c +2 -0
- data/ext/curb_errors.h +1 -0
- data/ext/curb_macros.h +1 -1
- data/ext/curb_multi.c +155 -59
- data/ext/curb_postfield.c +61 -49
- data/ext/curb_upload.c +2 -2
- data/ext/extconf.rb +7 -2
- data/lib/curb.rb +94 -5
- data/tests/bug_curb_easy_post_with_string_no_content_length_header.rb +83 -0
- data/tests/bug_multi_segfault.rb +6 -2
- 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 +21 -7
- data/tests/mem_check.rb +65 -0
- data/tests/tc_curl_download.rb +44 -1
- data/tests/tc_curl_easy.rb +181 -11
- data/tests/tc_curl_multi.rb +36 -3
- data/tests/tc_curl_postfield.rb +3 -1
- data/tests/timeout.rb +100 -0
- data/tests/timeout_server.rb +33 -0
- metadata +44 -5
data/README
CHANGED
@@ -144,14 +144,21 @@ documentation with:
|
|
144
144
|
c = Curl::Easy.new(url) do|curl|
|
145
145
|
curl.follow_location = true
|
146
146
|
curl.on_body{|data| responses[url] << data; data.size }
|
147
|
+
curl.on_success {|easy| puts "success, add more easy handles" }
|
147
148
|
end
|
148
149
|
m.add(c)
|
149
150
|
end
|
150
151
|
|
151
152
|
m.perform do
|
152
|
-
puts "idling... can do some work here
|
153
|
+
puts "idling... can do some work here"
|
153
154
|
end
|
154
155
|
|
155
156
|
requests.each do|url|
|
156
157
|
puts responses[url]
|
157
158
|
end
|
159
|
+
|
160
|
+
### Easy Callbacks
|
161
|
+
|
162
|
+
on_success: is called when the response code is 20x
|
163
|
+
on_failure: is called when the response code is not success, including redirects e.g. 30x
|
164
|
+
on_complete: is called in all cases.
|
data/Rakefile
CHANGED
@@ -100,7 +100,7 @@ Rake::TestTask.new(:bugtests) do |t|
|
|
100
100
|
t.test_files = FileList['tests/bug_*.rb']
|
101
101
|
t.verbose = false
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
#Rake::TestTask.new(:funtests) do |t|
|
105
105
|
# t.test_files = FileList['test/func_*.rb']
|
106
106
|
#t.warning = true
|
@@ -110,6 +110,25 @@ end
|
|
110
110
|
task :unittests => :compile
|
111
111
|
task :bugtests => :compile
|
112
112
|
|
113
|
+
def has_gem?(file,name)
|
114
|
+
begin
|
115
|
+
require file
|
116
|
+
has_http_persistent = true
|
117
|
+
rescue LoadError => e
|
118
|
+
puts "Skipping #{name}"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
desc "Benchmark curl against http://127.0.0.1/zeros-2k - will fail if /zeros-2k or 127.0.0.1 are missing"
|
123
|
+
task :bench do
|
124
|
+
sh "ruby bench/curb_easy.rb"
|
125
|
+
sh "ruby bench/curb_multi.rb"
|
126
|
+
sh "ruby bench/nethttp_test.rb" if has_gem?("net/http/persistent","net-http-persistent")
|
127
|
+
sh "ruby bench/patron_test.rb" if has_gem?("patron","patron")
|
128
|
+
sh "ruby bench/typhoeus_test.rb" if has_gem?("typhoeus","typhoeus")
|
129
|
+
sh "ruby bench/typhoeus_hydra_test.rb" if has_gem?("typhoeus","typhoeus")
|
130
|
+
end
|
131
|
+
|
113
132
|
# RDoc Tasks ---------------------------------------------------------
|
114
133
|
desc "Create the RDOC documentation"
|
115
134
|
task :doc do
|
data/ext/curb.c
CHANGED
@@ -255,6 +255,18 @@ void Init_curb_core() {
|
|
255
255
|
/* Passed to on_debug handler to indicate that the data is protocol data sent to the peer. */
|
256
256
|
rb_define_const(mCurl, "CURLINFO_DATA_OUT", INT2FIX(CURLINFO_DATA_OUT));
|
257
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
|
+
|
258
270
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is an HTTP proxy. (libcurl >= 7.10) */
|
259
271
|
#ifdef HAVE_CURLPROXY_HTTP
|
260
272
|
rb_define_const(mCurl, "CURLPROXY_HTTP", INT2FIX(CURLPROXY_HTTP));
|
@@ -262,6 +274,28 @@ void Init_curb_core() {
|
|
262
274
|
rb_define_const(mCurl, "CURLPROXY_HTTP", INT2FIX(-1));
|
263
275
|
#endif
|
264
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
|
+
|
265
299
|
/* When passed to Curl::Easy#proxy_type , indicates that the proxy is a SOCKS4 proxy. (libcurl >= 7.15.2) */
|
266
300
|
#ifdef HAVE_CURLPROXY_SOCKS4
|
267
301
|
rb_define_const(mCurl, "CURLPROXY_SOCKS4", INT2FIX(CURLPROXY_SOCKS4));
|
data/ext/curb.h
CHANGED
@@ -20,11 +20,11 @@
|
|
20
20
|
#include "curb_macros.h"
|
21
21
|
|
22
22
|
// These should be managed from the Rake 'release' task.
|
23
|
-
#define CURB_VERSION "0.
|
24
|
-
#define CURB_VER_NUM
|
23
|
+
#define CURB_VERSION "0.7.9"
|
24
|
+
#define CURB_VER_NUM 790
|
25
25
|
#define CURB_VER_MAJ 0
|
26
|
-
#define CURB_VER_MIN
|
27
|
-
#define CURB_VER_MIC
|
26
|
+
#define CURB_VER_MIN 7
|
27
|
+
#define CURB_VER_MIC 9
|
28
28
|
#define CURB_VER_PATCH 0
|
29
29
|
|
30
30
|
|
@@ -37,11 +37,13 @@
|
|
37
37
|
#define RSTRING_PTR(x) RSTRING(x)->ptr
|
38
38
|
#endif
|
39
39
|
|
40
|
+
#ifndef RHASH_LEN
|
40
41
|
#ifdef HAVE_RUBY19_HASH
|
41
42
|
#define RHASH_LEN(hash) RHASH(hash)->ntbl->num_entries
|
42
43
|
#else
|
43
44
|
#define RHASH_LEN(hash) RHASH(hash)->tbl->num_entries
|
44
45
|
#endif
|
46
|
+
#endif
|
45
47
|
|
46
48
|
extern VALUE mCurl;
|
47
49
|
|