thrift 0.13.0 → 0.15.0

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: 6c894aeced9c6d4f7f4e66441472dbe37603b45722cffe89007e6faa1d2771c8
4
- data.tar.gz: 3417f5e29c4459b18933e1a6c2eb6575ce0b8c6c073bac4836043742854a8c01
3
+ metadata.gz: 2f990b7528ad0c61eee1ef6fb2ff0cfc85c7f4912ec34eb6919e998f5dbbf016
4
+ data.tar.gz: d6958229cbc05dbe919746ec9019823635a29018e8f6c6542c5698bc61d5444a
5
5
  SHA512:
6
- metadata.gz: 4daf374c7752cfd11fb60fa7f1a5323f026bacbff118987f7e4342bfc79e9da8cc80e2872ddf571e2b705a310fe7921bc0c011215ec5f222cee252e0ec9a513f
7
- data.tar.gz: 4712fd01cd41fde2877df76808af17ce303656c3a003dcda92c876766aba508cdaf802511e3698ce5f4476064a435057e47493f05a2e4f928c67e16ec7554562
6
+ metadata.gz: 649454979aca2efed3f750e6d81a5b4763e46d16ea2d7ae795401bca2ec94f4b4a93a8264bf010d3ff54674cb6f206d52a65a886b197dd9ae677a53ff835d79b
7
+ data.tar.gz: 3b257ad43df2146a8ee1bc96d06142476004de18af38080799fe197864cda0858479e18955d20f9dc271f9c40ec106783e87ece7bbc0c3ccba6c32dafda34707
@@ -567,6 +567,7 @@ VALUE rb_thrift_compact_proto_read_binary(VALUE self) {
567
567
 
568
568
  static void Init_constants() {
569
569
  thrift_compact_protocol_class = rb_const_get(thrift_module, rb_intern("CompactProtocol"));
570
+ rb_global_variable(&thrift_compact_protocol_class);
570
571
 
571
572
  VERSION = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION")));
572
573
  VERSION_MASK = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION_MASK")));
data/ext/struct.c CHANGED
@@ -698,14 +698,23 @@ void Init_struct() {
698
698
  rb_define_method(struct_module, "read", rb_thrift_struct_read, 1);
699
699
 
700
700
  thrift_union_class = rb_const_get(thrift_module, rb_intern("Union"));
701
+ rb_global_variable(&thrift_union_class);
701
702
 
702
703
  rb_define_method(thrift_union_class, "write", rb_thrift_union_write, 1);
703
704
  rb_define_method(thrift_union_class, "read", rb_thrift_union_read, 1);
704
705
 
705
706
  setfield_id = rb_intern("@setfield");
707
+ rb_global_variable(&setfield_id);
708
+
706
709
  setvalue_id = rb_intern("@value");
710
+ rb_global_variable(&setvalue_id);
707
711
 
708
712
  to_s_method_id = rb_intern("to_s");
713
+ rb_global_variable(&to_s_method_id);
714
+
709
715
  name_to_id_method_id = rb_intern("name_to_id");
716
+ rb_global_variable(&name_to_id_method_id);
717
+
710
718
  sorted_field_ids_method_id = rb_intern("sorted_field_ids");
719
+ rb_global_variable(&sorted_field_ids_method_id);
711
720
  }
data/ext/thrift_native.c CHANGED
@@ -112,10 +112,19 @@ VALUE protocol_exception_class;
112
112
  void Init_thrift_native() {
113
113
  // cached classes
114
114
  thrift_module = rb_const_get(rb_cObject, rb_intern("Thrift"));
115
+ rb_global_variable(&thrift_module);
116
+
115
117
  thrift_bytes_module = rb_const_get(thrift_module, rb_intern("Bytes"));
118
+ rb_global_variable(&thrift_bytes_module);
119
+
116
120
  thrift_types_module = rb_const_get(thrift_module, rb_intern("Types"));
121
+ rb_global_variable(&thrift_types_module);
122
+
117
123
  rb_cSet = rb_const_get(rb_cObject, rb_intern("Set"));
124
+ rb_global_variable(&rb_cSet);
125
+
118
126
  protocol_exception_class = rb_const_get(thrift_module, rb_intern("ProtocolException"));
127
+ rb_global_variable(&protocol_exception_class);
119
128
 
120
129
  // Init ttype constants
121
130
  TTYPE_BOOL = FIX2INT(rb_const_get(thrift_types_module, rb_intern("BOOL")));
@@ -194,6 +203,14 @@ void Init_thrift_native() {
194
203
  class_sym = ID2SYM(rb_intern("class"));
195
204
  binary_sym = ID2SYM(rb_intern("binary"));
196
205
 
206
+ rb_global_variable(&type_sym);
207
+ rb_global_variable(&name_sym);
208
+ rb_global_variable(&key_sym);
209
+ rb_global_variable(&value_sym);
210
+ rb_global_variable(&element_sym);
211
+ rb_global_variable(&class_sym);
212
+ rb_global_variable(&binary_sym);
213
+
197
214
  Init_struct();
198
215
  Init_binary_protocol_accelerated();
199
216
  Init_compact_protocol();
@@ -47,6 +47,8 @@ module Thrift
47
47
  http.use_ssl = @url.scheme == 'https'
48
48
  http.verify_mode = @ssl_verify_mode if @url.scheme == 'https'
49
49
  resp = http.post(@url.request_uri, @outbuf, @headers)
50
+ raise TransportException.new(TransportException::UNKNOWN, "#{self.class.name} Could not connect to #{@url}, HTTP status code #{resp.code.to_i}") unless (200..299).include?(resp.code.to_i)
51
+
50
52
  data = resp.body
51
53
  data = Bytes.force_binary_encoding(data)
52
54
  @inbuf = StringIO.new data
@@ -45,6 +45,7 @@ describe 'Thrift::HTTPClientTransport' do
45
45
  expect(http).to receive(:post).with("/path/to/service?param=value", "a test frame", {"Content-Type"=>"application/x-thrift"}) do
46
46
  double("Net::HTTPOK").tap do |response|
47
47
  expect(response).to receive(:body).and_return "data"
48
+ expect(response).to receive(:code).and_return "200"
48
49
  end
49
50
  end
50
51
  end
@@ -65,6 +66,7 @@ describe 'Thrift::HTTPClientTransport' do
65
66
  expect(http).to receive(:post).with("/path/to/service?param=value", "test", headers) do
66
67
  double("Net::HTTPOK").tap do |response|
67
68
  expect(response).to receive(:body).and_return "data"
69
+ expect(response).to receive(:code).and_return "200"
68
70
  end
69
71
  end
70
72
  end
@@ -86,6 +88,24 @@ describe 'Thrift::HTTPClientTransport' do
86
88
  expect(@client.instance_variable_get(:@outbuf)).to eq(Thrift::Bytes.empty_byte_buffer)
87
89
  end
88
90
 
91
+ it 'should raise TransportError on HTTP failures' do
92
+ @client.write "test"
93
+
94
+ expect(Net::HTTP).to receive(:new).with("my.domain.com", 80) do
95
+ double("Net::HTTP").tap do |http|
96
+ expect(http).to receive(:use_ssl=).with(false)
97
+ expect(http).to receive(:post).with("/path/to/service?param=value", "test", {"Content-Type"=>"application/x-thrift"}) do
98
+ double("Net::HTTPOK").tap do |response|
99
+ expect(response).not_to receive(:body)
100
+ expect(response).to receive(:code).at_least(:once).and_return "503"
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ expect { @client.flush }.to raise_error(Thrift::TransportException)
107
+ end
108
+
89
109
  end
90
110
 
91
111
  describe 'ssl enabled' do
@@ -107,6 +127,7 @@ describe 'Thrift::HTTPClientTransport' do
107
127
  "Content-Type" => "application/x-thrift") do
108
128
  double("Net::HTTPOK").tap do |response|
109
129
  expect(response).to receive(:body).and_return "data"
130
+ expect(response).to receive(:code).and_return "200"
110
131
  end
111
132
  end
112
133
  end
@@ -128,6 +149,7 @@ describe 'Thrift::HTTPClientTransport' do
128
149
  "Content-Type" => "application/x-thrift") do
129
150
  double("Net::HTTPOK").tap do |response|
130
151
  expect(response).to receive(:body).and_return "data"
152
+ expect(response).to receive(:code).and_return "200"
131
153
  end
132
154
  end
133
155
  end
data/spec/spec_helper.rb CHANGED
@@ -62,3 +62,8 @@ end
62
62
 
63
63
  $:.unshift File.join(File.dirname(__FILE__), *%w[gen-rb/flat])
64
64
 
65
+ if defined?(GC.verify_compaction_references) == 'method'
66
+ # This method was added in Ruby 3.0.0. Calling it this way asks the GC to
67
+ # move objects around, helping to find object movement bugs.
68
+ GC.verify_compaction_references(double_heap: true, toward: :empty)
69
+ end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thrift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apache Thrift Developers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-29 00:00:00.000000000 Z
11
+ date: 2021-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.11'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.11'
27
27
  - !ruby/object:Gem::Dependency
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: rack
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: '2.0'
75
+ version: 2.0.8
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: '2.0'
82
+ version: 2.0.8
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rack-test
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '3.7'
125
+ - !ruby/object:Gem::Dependency
126
+ name: srv
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: thin
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -309,7 +323,7 @@ homepage: http://thrift.apache.org
309
323
  licenses:
310
324
  - Apache-2.0
311
325
  metadata: {}
312
- post_install_message:
326
+ post_install_message:
313
327
  rdoc_options:
314
328
  - "--line-numbers"
315
329
  - "--inline-source"
@@ -333,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
333
347
  requirements: []
334
348
  rubyforge_project: thrift
335
349
  rubygems_version: 2.7.6.2
336
- signing_key:
350
+ signing_key:
337
351
  specification_version: 4
338
352
  summary: Ruby bindings for Apache Thrift
339
353
  test_files: