curb 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b452d79ee28ee380d6741f39f9fbf826a33a46d473fa4444edb6a56a122af8f8
4
- data.tar.gz: '094812699e5b64584d6dd02a17b16884ee696a20dbf324c05498a46509e39b16'
3
+ metadata.gz: 51f01ce3c875c6eb02061c959c0724844fd0076d3644e28aa130b87c3f7da631
4
+ data.tar.gz: 0ca3a17b17bcdfc721608f119757e908d2c57c40aaf8e9a66d119a1deec3184d
5
5
  SHA512:
6
- metadata.gz: 0df71c1a4eb7896f89da78a79ba9160d5606aa235b89544e08630c558a7cebb1220ec026f99f404915f52e15162cf2c988a66abe04932c3cd1104a1784bd3056
7
- data.tar.gz: '08fba6b5b9a9404f839e4110b0d485e1595be36554345abb88a05482183204f4e0f13001a7731db75e89ca890bfa8ad19ccced63dfecd0e766f1b825ff5e9f1a'
6
+ metadata.gz: 207ac7282c2d95de745edfadef35e809d7dee0edf03eec266c536e0c080dd072df87809dbdd0a3137382a4c7a1b5c420bb32de3bd2820126c6ad6e29085d986f
7
+ data.tar.gz: e1ad940900fb2a107c52b8f28991e0cc50d409dc91a1d075d03145020a527a806578da341ed8cbf2162cb8383c64f3137ec68329911b04ce4713acb9bb7baf1b
data/README.markdown CHANGED
@@ -1,5 +1,6 @@
1
- # Curb - Libcurl bindings for Ruby [![Build Status](https://travis-ci.org/taf2/curb.svg?branch=master)](https://travis-ci.org/taf2/curb)
1
+ # Curb - Libcurl bindings for Ruby
2
2
 
3
+ * [CI Build Status](https://github.com/taf2/curb/actions/workflows/CI.yml)
3
4
  * [rubydoc rdoc](http://www.rubydoc.info/github/taf2/curb/)
4
5
  * [github project](http://github.com/taf2/curb/tree/master)
5
6
 
data/Rakefile CHANGED
@@ -10,13 +10,6 @@ CLOBBER.include '**/*.log'
10
10
  CLOBBER.include '**/Makefile'
11
11
  CLOBBER.include '**/extconf.h'
12
12
 
13
- # Not available for really old rubies, but that's ok.
14
- begin
15
- require 'pry'
16
- rescue LoadError
17
- puts "Failed to load pry."
18
- end
19
-
20
13
  # Load support ruby and rake files (in this order)
21
14
  Dir.glob('tasks/*.rb').each { |r| load r}
22
15
  Dir.glob('tasks/*.rake').each { |r| load r}
data/ext/curb.c CHANGED
@@ -1076,6 +1076,10 @@ void Init_curb_core() {
1076
1076
  CURB_DEFINE(CURLOPT_HAPROXYPROTOCOL);
1077
1077
  #endif
1078
1078
 
1079
+ #if HAVE_CURLOPT_PROXY_SSL_VERIFYHOST
1080
+ CURB_DEFINE(CURLOPT_PROXY_SSL_VERIFYHOST);
1081
+ #endif
1082
+
1079
1083
  #if HAVE_CURLPROTO_RTMPTE
1080
1084
  CURB_DEFINE(CURLPROTO_RTMPTE);
1081
1085
  #endif
data/ext/curb.h CHANGED
@@ -28,11 +28,11 @@
28
28
  #include "curb_macros.h"
29
29
 
30
30
  // These should be managed from the Rake 'release' task.
31
- #define CURB_VERSION "1.0.1"
32
- #define CURB_VER_NUM 1001
31
+ #define CURB_VERSION "1.0.3"
32
+ #define CURB_VER_NUM 1003
33
33
  #define CURB_VER_MAJ 1
34
34
  #define CURB_VER_MIN 0
35
- #define CURB_VER_MIC 1
35
+ #define CURB_VER_MIC 3
36
36
  #define CURB_VER_PATCH 0
37
37
 
38
38
 
data/ext/curb_easy.c CHANGED
@@ -3653,6 +3653,11 @@ static VALUE ruby_curl_easy_set_opt(VALUE self, VALUE opt, VALUE val) {
3653
3653
  case CURLOPT_SSL_SESSIONID_CACHE:
3654
3654
  curl_easy_setopt(rbce->curl, CURLOPT_SSL_SESSIONID_CACHE, NUM2LONG(val));
3655
3655
  break;
3656
+ #endif
3657
+ #if HAVE_CURLOPT_PROXY_SSL_VERIFYHOST
3658
+ case CURLOPT_PROXY_SSL_VERIFYHOST:
3659
+ curl_easy_setopt(rbce->curl, CURLOPT_PROXY_SSL_VERIFYHOST, NUM2LONG(val));
3660
+ break;
3656
3661
  #endif
3657
3662
  default:
3658
3663
  rb_raise(rb_eTypeError, "Curb unsupported option");
@@ -3770,6 +3775,7 @@ static VALUE ruby_curl_easy_error_message(VALUE klass, VALUE code) {
3770
3775
  }
3771
3776
 
3772
3777
  /* =================== INIT LIB =====================*/
3778
+ // TODO: https://bugs.ruby-lang.org/issues/18007
3773
3779
  void init_curb_easy() {
3774
3780
  idCall = rb_intern("call");
3775
3781
  idJoin = rb_intern("join");
data/ext/curb_macros.h CHANGED
@@ -156,4 +156,10 @@
156
156
  #define CURB_DEFINE(name) \
157
157
  rb_define_const(mCurl, #name, LONG2NUM(name))
158
158
 
159
+ #define CURB_RB_CALLBACK_RAISE(context) \
160
+ VALUE exception = rb_errinfo(); \
161
+ const char *msg = rb_respond_to(exception,rb_intern("message")) ? RSTRING_PTR(rb_funcall(exception, rb_intern("message"), 0)) : ""; \
162
+ rb_set_errinfo(Qnil); \
163
+ rb_raise(eCurlErrAbortedByCallback, "Operation was aborted by an application callback[%s]:\"%s\"", context, msg);
164
+
159
165
  #endif
data/ext/curb_multi.c CHANGED
@@ -43,8 +43,9 @@ static void rb_curl_multi_remove(ruby_curl_multi *rbcm, VALUE easy);
43
43
  static void rb_curl_multi_read_info(VALUE self, CURLM *mptr);
44
44
  static void rb_curl_multi_run(VALUE self, CURLM *multi_handle, int *still_running);
45
45
 
46
- static VALUE callback_exception(VALUE unused) {
47
- return Qfalse;
46
+ static VALUE callback_exception(VALUE did_raise, VALUE exception) {
47
+ rb_hash_aset(did_raise, rb_easy_hkey("error"), exception);
48
+ return exception;
48
49
  }
49
50
 
50
51
  void curl_multi_free(ruby_curl_multi *rbcm) {
@@ -274,7 +275,7 @@ static void rb_curl_mutli_handle_complete(VALUE self, CURL *easy_handle, int res
274
275
  long response_code = -1;
275
276
  VALUE easy;
276
277
  ruby_curl_easy *rbce = NULL;
277
- VALUE callargs, val = Qtrue;
278
+ VALUE callargs;
278
279
 
279
280
  CURLcode ecode = curl_easy_getinfo(easy_handle, CURLINFO_PRIVATE, (char**)&easy);
280
281
 
@@ -295,11 +296,17 @@ static void rb_curl_mutli_handle_complete(VALUE self, CURL *easy_handle, int res
295
296
  raise_curl_easy_error_exception(ecode);
296
297
  }
297
298
 
299
+ int status;
300
+ VALUE did_raise = rb_hash_new();
301
+
298
302
  if (!rb_easy_nil("complete_proc")) {
299
303
  callargs = rb_ary_new3(2, rb_easy_get("complete_proc"), easy);
300
304
  rbce->callback_active = 1;
301
- val = rb_rescue(call_status_handler1, callargs, callback_exception, Qnil);
305
+ rb_rescue(call_status_handler1, callargs, callback_exception, did_raise);
302
306
  rbce->callback_active = 0;
307
+ if (rb_hash_aref(did_raise, "error") != Qnil) {
308
+ CURB_RB_CALLBACK_RAISE("complete")
309
+ }
303
310
  }
304
311
 
305
312
  #ifdef HAVE_CURLINFO_RESPONSE_CODE
@@ -308,42 +315,55 @@ static void rb_curl_mutli_handle_complete(VALUE self, CURL *easy_handle, int res
308
315
  // old libcurl
309
316
  curl_easy_getinfo(rbce->curl, CURLINFO_HTTP_CODE, &response_code);
310
317
  #endif
318
+ long redirect_count;
319
+ curl_easy_getinfo(rbce->curl, CURLINFO_REDIRECT_COUNT, &redirect_count);
311
320
 
312
321
  if (result != 0) {
313
322
  if (!rb_easy_nil("failure_proc")) {
314
323
  callargs = rb_ary_new3(3, rb_easy_get("failure_proc"), easy, rb_curl_easy_error(result));
315
324
  rbce->callback_active = 1;
316
- val = rb_rescue(call_status_handler2, callargs, callback_exception, Qnil);
325
+ rb_rescue(call_status_handler2, callargs, callback_exception, did_raise);
317
326
  rbce->callback_active = 0;
318
- //rb_funcall( rb_easy_get("failure_proc"), idCall, 2, easy, rb_curl_easy_error(result) );
327
+ if (rb_hash_aref(did_raise, "error") != Qnil) {
328
+ CURB_RB_CALLBACK_RAISE("failure")
329
+ }
319
330
  }
320
331
  } else if (!rb_easy_nil("success_proc") &&
321
332
  ((response_code >= 200 && response_code < 300) || response_code == 0)) {
322
333
  /* NOTE: we allow response_code == 0, in the case of non http requests e.g. reading from disk */
323
334
  callargs = rb_ary_new3(2, rb_easy_get("success_proc"), easy);
324
335
  rbce->callback_active = 1;
325
- val = rb_rescue(call_status_handler1, callargs, callback_exception, Qnil);
336
+ rb_rescue(call_status_handler1, callargs, callback_exception, did_raise);
326
337
  rbce->callback_active = 0;
327
- //rb_funcall( rb_easy_get("success_proc"), idCall, 1, easy );
328
- } else if (!rb_easy_nil("redirect_proc") &&
329
- (response_code >= 300 && response_code < 400)) {
338
+ if (rb_hash_aref(did_raise, "error") != Qnil) {
339
+ CURB_RB_CALLBACK_RAISE("success")
340
+ }
341
+ } else if (!rb_easy_nil("redirect_proc") && ((response_code >= 300 && response_code < 400) || redirect_count > 0) ) {
330
342
  rbce->callback_active = 1;
331
343
  callargs = rb_ary_new3(3, rb_easy_get("redirect_proc"), easy, rb_curl_easy_error(result));
332
344
  rbce->callback_active = 0;
333
- val = rb_rescue(call_status_handler2, callargs, callback_exception, Qnil);
345
+ rb_rescue(call_status_handler2, callargs, callback_exception, did_raise);
346
+ if (rb_hash_aref(did_raise, "error") != Qnil) {
347
+ CURB_RB_CALLBACK_RAISE("redirect")
348
+ }
334
349
  } else if (!rb_easy_nil("missing_proc") &&
335
350
  (response_code >= 400 && response_code < 500)) {
336
351
  rbce->callback_active = 1;
337
352
  callargs = rb_ary_new3(3, rb_easy_get("missing_proc"), easy, rb_curl_easy_error(result));
338
353
  rbce->callback_active = 0;
339
- val = rb_rescue(call_status_handler2, callargs, callback_exception, Qnil);
354
+ rb_rescue(call_status_handler2, callargs, callback_exception, did_raise);
355
+ if (rb_hash_aref(did_raise, "error") != Qnil) {
356
+ CURB_RB_CALLBACK_RAISE("missing")
357
+ }
340
358
  } else if (!rb_easy_nil("failure_proc") &&
341
359
  (response_code >= 500 && response_code <= 999)) {
342
360
  callargs = rb_ary_new3(3, rb_easy_get("failure_proc"), easy, rb_curl_easy_error(result));
343
361
  rbce->callback_active = 1;
344
- val = rb_rescue(call_status_handler2, callargs, callback_exception, Qnil);
362
+ rb_rescue(call_status_handler2, callargs, callback_exception, did_raise);
345
363
  rbce->callback_active = 0;
346
- //rb_funcall( rb_easy_get("failure_proc"), idCall, 2, easy, rb_curl_easy_error(result) );
364
+ if (rb_hash_aref(did_raise, "error") != Qnil) {
365
+ CURB_RB_CALLBACK_RAISE("failure")
366
+ }
347
367
  }
348
368
 
349
369
  }
@@ -627,6 +647,8 @@ void init_curb_multi() {
627
647
  idCall = rb_intern("call");
628
648
  cCurlMulti = rb_define_class_under(mCurl, "Multi", rb_cObject);
629
649
 
650
+ rb_undef_alloc_func(cCurlMulti);
651
+
630
652
  /* Class methods */
631
653
  rb_define_singleton_method(cCurlMulti, "new", ruby_curl_multi_new, 0);
632
654
  rb_define_singleton_method(cCurlMulti, "default_timeout=", ruby_curl_multi_set_default_timeout, 1);
data/ext/curb_postfield.c CHANGED
@@ -498,6 +498,8 @@ void init_curb_postfield() {
498
498
 
499
499
  cCurlPostField = rb_define_class_under(mCurl, "PostField", rb_cObject);
500
500
 
501
+ rb_undef_alloc_func(cCurlPostField);
502
+
501
503
  /* Class methods */
502
504
  rb_define_singleton_method(cCurlPostField, "content", ruby_curl_postfield_new_content, -1);
503
505
  rb_define_singleton_method(cCurlPostField, "file", ruby_curl_postfield_new_file, -1);
data/ext/curb_upload.c CHANGED
@@ -72,6 +72,7 @@ VALUE ruby_curl_upload_offset_get(VALUE self) {
72
72
  /* =================== INIT LIB =====================*/
73
73
  void init_curb_upload() {
74
74
  cCurlUpload = rb_define_class_under(mCurl, "Upload", rb_cObject);
75
+ rb_undef_alloc_func(cCurlUpload);
75
76
  rb_define_singleton_method(cCurlUpload, "new", ruby_curl_upload_new, 0);
76
77
  rb_define_method(cCurlUpload, "stream=", ruby_curl_upload_stream_set, 1);
77
78
  rb_define_method(cCurlUpload, "stream", ruby_curl_upload_stream_get, 0);
data/ext/extconf.rb CHANGED
@@ -405,6 +405,8 @@ have_constant "curlopt_path_as_is"
405
405
  # added in 7.43.0
406
406
  have_constant "curlopt_pipewait"
407
407
 
408
+ have_constant "curlopt_proxy_ssl_verifyhost"
409
+
408
410
  # protocol constants
409
411
  have_constant "curlproto_all"
410
412
  have_constant "curlproto_dict"
data/lib/curl/multi.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
  module Curl
3
3
  class Multi
4
+ class DownloadError < RuntimeError
5
+ attr_accessor :errors
6
+ end
4
7
  class << self
5
8
  # call-seq:
6
9
  # Curl::Multi.get(['url1','url2','url3','url4','url5'], :follow_location => true) do|easy|
@@ -241,7 +244,11 @@ module Curl
241
244
  errors << e
242
245
  end
243
246
  }
244
- raise errors unless errors.empty?
247
+ if errors.any?
248
+ de = Curl::Multi::DownloadError.new
249
+ de.errors = errors
250
+ raise de
251
+ end
245
252
  end
246
253
  end
247
254
 
@@ -20,11 +20,21 @@ class BugCrashOnDebug < Test::Unit::TestCase
20
20
  end
21
21
  puts 'b'
22
22
  c = Curl::Easy.new('http://127.0.0.1:9999/test')
23
- c.on_debug do|x|
24
- puts x.inspect
25
- raise "error" # this will get swallowed
23
+ did_raise = false
24
+ did_call = false
25
+ begin
26
+ c.on_success do|x|
27
+ puts x.inspect
28
+ did_call = true
29
+ raise "error" # this will get swallowed
30
+ end
31
+ c.perform
32
+ rescue => e
33
+ did_raise = true
26
34
  end
27
- c.perform
35
+ puts c.response_code
36
+ assert did_raise
37
+ assert did_call
28
38
  puts 'c'
29
39
  ensure
30
40
  puts 'd'
@@ -28,7 +28,8 @@ class BugCrashOnDebug < Test::Unit::TestCase
28
28
  assert_equal 'Curl::Err::AbortedByCallbackError', e.class.to_s
29
29
  c.close
30
30
  ensure
31
- server.shutdown
31
+ server&.shutdown
32
+ thread&.exit
32
33
  end
33
34
 
34
35
  def test_on_progress_abort
@@ -67,7 +68,8 @@ class BugCrashOnDebug < Test::Unit::TestCase
67
68
  assert_equal 'Curl::Err::AbortedByCallbackError', e.class.to_s
68
69
  c.close
69
70
  ensure
70
- server.shutdown
71
+ server&.shutdown
72
+ thread&.exit
71
73
  end
72
74
 
73
75
  end
@@ -0,0 +1,91 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
+ require 'webrick'
3
+ class ::WEBrick::HTTPServer ; def access_log(config, req, res) ; end ; end
4
+ class ::WEBrick::BasicLog ; def log(level, data) ; end ; end
5
+
6
+ class BugFollowRedirect288 < Test::Unit::TestCase
7
+ def test_follow_redirect_with_no_redirect
8
+ server = WEBrick::HTTPServer.new( :Port => 9999 )
9
+ server.mount_proc("/test") do|req,res|
10
+ res.body = "hi"
11
+ res['Content-Type'] = "text/html"
12
+ end
13
+ server.mount_proc("/redirect_to_test") do|req,res|
14
+ res.set_redirect(WEBrick::HTTPStatus::TemporaryRedirect, "/test")
15
+ end
16
+
17
+ thread = Thread.new(server) do|srv|
18
+ srv.start
19
+ end
20
+
21
+ c = Curl::Easy.new('http://127.0.0.1:9999/test')
22
+ did_call_redirect = false
23
+ c.on_redirect do|x|
24
+ did_call_redirect = true
25
+ end
26
+ c.perform
27
+
28
+ assert !did_call_redirect, "should reach this point redirect should not have been called"
29
+
30
+ c = Curl::Easy.new('http://127.0.0.1:9999/test')
31
+ did_call_redirect = false
32
+ c.on_redirect do|x|
33
+ did_call_redirect = true
34
+ end
35
+ c.follow_location = true
36
+ c.perform
37
+
38
+ assert_equal 0, c.redirect_count
39
+ assert !did_call_redirect, "should reach this point redirect should not have been called"
40
+
41
+ c = Curl::Easy.new('http://127.0.0.1:9999/redirect_to_test')
42
+ did_call_redirect = false
43
+ c.on_redirect do|x|
44
+ did_call_redirect = true
45
+ end
46
+ c.perform
47
+ assert_equal 307, c.response_code
48
+
49
+ assert did_call_redirect, "we should have called on_redirect"
50
+
51
+ c = Curl::Easy.new('http://127.0.0.1:9999/redirect_to_test')
52
+ did_call_redirect = false
53
+ c.follow_location = true
54
+ # NOTE: while this API is not supported by libcurl e.g. there is no redirect function callback in libcurl we could
55
+ # add support in ruby for this by executing this callback if redirect_count is greater than 0 at the end of a request in curb_multi.c
56
+ c.on_redirect do|x|
57
+ did_call_redirect = true
58
+ end
59
+ c.perform
60
+ assert_equal 1, c.redirect_count
61
+ assert_equal 200, c.response_code
62
+
63
+ assert did_call_redirect, "we should have called on_redirect"
64
+
65
+ c.url = 'http://127.0.0.1:9999/test'
66
+ c.perform
67
+ assert_equal 0, c.redirect_count
68
+ assert_equal 200, c.response_code
69
+
70
+ did_raise = false
71
+ begin
72
+ c = Curl::Easy.new('http://127.0.0.1:9999/redirect_to_test')
73
+ did_call_redirect = false
74
+ c.on_redirect do|x|
75
+ raise "raise"
76
+ did_call_redirect = true
77
+ end
78
+ c.perform
79
+ rescue => e
80
+ did_raise = true
81
+ end
82
+ assert did_raise
83
+ assert_equal 307, c.response_code
84
+
85
+ ensure
86
+ server.stop
87
+ thread.join
88
+
89
+ end
90
+
91
+ end
@@ -0,0 +1,40 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
+
3
+ require 'webrick'
4
+ class ::WEBrick::HTTPServer ; def access_log(config, req, res) ; end ; end
5
+ class ::WEBrick::BasicLog ; def log(level, data) ; end ; end
6
+
7
+ require 'curl'
8
+
9
+ class BugRaiseOnCallback < Test::Unit::TestCase
10
+
11
+ def test_on_complte
12
+ server = WEBrick::HTTPServer.new( :Port => 9999 )
13
+ server.mount_proc("/test") do|req,res|
14
+ res.body = "hi"
15
+ res['Content-Type'] = "text/html"
16
+ end
17
+ thread = Thread.new(server) do|srv|
18
+ srv.start
19
+ end
20
+ c = Curl::Easy.new('http://127.0.0.1:9999/test')
21
+ did_raise = false
22
+ begin
23
+ c.on_complete do|x|
24
+ assert_equal 'http://127.0.0.1:9999/test', x.url
25
+ raise "error complete" # this will get swallowed
26
+ end
27
+ c.perform
28
+ rescue => e
29
+ did_raise = true
30
+ end
31
+ assert did_raise, "we want to raise an exception if the ruby callbacks raise"
32
+
33
+ ensure
34
+ server.shutdown
35
+ thread.exit
36
+ end
37
+
38
+ end
39
+
40
+ #test_on_debug
@@ -721,9 +721,9 @@ class TestCurbCurlEasy < Test::Unit::TestCase
721
721
  on_success_called = false
722
722
  curl.on_success {|c|
723
723
  on_success_called = true
724
- assert_not_nil c.body_str
725
- assert_equal "", c.header_str
726
- assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body_str)
724
+ assert_not_nil c.body
725
+ assert_match /Content-Length: 7714/, c.head
726
+ assert_match(/^# DO NOT REMOVE THIS COMMENT/, c.body)
727
727
  }
728
728
  curl.perform
729
729
  assert on_success_called, "Success handler not called"
@@ -1147,7 +1147,7 @@ class TestCurbCurlEasy < Test::Unit::TestCase
1147
1147
  c = Curl::Easy.new($TEST_URL)
1148
1148
  c.on_success {|x| raise "error" }
1149
1149
  c.perform
1150
- rescue => e
1150
+ rescue Curl::Err::AbortedByCallbackError => e
1151
1151
  assert_equal 'Curl::Err::AbortedByCallbackError', e.class.to_s
1152
1152
  c.close
1153
1153
  end
@@ -74,7 +74,9 @@ class TestCurbCurlMulti < Test::Unit::TestCase
74
74
  assert did_complete
75
75
  after_open = open_fds.call
76
76
  #puts "after_open: #{after_open} before_open: #{before_open.inspect}"
77
- assert_equal 1, (after_open - before_open), "with max connections set to 1 at this point the connection to google should still be open"
77
+ # ruby process may keep a connection alive
78
+ assert (after_open - before_open) < 3, "with max connections set to 1 at this point the connection to google should still be open"
79
+ assert (after_open - before_open) > 0, "with max connections set to 1 at this point the connection to google should still be open"
78
80
  multi.close
79
81
 
80
82
  after_open = open_fds.call
@@ -159,6 +161,15 @@ class TestCurbCurlMulti < Test::Unit::TestCase
159
161
 
160
162
  end
161
163
 
164
+ def test_multi_easy_get
165
+ n = 1
166
+ urls = []
167
+ n.times { urls << $TEST_URL }
168
+ Curl::Multi.get(urls, {timeout: 5}) {|easy|
169
+ puts easy.last_effective_url
170
+ }
171
+ end
172
+
162
173
  # NOTE: if this test runs slowly on Mac OSX, it is probably due to the use of a port install curl+ssl+ares install
163
174
  # on my MacBook, this causes curl_easy_init to take nearly 0.01 seconds / * 100 below is 1 second too many!
164
175
  def test_n_requests
@@ -480,7 +491,7 @@ class TestCurbCurlMulti < Test::Unit::TestCase
480
491
  { :url => TestServlet.url, :method => :get }
481
492
  ]
482
493
  Curl::Multi.http(urls, {:pipeline => true}) do|easy, code, method|
483
- assert_equal nil, code
494
+ assert_equal 200, code
484
495
  case method
485
496
  when :post
486
497
  assert_match(/POST/, easy.body_str)
@@ -494,20 +505,20 @@ class TestCurbCurlMulti < Test::Unit::TestCase
494
505
  end
495
506
 
496
507
  def test_multi_easy_http_with_max_connects
497
- urls = [
508
+ urls = [
498
509
  { :url => TestServlet.url + '?q=1', :method => :get },
499
510
  { :url => TestServlet.url + '?q=2', :method => :get },
500
511
  { :url => TestServlet.url + '?q=3', :method => :get }
501
512
  ]
502
513
  Curl::Multi.http(urls, {:pipeline => true, :max_connects => 1}) do|easy, code, method|
503
- assert_equal nil, code
514
+ assert_equal 200, code
504
515
  case method
505
516
  when :post
506
- assert_match(/POST/, easy.body_str)
517
+ assert_match(/POST/, easy.body)
507
518
  when :get
508
- assert_match(/GET/, easy.body_str)
519
+ assert_match(/GET/, easy.body)
509
520
  when :put
510
- assert_match(/PUT/, easy.body_str)
521
+ assert_match(/PUT/, easy.body)
511
522
  end
512
523
  end
513
524
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Bamford
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-04-29 00:00:00.000000000 Z
12
+ date: 2022-12-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
15
15
  for the libcurl(3), a fully-featured client-side URL transfer library. cURL and
@@ -50,12 +50,14 @@ files:
50
50
  - tests/bug_crash_on_progress.rb
51
51
  - tests/bug_curb_easy_blocks_ruby_threads.rb
52
52
  - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
53
+ - tests/bug_follow_redirect_288.rb
53
54
  - tests/bug_instance_post_differs_from_class_post.rb
54
55
  - tests/bug_issue102.rb
55
56
  - tests/bug_issue277.rb
56
57
  - tests/bug_multi_segfault.rb
57
58
  - tests/bug_postfields_crash.rb
58
59
  - tests/bug_postfields_crash2.rb
60
+ - tests/bug_raise_on_callback.rb
59
61
  - tests/bug_require_last_or_segfault.rb
60
62
  - tests/bugtests.rb
61
63
  - tests/helper.rb
@@ -96,37 +98,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
98
  - !ruby/object:Gem::Version
97
99
  version: '0'
98
100
  requirements: []
99
- rubygems_version: 3.1.4
101
+ rubygems_version: 3.2.33
100
102
  signing_key:
101
103
  specification_version: 4
102
104
  summary: Ruby libcurl bindings
103
105
  test_files:
104
- - tests/tc_curl_multi.rb
105
106
  - tests/alltests.rb
106
- - tests/tc_curl_easy_setopt.rb
107
- - tests/tc_curl.rb
108
- - tests/bug_postfields_crash.rb
107
+ - tests/bug_crash_on_debug.rb
109
108
  - tests/bug_crash_on_progress.rb
110
- - tests/helper.rb
109
+ - tests/bug_curb_easy_blocks_ruby_threads.rb
110
+ - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
111
+ - tests/bug_follow_redirect_288.rb
112
+ - tests/bug_instance_post_differs_from_class_post.rb
113
+ - tests/bug_issue102.rb
111
114
  - tests/bug_issue277.rb
115
+ - tests/bug_multi_segfault.rb
116
+ - tests/bug_postfields_crash.rb
112
117
  - tests/bug_postfields_crash2.rb
118
+ - tests/bug_raise_on_callback.rb
113
119
  - tests/bug_require_last_or_segfault.rb
114
- - tests/timeout.rb
115
- - tests/bug_crash_on_debug.rb
116
- - tests/unittests.rb
117
- - tests/tc_curl_protocols.rb
118
- - tests/bug_issue102.rb
119
- - tests/bug_curb_easy_blocks_ruby_threads.rb
120
- - tests/bug_multi_segfault.rb
121
- - tests/bug_instance_post_differs_from_class_post.rb
120
+ - tests/bugtests.rb
121
+ - tests/helper.rb
122
+ - tests/mem_check.rb
122
123
  - tests/require_last_or_segfault_script.rb
123
- - tests/timeout_server.rb
124
+ - tests/signals.rb
125
+ - tests/tc_curl.rb
124
126
  - tests/tc_curl_download.rb
125
127
  - tests/tc_curl_easy.rb
126
- - tests/mem_check.rb
127
- - tests/tc_curl_postfield.rb
128
- - tests/tc_curl_maxfilesize.rb
129
- - tests/bugtests.rb
130
128
  - tests/tc_curl_easy_resolve.rb
131
- - tests/signals.rb
132
- - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
129
+ - tests/tc_curl_easy_setopt.rb
130
+ - tests/tc_curl_maxfilesize.rb
131
+ - tests/tc_curl_multi.rb
132
+ - tests/tc_curl_postfield.rb
133
+ - tests/tc_curl_protocols.rb
134
+ - tests/timeout.rb
135
+ - tests/timeout_server.rb
136
+ - tests/unittests.rb