taf2-curb 0.2.7.4 → 0.2.8.0

Sign up to get free protection for your applications and to get access to all the features.
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.2.7.4"
24
- #define CURB_VER_NUM 224
23
+ #define CURB_VERSION "0.2.8.0"
24
+ #define CURB_VER_NUM 280
25
25
  #define CURB_VER_MAJ 0
26
26
  #define CURB_VER_MIN 2
27
- #define CURB_VER_MIC 7
28
- #define CURB_VER_PATCH 4
27
+ #define CURB_VER_MIC 8
28
+ #define CURB_VER_PATCH 0
29
29
 
30
30
 
31
31
  // Maybe not yet defined in Ruby
@@ -33,6 +33,12 @@
33
33
  #define RSTRING_LEN(x) RSTRING(x)->len
34
34
  #endif
35
35
 
36
+ #ifdef HAVE_RUBY19_HASH
37
+ #define RHASH_LEN(hash) RHASH(hash)->ntbl->num_entries
38
+ #else
39
+ #define RHASH_LEN(hash) RHASH(hash)->tbl->num_entries
40
+ #endif
41
+
36
42
  extern VALUE mCurl;
37
43
 
38
44
  extern void Init_curb_core();
data/ext/curb_multi.c CHANGED
@@ -41,9 +41,13 @@ static void curl_multi_flush_easy(VALUE key, VALUE easy, ruby_curl_multi *rbcm)
41
41
 
42
42
  static void curl_multi_free(ruby_curl_multi *rbcm) {
43
43
  //printf("hash entries: %d\n", RHASH(rbcm->requests)->tbl->num_entries );
44
- rb_hash_foreach( rbcm->requests, (int (*)())curl_multi_flush_easy, (VALUE)rbcm );
44
+ if (RHASH_LEN(rbcm->requests) > 0) {
45
+ rb_hash_foreach( rbcm->requests, (int (*)())curl_multi_flush_easy, (VALUE)rbcm );
45
46
 
46
- curl_multi_cleanup(rbcm->handle);
47
+ curl_multi_cleanup(rbcm->handle);
48
+ //rb_hash_clear(rbcm->requests)
49
+ rbcm->requests = rb_hash_new();
50
+ }
47
51
  }
48
52
 
49
53
  /*
data/ext/extconf.rb CHANGED
@@ -35,7 +35,7 @@ def have_constant(name)
35
35
  end
36
36
  end
37
37
  end
38
-
38
+
39
39
  have_constant "curlinfo_redirect_time"
40
40
  have_constant "curlinfo_response_code"
41
41
  have_constant "curlinfo_filetime"
@@ -75,5 +75,27 @@ if try_compile('int main() { return 0; }','-Wall')
75
75
  $CFLAGS << ' -Wall'
76
76
  end
77
77
 
78
+ # do some checking to detect ruby 1.8 hash.c vs ruby 1.9 hash.c
79
+ def test_for(name, const, src)
80
+ checking_for "Ruby 1.9" do
81
+ if try_compile(src,"#{$CFLAGS} #{$LIBS}")
82
+ define const
83
+ true
84
+ else
85
+ false
86
+ end
87
+ end
88
+ end
89
+ test_for("Ruby 1.9", "RUBY19_HASH", %{
90
+ #include <ruby.h>
91
+ int main() {
92
+ VALUE hash = rb_hash_new();
93
+ if( RHASH(hash)->ntbl->num_entries ) {
94
+ return 0;
95
+ }
96
+ return 1;
97
+ }
98
+ })
99
+
78
100
  create_header('curb_config.h')
79
101
  create_makefile('curb_core')
data/tests/helper.rb CHANGED
@@ -93,8 +93,16 @@ module TestServerMethods
93
93
  @server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => File.expand_path(File.dirname(__FILE__))
94
94
 
95
95
  @server.mount(servlet.path, servlet)
96
+ queue = Queue.new # synchronize the thread startup to the main thread
96
97
 
97
- @test_thread = Thread.new { @server.start }
98
+ @test_thread = Thread.new { queue << 1; @server.start }
99
+
100
+ # wait for the queue
101
+ value = queue.pop
102
+ if !value
103
+ STDERR.puts "Failed to startup test server!"
104
+ exit(1)
105
+ end
98
106
 
99
107
  exit_code = lambda do
100
108
  begin
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.7.4
4
+ version: 0.2.8.0
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-02-22 00:00:00 -08:00
13
+ date: 2009-03-13 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16