curb 0.9.8 → 0.9.9

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
- SHA256:
3
- metadata.gz: 64402c665924d5c24d6fa01dff9dd9f41d522ef1ca6e663d2038a204bd0290b4
4
- data.tar.gz: 645f0b0f29804b105b9a4caaa1b2132d9d18b5dd4d678072e7e41a1d8d73771a
2
+ SHA1:
3
+ metadata.gz: fd889c4132ef60a5341daea20eb772c6598de7b5
4
+ data.tar.gz: 64d2ac621fa5d61716f3816699cbcb51d42fe014
5
5
  SHA512:
6
- metadata.gz: f86cb2a29633a86820862e35a5a1113c859e55636a50e779ab4235ccc54fb3b38a894edb8fcc090522ceb509ac0c2da329f708a9c109a2f871ce9c718984729c
7
- data.tar.gz: a2d20ac0b5aee80de2aa37f4c49b923c5e6b19c2b0dd82d4466d14b21f0988644baa893bd23950380efec0ab028c9f1fd9c1dfc6d2ab7c97246c86bb2aad5cf2
6
+ metadata.gz: 2d9e5ea00b7bf51cd58d25ddde708be4a8b298666008c3a738577ab7a6e725c479807b8d212653d90a37d756c3fe81b9f4b3bc9ab0bfe3cc8867834462cfbbf2
7
+ data.tar.gz: 5c4bb1cb9b2638c0cc1cb159b5386b48e4e72c2759d9e6095c842c2f0f099380ffa4a0dafbf6ffd722b76493aaa6f6ec69132ad9164f1ddd4ce58eda1bb3f70f
data/Rakefile CHANGED
@@ -186,7 +186,7 @@ else
186
186
  spec_source = File.read File.join(File.dirname(__FILE__),'curb.gemspec')
187
187
  spec = nil
188
188
  # see: http://gist.github.com/16215
189
- Thread.new { spec = eval("$SAFE = 3\n#{spec_source}") }.join
189
+ Thread.new { spec = eval("#{spec_source}") }.join
190
190
  spec.validate
191
191
  Gem::Package.build(spec)
192
192
  end
data/ext/curb.c CHANGED
@@ -1040,6 +1040,16 @@ void Init_curb_core() {
1040
1040
  CURB_DEFINE(CURLOPT_PIPEWAIT);
1041
1041
  #endif
1042
1042
 
1043
+ #if HAVE_CURLOPT_TCP_KEEPALIVE
1044
+ CURB_DEFINE(CURLOPT_TCP_KEEPALIVE);
1045
+ CURB_DEFINE(CURLOPT_TCP_KEEPIDLE);
1046
+ CURB_DEFINE(CURLOPT_TCP_KEEPINTVL);
1047
+ #endif
1048
+
1049
+ #if HAVE_CURLOPT_HAPROXYPROTOCOL
1050
+ CURB_DEFINE(CURLOPT_HAPROXYPROTOCOL);
1051
+ #endif
1052
+
1043
1053
  #if LIBCURL_VERSION_NUM >= 0x072B00 /* 7.43.0 */
1044
1054
  CURB_DEFINE(CURLPIPE_NOTHING);
1045
1055
  CURB_DEFINE(CURLPIPE_HTTP1);
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.9.8"
24
- #define CURB_VER_NUM 908
23
+ #define CURB_VERSION "0.9.9"
24
+ #define CURB_VER_NUM 909
25
25
  #define CURB_VER_MAJ 0
26
26
  #define CURB_VER_MIN 9
27
- #define CURB_VER_MIC 8
27
+ #define CURB_VER_MIC 9
28
28
  #define CURB_VER_PATCH 0
29
29
 
30
30
 
@@ -247,6 +247,7 @@ static void ruby_curl_easy_free(ruby_curl_easy *rbce) {
247
247
  curl_easy_setopt(rbce->curl, CURLOPT_PROGRESSFUNCTION, NULL);
248
248
  curl_easy_setopt(rbce->curl, CURLOPT_NOPROGRESS, 1);
249
249
  curl_easy_cleanup(rbce->curl);
250
+ rbce->curl = NULL;
250
251
  }
251
252
  }
252
253
 
