curb 0.9.10 → 0.9.11

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: 7fd2f75fea9421bc6361cd44ea7343f42867eb1f87177e20598be60548e68a07
4
- data.tar.gz: e30c3e3ba5e406d5517ad89f728f0c4a95682c9ec750fc93ce3fb381da5ac2cc
3
+ metadata.gz: ecd73a0ad8d98960321b8d523e25bad95ff25e8900e8acb187051ca40c7a1cba
4
+ data.tar.gz: c154996d92946fe83fa12d695b073d5026e4a55e92efd177bfad021461f2b313
5
5
  SHA512:
6
- metadata.gz: 6140588c19e97ce62b9c180fe07355f4781adfa84d3066402378b3abc995c5e23d1abc7458e4575a91964c8ea9fe572276a73a1dab8447de8607325a3fc9463f
7
- data.tar.gz: 88ef4f8b18028a2d6e695a543a624d1cd468482cbc06c13b94c94504a30711b9ff0b1d45b7c2f0af145a9114d1bef1975e5889f63fdd0e6387c2c86912394270
6
+ metadata.gz: 48854a4f0d77befe0e81b31a3d39e826b2ef65d58d0226b617a355ba8d063ab4998853a8709ae6d2e3c4629c09ff987099398a1c884b76d95dcf956d941fc660
7
+ data.tar.gz: 3291675a74eb40f42d936bb65689da7d5f295e038ed019482d2cf115ba878232ce4e40aeb125d0fe786b5e82428320938ff3c75592a5c54a2d51fbe8589a0931
@@ -0,0 +1,32 @@
1
+ #ifndef BANNED_H
2
+ #define BANNED_H
3
+
4
+ /*
5
+ * This header lists functions that have been banned from our code base,
6
+ * because they're too easy to misuse (and even if used correctly,
7
+ * complicate audits). Including this header turns them into compile-time
8
+ * errors.
9
+ */
10
+
11
+ #define BANNED(func) sorry_##func##_is_a_banned_function
12
+
13
+ #undef strcpy
14
+ #define strcpy(x,y) BANNED(strcpy)
15
+ #undef strcat
16
+ #define strcat(x,y) BANNED(strcat)
17
+ #undef strncpy
18
+ #define strncpy(x,y,n) BANNED(strncpy)
19
+ #undef strncat
20
+ #define strncat(x,y,n) BANNED(strncat)
21
+
22
+ #undef sprintf
23
+ #undef vsprintf
24
+ #ifdef HAVE_VARIADIC_MACROS
25
+ #define sprintf(...) BANNED(sprintf)
26
+ #define vsprintf(...) BANNED(vsprintf)
27
+ #else
28
+ #define sprintf(buf,fmt,arg) BANNED(sprintf)
29
+ #define vsprintf(buf,fmt,arg) BANNED(sprintf)
30
+ #endif
31
+
32
+ #endif /* BANNED_H */
data/ext/curb.h CHANGED
@@ -18,6 +18,7 @@
18
18
 
19
19
  #include <curl/curl.h>
20
20
 
21
+ #include "banned.h"
21
22
  #include "curb_config.h"
22
23
  #include "curb_easy.h"
23
24
  #include "curb_errors.h"
@@ -27,11 +28,11 @@
27
28
  #include "curb_macros.h"
28
29
 
29
30
  // These should be managed from the Rake 'release' task.
30
- #define CURB_VERSION "0.9.10"
31
- #define CURB_VER_NUM 9010
31
+ #define CURB_VERSION "0.9.11"
32
+ #define CURB_VER_NUM 9011
32
33
  #define CURB_VER_MAJ 0
33
34
  #define CURB_VER_MIN 9
34
- #define CURB_VER_MIC 10
35
+ #define CURB_VER_MIC 11
35
36
  #define CURB_VER_PATCH 0
36
37
 
37
38
 
