thrift 0.13.0 → 0.14.1

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: 537be848790427a946dbfb10294b6d7e6596396d479b0e65d3da45b4a5631d43
4
+ data.tar.gz: ff685e132618458dd33db2c4539da62439f2ab0c2981a31bb602c84c93da2615
5
5
  SHA512:
6
- metadata.gz: 4daf374c7752cfd11fb60fa7f1a5323f026bacbff118987f7e4342bfc79e9da8cc80e2872ddf571e2b705a310fe7921bc0c011215ec5f222cee252e0ec9a513f
7
- data.tar.gz: 4712fd01cd41fde2877df76808af17ce303656c3a003dcda92c876766aba508cdaf802511e3698ce5f4476064a435057e47493f05a2e4f928c67e16ec7554562
6
+ metadata.gz: 5dfa4cdfc317f2197d3309b097111aea74cc7c71de70f22dde133575d8bc5a6f489646c947616eef858cbef45e51f0a7564a0ada7fcc7683e37ecdaed864a3e7
7
+ data.tar.gz: cbab054a2513d0d06ece8c92a53fa0216d0709163b5cd0fcedfe185130e4b00f69ef55ab562d98285605d71353ea94122658de409013507b66dd2cd30a21b2e7
@@ -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
metadata CHANGED
@@ -1,14 +1,14 @@
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.14.1
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-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -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
@@ -309,7 +309,7 @@ homepage: http://thrift.apache.org
309
309
  licenses:
310
310
  - Apache-2.0
311
311
  metadata: {}
312
- post_install_message:
312
+ post_install_message:
313
313
  rdoc_options:
314
314
  - "--line-numbers"
315
315
  - "--inline-source"
@@ -333,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
333
333
  requirements: []
334
334
  rubyforge_project: thrift
335
335
  rubygems_version: 2.7.6.2
336
- signing_key:
336
+ signing_key:
337
337
  specification_version: 4
338
338
  summary: Ruby bindings for Apache Thrift
339
339
  test_files: