protobuf 3.10.5 → 3.10.6

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: 3e3465827a6baf50d8cb30a689bd13858d7423390f2cb0405929e494578bac2a
4
- data.tar.gz: 88b6210d9bbe3323a8b7f81e3c3d6f5d3c6cb404637a31fe04ff57a6bb2a4c2e
3
+ metadata.gz: 4ea13b6353fc56a116dc91e87662ffaaac8c4b8cb27dd85be480797e7ef922d2
4
+ data.tar.gz: 6f5804860b80527356f1a6cec79def05499abd4a5536038c453e7e65cd05c237
5
5
  SHA512:
6
- metadata.gz: 2d84ed2d0d670143cf9d59e664a7ad3e50ad8e0f1293594f5784f249e63b81e5d9ebfe55d1defbc8b1c058333b6faba72e217929dec752dedf87a58758310941
7
- data.tar.gz: 5119bb0a3370b04323883962b6f8bd56c9c319a95155e83793bbc69d7879b1a75923e2e4c3164593adddd0aaceda7e18031a07b9badc0562ded3b698a1f4d481
6
+ metadata.gz: a49491b32df80049107f59673008d6f8ac64977abcae332ad407c120f9f9628f4c3b47dbd5f809b8843ce477e02286da3fc1242131a8919ddac7170e2002bbf4
7
+ data.tar.gz: b5352584a6c79b77ce1360fb0ce6a03c00a165cdfb8f92b96aaf61d37a3acf7a89f7bd4bd2fc8a3f1c879434b941db3e0689040edf5988cee2c05cb5bfd0a3a5
data/.circleci/config.yml CHANGED
@@ -42,7 +42,5 @@ workflows:
42
42
  ruby-image:
43
43
  - circleci/jruby:9.2.6.0-jdk
44
44
  - circleci/jruby:9.1.17.0-jdk
45
- - circleci/jruby:9.2-jdk8
46
- - circleci/ruby:2.4
47
45
  - circleci/ruby:2.5
48
46
  - circleci/ruby:2.7
@@ -13,12 +13,12 @@ module Protobuf
13
13
  super message
14
14
  end
15
15
 
16
- def encode
17
- to_response.encode
16
+ def encode(args = {})
17
+ to_response(args).encode
18
18
  end
19
19
 
20
- def to_response
21
- ::Protobuf::Socketrpc::Response.new(:error => message, :error_reason => error_type)
20
+ def to_response(args = {})
21
+ ::Protobuf::Socketrpc::Response.new({ :error => message, :error_reason => error_type }.merge(args))
22
22
  end
23
23
  end
24
24
  end
@@ -22,7 +22,7 @@ module Protobuf
22
22
  # Rescue exceptions, re-wrap them as generic Protobuf errors,
23
23
  # and encode them
24
24
  env.response = wrap_exception(exception)
25
- env.encoded_response = env.response.encode
25
+ env.encoded_response = wrap_and_encode_with_server(env.response, env)
26
26
  env
27
27
  end
28
28
 
@@ -34,6 +34,17 @@ module Protobuf
34
34
  exception = RpcFailed.new(exception.message) unless exception.is_a?(PbError)
35
35
  exception
36
36
  end
37
+
38
+ # If the response is a PbError, it won't have the server merged into the response proto.
39
+ # We should add it here since exception handler is always at the bottom of the middleware
40
+ # stack. Without this, the server hostname in the client rpc log will not be set.
41
+ def wrap_and_encode_with_server(response, env)
42
+ if response.is_a?(PbError)
43
+ response.encode(:server => env.server)
44
+ else
45
+ response.encode
46
+ end
47
+ end
37
48
  end
38
49
  end
39
50
  end
@@ -1,3 +1,3 @@
1
1
  module Protobuf
2
- VERSION = '3.10.5' # rubocop:disable Style/MutableConstant
2
+ VERSION = '3.10.6' # rubocop:disable Style/MutableConstant
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe Protobuf::Rpc::Middleware::ExceptionHandler do
4
4
  let(:app) { proc { |env| env } }
5
- let(:env) { Protobuf::Rpc::Env.new }
5
+ let(:env) { Protobuf::Rpc::Env.new("server" => "cooldude") }
6
6
 
7
7
  subject { described_class.new(app) }
8
8
 
@@ -17,7 +17,7 @@ RSpec.describe Protobuf::Rpc::Middleware::ExceptionHandler do
17
17
  end
18
18
 
19
19
  context "when exceptions occur" do
20
- let(:encoded_error) { error.encode }
20
+ let(:encoded_error) { error.encode(:server => "cooldude") }
21
21
  let(:error) { Protobuf::Rpc::MethodNotFound.new('Boom!') }
22
22
 
23
23
  before { allow(app).to receive(:call).and_raise(error, 'Boom!') }
@@ -42,7 +42,7 @@ RSpec.describe Protobuf::Rpc::Middleware::ExceptionHandler do
42
42
  end
43
43
 
44
44
  context "when exception is not a Protobuf error" do
45
- let(:encoded_error) { error.encode }
45
+ let(:encoded_error) { error.encode(:server => "cooldude") }
46
46
  let(:error) { Protobuf::Rpc::RpcFailed.new('Boom!') }
47
47
 
48
48
  before { allow(app).to receive(:call).and_raise(RuntimeError, 'Boom!') }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'timecop'
3
- require 'active_support/core_ext/numeric/time'
3
+ require 'active_support/all'
4
4
 
5
5
  RSpec.describe ::Protobuf::Rpc::Stat do
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.5
4
+ version: 3.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - BJ Neilsen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-09-13 00:00:00.000000000 Z
14
+ date: 2022-04-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -486,7 +486,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
486
486
  - !ruby/object:Gem::Version
487
487
  version: '0'
488
488
  requirements: []
489
- rubygems_version: 3.2.27
489
+ rubygems_version: 3.2.28
490
490
  signing_key:
491
491
  specification_version: 4
492
492
  summary: Google Protocol Buffers serialization and RPC implementation for Ruby.