@@ -3596,7 +3596,7 @@ static VALUE ruby_curl_easy_set_opt(VALUE self, VALUE opt, VALUE val) {
3596
3596
  #endif
3597
3597
  #if HAVE_CURLOPT_HAPROXYPROTOCOL
3598
3598
  case CURLOPT_HAPROXYPROTOCOL:
3599
- curl_easy_setopt(rbce->curl, HAVE_CURLOPT_HAPROXYPROTOCOL, NUM2LONG(val));
3599
+ curl_easy_setopt(rbce->curl, CURLOPT_HAPROXYPROTOCOL, NUM2LONG(val));
3600
3600
  break;
3601
3601
  #endif
3602
3602
  case CURLOPT_STDERR:
@@ -144,7 +144,7 @@ module Curl
144
144
 
145
145
  max_connects.times do
146
146
  conf = urls_with_config.pop
147
- add_free_handle.call conf, nil
147
+ add_free_handle.call(conf, nil) if conf
148
148
  break if urls_with_config.empty?
149
149
  end
150
150
 
@@ -153,7 +153,7 @@ module Curl
153
153
  if urls_with_config.size > 0 && free_handles.size > 0
154
154
  easy = free_handles.pop
155
155
  conf = urls_with_config.pop
156
- add_free_handle.call conf, easy
156
+ add_free_handle.call(conf, easy) if conf
157
157
  end
158
158
  end
159
159
 
@@ -2,63 +2,63 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
2
 
3
3
  class TestCurbCurlPostfield < Test::Unit::TestCase
4
4
  def test_private_new
5
- assert_raise(NoMethodError) { Curl::PostField.new }
5
+ assert_raise(NoMethodError) { Curl::PostField.new }
6
6
  end
7
-
7
+
8
8
  def test_new_content_01
9
9
  pf = Curl::PostField.content('foo', 'bar')
10
-
10
+
11
11
  assert_equal 'foo', pf.name
12
12
  assert_equal 'bar', pf.content
13
13
  assert_nil pf.content_type
14
14
  assert_nil pf.local_file
15
- assert_nil pf.remote_file
15
+ assert_nil pf.remote_file
16
16
  assert_nil pf.set_content_proc
17
17
  end
18
-
18
+
19
19
  def test_new_content_02
20
20
  pf = Curl::PostField.content('foo', 'bar', 'text/html')
21
-
21
+
22
22
  assert_equal 'foo', pf.name
23
23
  assert_equal 'bar', pf.content
24
24
  assert_equal 'text/html', pf.content_type
25
25
  assert_nil pf.local_file
26
26
  assert_nil pf.remote_file
27
- assert_nil pf.set_content_proc
28
- end
29
-
27
+ assert_nil pf.set_content_proc
28
+ end
29
+
30
30
  def test_new_content_03
31
31
  l = lambda { |field| "never gets run" }
32
32
  pf = Curl::PostField.content('foo', &l)
33
-
33
+
34
34
  assert_equal 'foo', pf.name
35
35
  assert_nil pf.content
36
36
  assert_nil pf.content_type
37
37
  assert_nil pf.local_file
38
38
  assert_nil pf.remote_file
39
-
39
+
40
40
  # N.B. This doesn't just get the proc, but also removes it.
41
41
  assert_equal l, pf.set_content_proc
42
- end
42
+ end
43
43
 
44
44
  def test_new_content_04
45
45
  l = lambda { |field| "never gets run" }
46
46
  pf = Curl::PostField.content('foo', 'text/html', &l)
47
-
47
+
48
48
  assert_equal 'foo', pf.name
49
49
  assert_nil pf.content
50
50
  assert_equal 'text/html', pf.content_type
51
51
  assert_nil pf.local_file
52
52
  assert_nil pf.remote_file
53
-
53
+
54
54
  # N.B. This doesn't just get the proc, but also removes it.
55
55
  assert_equal l, pf.set_content_proc
56
- end
56
+ end
57
57
 
58
58
 
59
59
  def test_new_file_01
60
60
  pf = Curl::PostField.file('foo', 'localname')
61
-
61
+
62
62
  assert_equal 'foo', pf.name
63
63
  assert_equal 'localname', pf.local_file
64
64
  assert_equal 'localname', pf.remote_file
@@ -67,44 +67,44 @@ class TestCurbCurlPostfield < Test::Unit::TestCase
67
67
  assert_nil pf.content
68
68
  assert_nil pf.set_content_proc
69
69
  end
70
-
70
+
71
71
  def test_new_file_02
72
72
  pf = Curl::PostField.file('foo', 'localname', 'remotename')
73
-
73
+
74
74
  assert_equal 'foo', pf.name
75
75
  assert_equal 'localname', pf.local_file
76
76
  assert_equal 'remotename', pf.remote_file
77
77
  assert_nil pf.content_type
78
78
  assert_nil pf.content
79
79
  assert_nil pf.set_content_proc
80
- end
81
-
80
+ end
81
+
82
82
  def test_new_file_03
83
83
  l = lambda { |field| "never gets run" }
84
84
  pf = Curl::PostField.file('foo', 'remotename', &l)
85
-
85
+
86
86
  assert_equal 'foo', pf.name
87
87
  assert_equal 'remotename', pf.remote_file
88
88
  assert_nil pf.local_file
89
89
  assert_nil pf.content_type
90
90
  assert_nil pf.content
91
-
91
+
92
92
  # N.B. This doesn't just get the proc, but also removes it.
93
93
  assert_equal l, pf.set_content_proc
94
- end
94
+ end
95
95
 
96
96
  def test_new_file_04
97
97
  assert_raise(ArgumentError) do
98
98
  # no local name, no block
99
99
  Curl::PostField.file('foo')
100
100
  end
101
-
101
+
102
102
  assert_raise(ArgumentError) do
103
103
  # no remote name with block
104
104
  Curl::PostField.file('foo') { |field| "never runs" }
105
105
  end
106
106
  end
107
-
107
+
108
108
  def test_new_file_05
109
109
  # local gets ignored when supplying a block, but remote
110
110
  # is still set up properly.
@@ -118,15 +118,15 @@ class TestCurbCurlPostfield < Test::Unit::TestCase
118
118
  assert_nil pf.content
119
119
 
120
120
  assert_equal l, pf.set_content_proc
121
- end
122
-
121
+ end
122
+
123
123
  def test_to_s_01
124
- pf = Curl::PostField.content('foo', 'bar')
124
+ pf = Curl::PostField.content('foo', 'bar')
125
125
  assert_equal "foo=bar", pf.to_s
126
126
  end
127
127
 
128
128
  def test_to_s_02
129
- pf = Curl::PostField.content('foo', 'bar ton')
129
+ pf = Curl::PostField.content('foo', 'bar ton')
130
130
  assert_equal "foo=bar%20ton", pf.to_s
131
131
  end
132
132
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.10
4
+ version: 0.9.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Bamford
8
8
  - Todd A. Fisher
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-18 00:00:00.000000000 Z
12
+ date: 2020-11-02 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
@@ -26,6 +26,7 @@ files:
26
26
  - README.markdown
27
27
  - Rakefile
28
28
  - doc.rb
29
+ - ext/banned.h
29
30
  - ext/curb.c
30
31
  - ext/curb.h
31
32
  - ext/curb_easy.c
@@ -76,7 +77,7 @@ homepage: https://github.com/taf2/curb
76
77
  licenses:
77
78
  - MIT
78
79
  metadata: {}
79
- post_install_message:
80
+ post_install_message:
80
81
  rdoc_options:
81
82
  - "--main"
82
83
  - README.markdown
@@ -94,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  - !ruby/object:Gem::Version
95
96
  version: '0'
96
97
  requirements: []
97
- rubyforge_project: curb
98
- rubygems_version: 2.7.9
99
- signing_key:
98
+ rubygems_version: 3.0.8
99
+ signing_key:
100
100
  specification_version: 4
101
101
  summary: Ruby libcurl bindings
102
102
  test_files: