thrift 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thrift/transport/http_client_transport.rb +2 -0
- data/spec/http_client_spec.rb +22 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f82075a1d228750e0b70f3bae434d45ae11fa9bf73062986a0377344e9673a0f
|
4
|
+
data.tar.gz: 60bb709c6c72588e6547be56a2b9caa12711e19970ff54595fe6b6a979e6d303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 678a0784be7d06bb5ec9b70c08031d59e8798ff439c7ded371186572b7819ca0c23d9dfe4edbbfacf13e49f1945b1383aed0b97983e491cbcbc89226433d7c1a
|
7
|
+
data.tar.gz: 294aeff21a03505dc0ac344077d7f8a0a04b817ff127507fd8e744bf9a6000dc673b0bce0898ee99670e6e38f9ae2d033198f0607331ba71e220ae828f63de4b
|
@@ -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
|
data/spec/http_client_spec.rb
CHANGED
@@ -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.
|
4
|
+
version: 0.14.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:
|
11
|
+
date: 2021-02-12 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:
|
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:
|
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:
|