upfluence-thrift 1.0.6 → 1.0.7
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5be267a87cec41d07f9a14ce879abbb6f7de8228
|
4
|
+
data.tar.gz: aaf02c1244cdea7459e76e35514a41e16657364b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79ecb2ac671d310e39d579372e14dc8a3854174ba7a8f95f5f1b987547e68a81381f2045ec942995995bfc149512b5c715c039b04ba27105604fb7be6f0401ff
|
7
|
+
data.tar.gz: c3dde03681f60b83e5dcdfdd0aa02f75181f6fd76733aa54ee766a304bdc52c6a9f2e9345ff783ea0e831429ada4f8c2ab9cfbd6ddb51d448fdeab7e6c6c43dc
|
data/lib/thrift/processor.rb
CHANGED
@@ -26,38 +26,45 @@ require 'stringio'
|
|
26
26
|
|
27
27
|
module Thrift
|
28
28
|
class HTTPClientTransport < BaseTransport
|
29
|
+
DEFAULT_HEADERS = { 'Content-Type' => 'application/x-thrift' }.freeze
|
29
30
|
|
30
31
|
def initialize(url, opts = {})
|
31
32
|
@url = URI url
|
32
|
-
@headers = {
|
33
|
+
@headers = DEFAULT_HEADERS.merge(opts.fetch(:headers, {}))
|
33
34
|
@outbuf = Bytes.empty_byte_buffer
|
34
35
|
@ssl_verify_mode = opts.fetch(:ssl_verify_mode, OpenSSL::SSL::VERIFY_PEER)
|
35
36
|
@error_logger = opts[:error_logger]
|
36
37
|
@retries = opts.fetch(:retries, 1)
|
38
|
+
@open_timeout = opts[:open_timeout]
|
39
|
+
@read_timeout = opts[:read_timeout]
|
37
40
|
end
|
38
41
|
|
39
42
|
def open?; true end
|
40
43
|
def read(sz); @inbuf.read sz end
|
41
44
|
def write(buf); @outbuf << Bytes.force_binary_encoding(buf) end
|
42
45
|
|
43
|
-
def add_headers(headers)
|
44
|
-
@headers = @headers.merge(headers)
|
45
|
-
end
|
46
|
-
|
47
46
|
def flush
|
48
47
|
tries ||= @retries
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
resp = http.post(@url.request_uri, @outbuf, @headers)
|
53
|
-
data = resp.body
|
54
|
-
data = Bytes.force_binary_encoding(data)
|
55
|
-
@inbuf = StringIO.new data
|
48
|
+
resp = http_client.post(@url.request_uri, @outbuf.dup, @headers)
|
49
|
+
resp.value
|
50
|
+
@inbuf = StringIO.new Bytes.force_binary_encoding(resp.body)
|
56
51
|
rescue => e
|
57
52
|
retry if (tries -= 1) > 0
|
58
|
-
|
53
|
+
raise TransportException.new(TransportException::UNKNOWN, e.to_s)
|
59
54
|
ensure
|
60
55
|
@outbuf = Bytes.empty_byte_buffer
|
61
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def http_client
|
61
|
+
http = Net::HTTP.new @url.host, @url.port
|
62
|
+
http.use_ssl = @url.scheme == 'https'
|
63
|
+
http.open_timeout = @open_timeout if @open_timeout
|
64
|
+
http.read_timeout = @read_timeout if @read_timeout
|
65
|
+
http.verify_mode = @ssl_verify_mode if @url.scheme == 'https'
|
66
|
+
|
67
|
+
http
|
68
|
+
end
|
62
69
|
end
|
63
70
|
end
|
@@ -8,79 +8,6 @@ require 'thrift'
|
|
8
8
|
require 'debug_proto_test_types'
|
9
9
|
|
10
10
|
COMPACT_TEST = ::CompactProtoTestStruct.new({
|
11
|
-
%q"byte_boolean_map" => {
|
12
|
-
1 => true,
|
13
|
-
2 => false,
|
14
|
-
},
|
15
|
-
%q"list_byte_map" => {
|
16
|
-
[
|
17
|
-
1,
|
18
|
-
2,
|
19
|
-
3,
|
20
|
-
] => 1,
|
21
|
-
[
|
22
|
-
0,
|
23
|
-
1,
|
24
|
-
] => 2,
|
25
|
-
[
|
26
|
-
] => 0,
|
27
|
-
},
|
28
|
-
%q"set_byte_map" => {
|
29
|
-
Set.new([
|
30
|
-
1,
|
31
|
-
2,
|
32
|
-
3,
|
33
|
-
]) => 1,
|
34
|
-
Set.new([
|
35
|
-
0,
|
36
|
-
1,
|
37
|
-
]) => 2,
|
38
|
-
Set.new([
|
39
|
-
]) => 0,
|
40
|
-
},
|
41
|
-
%q"map_byte_map" => {
|
42
|
-
{
|
43
|
-
1 => 1,
|
44
|
-
} => 1,
|
45
|
-
{
|
46
|
-
2 => 2,
|
47
|
-
} => 2,
|
48
|
-
{
|
49
|
-
} => 0,
|
50
|
-
},
|
51
|
-
%q"byte_map_map" => {
|
52
|
-
0 => {
|
53
|
-
},
|
54
|
-
1 => {
|
55
|
-
1 => 1,
|
56
|
-
},
|
57
|
-
2 => {
|
58
|
-
1 => 1,
|
59
|
-
2 => 2,
|
60
|
-
},
|
61
|
-
},
|
62
|
-
%q"byte_set_map" => {
|
63
|
-
0 => Set.new([
|
64
|
-
]),
|
65
|
-
1 => Set.new([
|
66
|
-
1,
|
67
|
-
]),
|
68
|
-
2 => Set.new([
|
69
|
-
1,
|
70
|
-
2,
|
71
|
-
]),
|
72
|
-
},
|
73
|
-
%q"byte_list_map" => {
|
74
|
-
0 => [
|
75
|
-
],
|
76
|
-
1 => [
|
77
|
-
1,
|
78
|
-
],
|
79
|
-
2 => [
|
80
|
-
1,
|
81
|
-
2,
|
82
|
-
],
|
83
|
-
},
|
84
11
|
%q"a_byte" => 127,
|
85
12
|
%q"a_i16" => 32000,
|
86
13
|
%q"a_i32" => 1000000000,
|
@@ -254,6 +181,79 @@ COMPACT_TEST = ::CompactProtoTestStruct.new({
|
|
254
181
|
2 => %q"blah",
|
255
182
|
3 => %q"loooooooooooooong string",
|
256
183
|
},
|
184
|
+
%q"byte_boolean_map" => {
|
185
|
+
1 => true,
|
186
|
+
2 => false,
|
187
|
+
},
|
188
|
+
%q"list_byte_map" => {
|
189
|
+
[
|
190
|
+
1,
|
191
|
+
2,
|
192
|
+
3,
|
193
|
+
] => 1,
|
194
|
+
[
|
195
|
+
0,
|
196
|
+
1,
|
197
|
+
] => 2,
|
198
|
+
[
|
199
|
+
] => 0,
|
200
|
+
},
|
201
|
+
%q"set_byte_map" => {
|
202
|
+
Set.new([
|
203
|
+
1,
|
204
|
+
2,
|
205
|
+
3,
|
206
|
+
]) => 1,
|
207
|
+
Set.new([
|
208
|
+
0,
|
209
|
+
1,
|
210
|
+
]) => 2,
|
211
|
+
Set.new([
|
212
|
+
]) => 0,
|
213
|
+
},
|
214
|
+
%q"map_byte_map" => {
|
215
|
+
{
|
216
|
+
1 => 1,
|
217
|
+
} => 1,
|
218
|
+
{
|
219
|
+
2 => 2,
|
220
|
+
} => 2,
|
221
|
+
{
|
222
|
+
} => 0,
|
223
|
+
},
|
224
|
+
%q"byte_map_map" => {
|
225
|
+
0 => {
|
226
|
+
},
|
227
|
+
1 => {
|
228
|
+
1 => 1,
|
229
|
+
},
|
230
|
+
2 => {
|
231
|
+
1 => 1,
|
232
|
+
2 => 2,
|
233
|
+
},
|
234
|
+
},
|
235
|
+
%q"byte_set_map" => {
|
236
|
+
0 => Set.new([
|
237
|
+
]),
|
238
|
+
1 => Set.new([
|
239
|
+
1,
|
240
|
+
]),
|
241
|
+
2 => Set.new([
|
242
|
+
1,
|
243
|
+
2,
|
244
|
+
]),
|
245
|
+
},
|
246
|
+
%q"byte_list_map" => {
|
247
|
+
0 => [
|
248
|
+
],
|
249
|
+
1 => [
|
250
|
+
1,
|
251
|
+
],
|
252
|
+
2 => [
|
253
|
+
1,
|
254
|
+
2,
|
255
|
+
],
|
256
|
+
},
|
257
257
|
})
|
258
258
|
|
259
259
|
MYCONST = 2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upfluence-thrift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thrift Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|