ghazel-curb 0.5.9.0 → 0.5.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/curb.h +3 -3
- data/ext/curb_multi.c +4 -12
- data/ext/extconf.rb +11 -9
- data/lib/curb.rb +2 -0
- data/tests/tc_curl_multi.rb +4 -3
- metadata +2 -2
data/ext/curb.h
CHANGED
@@ -20,12 +20,12 @@
|
|
20
20
|
#include "curb_macros.h"
|
21
21
|
|
22
22
|
// These should be managed from the Rake 'release' task.
|
23
|
-
#define CURB_VERSION "0.5.9.
|
24
|
-
#define CURB_VER_NUM
|
23
|
+
#define CURB_VERSION "0.5.9.1"
|
24
|
+
#define CURB_VER_NUM 591
|
25
25
|
#define CURB_VER_MAJ 0
|
26
26
|
#define CURB_VER_MIN 5
|
27
27
|
#define CURB_VER_MIC 9
|
28
|
-
#define CURB_VER_PATCH
|
28
|
+
#define CURB_VER_PATCH 1
|
29
29
|
|
30
30
|
|
31
31
|
// Maybe not yet defined in Ruby
|
data/ext/curb_multi.c
CHANGED
@@ -32,7 +32,6 @@ static void rb_curl_multi_remove(ruby_curl_multi *rbcm, VALUE easy);
|
|
32
32
|
static void rb_curl_multi_read_info(VALUE self, CURLM *mptr);
|
33
33
|
|
34
34
|
static void rb_curl_multi_mark_all_easy(VALUE key, VALUE rbeasy, ruby_curl_multi *rbcm) {
|
35
|
-
//printf( "mark easy: 0x%X\n", (long)rbeasy );
|
36
35
|
rb_gc_mark(rbeasy);
|
37
36
|
}
|
38
37
|
|
@@ -42,20 +41,14 @@ static void curl_multi_mark(ruby_curl_multi *rbcm) {
|
|
42
41
|
}
|
43
42
|
|
44
43
|
static void curl_multi_flush_easy(VALUE key, VALUE easy, ruby_curl_multi *rbcm) {
|
45
|
-
//rb_curl_multi_remove(rbcm, easy);
|
46
44
|
CURLMcode result;
|
47
45
|
ruby_curl_easy *rbce;
|
48
|
-
|
46
|
+
|
49
47
|
Data_Get_Struct(easy, ruby_curl_easy, rbce);
|
50
48
|
result = curl_multi_remove_handle(rbcm->handle, rbce->curl);
|
51
49
|
if (result != 0) {
|
52
50
|
raise_curl_multi_error_exception(result);
|
53
51
|
}
|
54
|
-
// XXX: easy handle may not be finished yet... so don't clean it GC pass will get it next time
|
55
|
-
r = rb_hash_delete( rbcm->requests, easy );
|
56
|
-
if( r != easy || r == Qnil ) {
|
57
|
-
rb_raise(rb_eRuntimeError, "Critical:: Unable to remove easy from requests");
|
58
|
-
}
|
59
52
|
}
|
60
53
|
|
61
54
|
static int
|
@@ -65,7 +58,6 @@ rb_hash_clear_i(VALUE key, VALUE value, VALUE dummy) {
|
|
65
58
|
|
66
59
|
static void curl_multi_free(ruby_curl_multi *rbcm) {
|
67
60
|
|
68
|
-
//printf("hash entries: %d\n", RHASH(rbcm->requests)->tbl->num_entries );
|
69
61
|
if (rbcm && !rbcm->requests == Qnil && rb_type(rbcm->requests) == T_HASH && RHASH_LEN(rbcm->requests) > 0) {
|
70
62
|
|
71
63
|
rb_hash_foreach( rbcm->requests, (int (*)())curl_multi_flush_easy, (VALUE)rbcm );
|
@@ -100,7 +92,7 @@ VALUE ruby_curl_multi_new(VALUE klass) {
|
|
100
92
|
return new_curlm;
|
101
93
|
}
|
102
94
|
|
103
|
-
|
95
|
+
/* Hash#foreach callback for ruby_curl_multi_requests */
|
104
96
|
static int ruby_curl_multi_requests_callback(VALUE key, VALUE value, VALUE result_array) {
|
105
97
|
rb_ary_push(result_array, value);
|
106
98
|
|
@@ -121,8 +113,8 @@ static VALUE ruby_curl_multi_requests(VALUE self) {
|
|
121
113
|
|
122
114
|
result_array = rb_ary_new();
|
123
115
|
|
124
|
-
|
125
|
-
rb_hash_foreach(
|
116
|
+
/* iterate over the requests hash, and stuff references into the array. */
|
117
|
+
rb_hash_foreach(rbcm->requests, ruby_curl_multi_requests_callback, result_array);
|
126
118
|
|
127
119
|
return result_array;
|
128
120
|
}
|
data/ext/extconf.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'mkmf'
|
2
|
+
puts $CFLAGS.inspect
|
2
3
|
|
3
4
|
dir_config('curl')
|
4
5
|
|
@@ -24,15 +25,16 @@ elsif !have_library('curl') or !have_header('curl/curl.h')
|
|
24
25
|
end
|
25
26
|
|
26
27
|
# Check arch flags
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
#
|
31
|
-
#
|
32
|
-
|
33
|
-
$CFLAGS
|
34
|
-
|
35
|
-
|
28
|
+
# TODO: detect mismatched arch types when libcurl mac ports is mixed with native mac ruby or vice versa
|
29
|
+
#archs = $CFLAGS.scan(/-arch\s(.*?)\s/).first # get the first arch flag
|
30
|
+
#if archs and archs.size >= 1
|
31
|
+
# # need to reduce the number of archs...
|
32
|
+
# # guess the first one is correct... at least the first one is probably the ruby installed arch...
|
33
|
+
# # this could lead to compiled binaries that crash at runtime...
|
34
|
+
# $CFLAGS.gsub!(/-arch\s(.*?)\s/,' ')
|
35
|
+
# $CFLAGS << " -arch #{archs.first}"
|
36
|
+
# puts "Selected arch: #{archs.first}"
|
37
|
+
#end
|
36
38
|
|
37
39
|
def define(s)
|
38
40
|
$defs.push( format("-D HAVE_%s", s.to_s.upcase) )
|
data/lib/curb.rb
CHANGED
data/tests/tc_curl_multi.rb
CHANGED
@@ -381,7 +381,7 @@ class TestCurbCurlMulti < Test::Unit::TestCase
|
|
381
381
|
|
382
382
|
def test_remove_exception_is_descriptive
|
383
383
|
m = Curl::Multi.new
|
384
|
-
c = Curl::Easy.new("http://
|
384
|
+
c = Curl::Easy.new("http://127.9.9.9:999110")
|
385
385
|
m.remove(c)
|
386
386
|
rescue => e
|
387
387
|
assert_equal 'Invalid easy handle', e.message
|
@@ -393,9 +393,9 @@ class TestCurbCurlMulti < Test::Unit::TestCase
|
|
393
393
|
|
394
394
|
tries = 2
|
395
395
|
|
396
|
-
c1 = Curl::Easy.new('http://127.
|
396
|
+
c1 = Curl::Easy.new('http://127.1.1.1:99911') do |curl|
|
397
397
|
curl.on_failure {|c,e|
|
398
|
-
assert_equal [Curl::Err::
|
398
|
+
assert_equal [Curl::Err::MalformedURLError, "URL using bad/illegal format or missing URL"], e
|
399
399
|
if tries > 0
|
400
400
|
tries -= 1
|
401
401
|
m.add(c)
|
@@ -410,6 +410,7 @@ class TestCurbCurlMulti < Test::Unit::TestCase
|
|
410
410
|
m.perform
|
411
411
|
end
|
412
412
|
assert_equal 0, tries
|
413
|
+
assert_equal 0, m.requests.size
|
413
414
|
end
|
414
415
|
|
415
416
|
include TestServerMethods
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghazel-curb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.9.
|
4
|
+
version: 0.5.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Bamford
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-11-
|
13
|
+
date: 2009-11-24 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|