@@ -2543,7 +2544,7 @@ VALUE ruby_curl_easy_setup(ruby_curl_easy *rbce) {
2543
2544
  *
2544
2545
  * Clean up a connection
2545
2546
  *
2546
- * Always returns Qtrue.
2547
+ * Always returns Qnil.
2547
2548
  */
2548
2549
  VALUE ruby_curl_easy_cleanup( VALUE self, ruby_curl_easy *rbce ) {
2549
2550
 
@@ -2583,6 +2584,9 @@ VALUE ruby_curl_easy_cleanup( VALUE self, ruby_curl_easy *rbce ) {
2583
2584
  curl_easy_setopt(curl, CURLOPT_INFILESIZE, 0);
2584
2585
  }
2585
2586
 
2587
+ // set values on cleanup to nil
2588
+ rb_easy_del("multi");
2589
+
2586
2590
  return Qnil;
2587
2591
  }
2588
2592
 
@@ -3571,6 +3575,22 @@ static VALUE ruby_curl_easy_set_opt(VALUE self, VALUE opt, VALUE val) {
3571
3575
  case CURLOPT_MAXFILESIZE:
3572
3576
  curl_easy_setopt(rbce->curl, CURLOPT_MAXFILESIZE, NUM2LONG(val));
3573
3577
  break;
3578
+ #endif
3579
+ #if HAVE_CURLOPT_TCP_KEEPALIVE
3580
+ case CURLOPT_TCP_KEEPALIVE:
3581
+ curl_easy_setopt(rbce->curl, CURLOPT_TCP_KEEPALIVE, NUM2LONG(val));
3582
+ break;
3583
+ case CURLOPT_TCP_KEEPIDLE:
3584
+ curl_easy_setopt(rbce->curl, CURLOPT_TCP_KEEPIDLE, NUM2LONG(val));
3585
+ break;
3586
+ case CURLOPT_TCP_KEEPINTVL:
3587
+ curl_easy_setopt(rbce->curl, CURLOPT_TCP_KEEPINTVL, NUM2LONG(val));
3588
+ break;
3589
+ #endif
3590
+ #if HAVE_CURLOPT_HAPROXYPROTOCOL
3591
+ case CURLOPT_HAPROXYPROTOCOL:
3592
+ curl_easy_setopt(rbce->curl, HAVE_CURLOPT_HAPROXYPROTOCOL, NUM2LONG(val));
3593
+ break;
3574
3594
  #endif
3575
3595
  default:
3576
3596
  rb_raise(rb_eTypeError, "Curb unsupported option");
@@ -59,6 +59,9 @@ def have_constant(name)
59
59
  end
60
60
  end
61
61
 
62
+ have_constant "curlopt_tcp_keepalive"
63
+ have_constant "curlopt_tcp_keepidle"
64
+ have_constant "curlopt_tcp_keepintvl"
62
65
  have_constant "curlinfo_appconnect_time"
63
66
  have_constant "curlinfo_redirect_time"
64
67
  have_constant "curlinfo_response_code"
@@ -153,6 +156,8 @@ have_func("curl_multi_timeout")
153
156
  have_func("curl_multi_fdset")
154
157
  have_func("curl_multi_perform")
155
158
 
159
+ have_constant "curlopt_haproxyprotocol"
160
+
156
161
  # constants
157
162
  have_constant "curlopt_interleavefunction"
158
163
  have_constant "curlopt_interleavedata"
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  require 'curl'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'curb_core'
2
3
  require 'curl/easy'
3
4
  require 'curl/multi'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Curl
2
3
  class Easy
3
4
 
@@ -68,6 +69,11 @@ module Curl
68
69
  ret = self.multi.perform
69
70
  self.multi.remove self
70
71
 
72
+ if Curl::Multi.autoclose
73
+ self.multi.close
74
+ self.multi = nil
75
+ end
76
+
71
77
  if self.last_result != 0 && self.on_failure.nil?
72
78
  error = Curl::Easy.error(self.last_result)
73
79
  raise error.first.new(self.head)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Curl
2
3
  class Multi
3
4
  class << self
@@ -0,0 +1,32 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
+
3
+
4
+ require 'curb'
5
+
6
+ class BugIssue102 < Test::Unit::TestCase
7
+
8
+ def test_gc_closewait
9
+ 100.times do
10
+ responses = {}
11
+ requests = ["http://www.google.co.uk/", "http://www.ruby-lang.org/"]
12
+ m = Curl::Multi.new
13
+ # add a few easy handles
14
+ requests.each do |url|
15
+ responses[url] = ""
16
+ c = Curl::Easy.new(url) do|curl|
17
+ curl.follow_location = true
18
+ curl.on_body{|data| responses[url] << data; data.size }
19
+ curl.on_success {|easy| #puts "success, add more easy handles"
20
+ }
21
+ end
22
+ m.add(c)
23
+ end
24
+
25
+ m.perform do
26
+ #puts "idling... can do some work here"
27
+ end
28
+ GC.start
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,12 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
+
3
+ class TestCurbCurlMaxFileSize < Test::Unit::TestCase
4
+ def setup
5
+ @easy = Curl::Easy.new
6
+ end
7
+
8
+ def test_maxfilesize
9
+ @easy.set(Curl::CURLOPT_MAXFILESIZE, 5000000)
10
+ end
11
+
12
+ end
@@ -10,8 +10,9 @@ class TestCurbCurlMulti < Test::Unit::TestCase
10
10
  # must connect to an external
11
11
  def test_connection_keepalive
12
12
  # 0123456 default & reserved RubyVM. It will probably include 7 from Dir.glob
13
+ lsof=`/usr/bin/which lsof`.strip
13
14
  open_fds = lambda do
14
- `/usr/sbin/lsof -p #{Process.pid} | egrep "TCP|UDP" | wc -l`.strip.to_i
15
+ `#{lsof} -p #{Process.pid} | egrep "TCP|UDP" | wc -l`.strip.to_i
15
16
  end
16
17
  before_open = open_fds.call
17
18
  assert !Curl::Multi.autoclose
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: 0.9.8
4
+ version: 0.9.9
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: 2019-01-28 00:00:00.000000000 Z
12
+ date: 2019-03-07 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
@@ -51,6 +51,7 @@ files:
51
51
  - tests/bug_curb_easy_post_with_string_no_content_length_header.rb
52
52
  - tests/bug_instance_post_differs_from_class_post.rb
53
53
  - tests/bug_issue102.rb
54
+ - tests/bug_issue277.rb
54
55
  - tests/bug_multi_segfault.rb
55
56
  - tests/bug_postfields_crash.rb
56
57
  - tests/bug_postfields_crash2.rb
@@ -65,6 +66,7 @@ files:
65
66
  - tests/tc_curl_easy.rb
66
67
  - tests/tc_curl_easy_resolve.rb
67
68
  - tests/tc_curl_easy_setopt.rb
69
+ - tests/tc_curl_maxfilesize.rb
68
70
  - tests/tc_curl_multi.rb
69
71
  - tests/tc_curl_postfield.rb
70
72
  - tests/timeout.rb
@@ -72,7 +74,7 @@ files:
72
74
  - tests/unittests.rb
73
75
  homepage: http://curb.rubyforge.org/
74
76
  licenses:
75
- - Ruby
77
+ - MIT
76
78
  metadata: {}
77
79
  post_install_message:
78
80
  rdoc_options:
@@ -93,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
95
  version: '0'
94
96
  requirements: []
95
97
  rubyforge_project: curb
96
- rubygems_version: 2.7.7
98
+ rubygems_version: 2.5.2
97
99
  signing_key:
98
100
  specification_version: 4
99
101
  summary: Ruby libcurl bindings
@@ -105,6 +107,7 @@ test_files:
105
107
  - tests/bug_postfields_crash.rb
106
108
  - tests/bug_crash_on_progress.rb
107
109
  - tests/helper.rb
110
+ - tests/bug_issue277.rb
108
111
  - tests/bug_postfields_crash2.rb
109
112
  - tests/bug_require_last_or_segfault.rb
110
113
  - tests/timeout.rb
@@ -120,6 +123,7 @@ test_files:
120
123
  - tests/tc_curl_easy.rb
121
124
  - tests/mem_check.rb
122
125
  - tests/tc_curl_postfield.rb
126
+ - tests/tc_curl_maxfilesize.rb
123
127
  - tests/bugtests.rb
124
128
  - tests/tc_curl_easy_resolve.rb
125
129
  - tests/signals.rb