bunny 1.5.0 → 1.5.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53c74a39ad4bc726f41f1c2db1f6ad7e7ebdefb8
|
4
|
+
data.tar.gz: 4ede7c5896c820ab5895963f1da741dda42e9fe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14e4fbe2d2aca163498882cb49ee7d6ec90756a7c0c6e419b5c73e3afc31673451e4b75a4f47f1c49e5525dd91b5b792d074fa7edef18aa18957a542896bb02c
|
7
|
+
data.tar.gz: d750d4af8cf6fd512a60422865b4e8df3e0dcd6c6f72eb95ed671bd73ba053e3fca8dea7d853517502de59f0f43e0b3e7531f13f7a23d622050e98aaea2b552f
|
data/lib/bunny/transport.rb
CHANGED
@@ -21,10 +21,8 @@ module Bunny
|
|
21
21
|
|
22
22
|
# Default TCP connection timeout
|
23
23
|
DEFAULT_CONNECTION_TIMEOUT = 5.0
|
24
|
-
|
25
|
-
|
26
|
-
DEFAULT_TLS_PROTOCOL = "SSLv3"
|
27
|
-
|
24
|
+
DEFAULT_READ_TIMEOUT = 5.0
|
25
|
+
DEFAULT_WRITE_TIMEOUT = 5.0
|
28
26
|
|
29
27
|
attr_reader :session, :host, :port, :socket, :connect_timeout, :read_write_timeout, :disconnect_timeout
|
30
28
|
attr_reader :tls_context
|
@@ -315,7 +313,7 @@ module Bunny
|
|
315
313
|
@tls_ca_certificates = opts.fetch(:tls_ca_certificates, default_tls_certificates)
|
316
314
|
@verify_peer = opts[:verify_ssl] || opts[:verify_peer]
|
317
315
|
|
318
|
-
@tls_context = initialize_tls_context(OpenSSL::SSL::SSLContext.new)
|
316
|
+
@tls_context = initialize_tls_context(OpenSSL::SSL::SSLContext.new, opts)
|
319
317
|
end
|
320
318
|
|
321
319
|
def wrap_in_tls_socket(socket)
|
@@ -349,7 +347,7 @@ module Bunny
|
|
349
347
|
end
|
350
348
|
end
|
351
349
|
|
352
|
-
def initialize_tls_context(ctx)
|
350
|
+
def initialize_tls_context(ctx, opts={})
|
353
351
|
ctx.cert = OpenSSL::X509::Certificate.new(@tls_certificate) if @tls_certificate
|
354
352
|
ctx.key = OpenSSL::PKey::RSA.new(@tls_key) if @tls_key
|
355
353
|
ctx.cert_store = if @tls_certificate_store
|
@@ -368,17 +366,15 @@ module Bunny
|
|
368
366
|
@logger.warn "Using TLS but no client private key is provided!"
|
369
367
|
end
|
370
368
|
|
371
|
-
# setting TLS/SSL version only works correctly when done
|
372
|
-
# vis set_params. MK.
|
373
|
-
ctx.set_params(:ssl_version => @opts.fetch(:tls_protocol, DEFAULT_TLS_PROTOCOL))
|
374
|
-
|
375
369
|
verify_mode = if @verify_peer
|
376
370
|
OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
377
371
|
else
|
378
372
|
OpenSSL::SSL::VERIFY_NONE
|
379
373
|
end
|
374
|
+
ctx.verify_mode = verify_mode
|
380
375
|
|
381
|
-
|
376
|
+
ssl_version = opts[:tls_protocol] || opts[:ssl_version]
|
377
|
+
ctx.ssl_version = ssl_version if ssl_version
|
382
378
|
|
383
379
|
ctx
|
384
380
|
end
|
data/lib/bunny/version.rb
CHANGED
@@ -124,4 +124,51 @@ unless ENV["CI"]
|
|
124
124
|
|
125
125
|
include_examples "successful TLS connection"
|
126
126
|
end
|
127
|
+
|
128
|
+
|
129
|
+
describe "TLS connection to RabbitMQ with ssl_version SSLv3 specified" do
|
130
|
+
let(:connection) do
|
131
|
+
c = Bunny.new(:user => "bunny_gem",
|
132
|
+
:password => "bunny_password",
|
133
|
+
:vhost => "bunny_testbed",
|
134
|
+
:tls => true,
|
135
|
+
:ssl_version => :SSLv3,
|
136
|
+
:tls_ca_certificates => ["./spec/tls/cacert.pem"])
|
137
|
+
c.start
|
138
|
+
c
|
139
|
+
end
|
140
|
+
|
141
|
+
after :each do
|
142
|
+
connection.close
|
143
|
+
end
|
144
|
+
|
145
|
+
include_examples "successful TLS connection"
|
146
|
+
|
147
|
+
it "connects using SSLv3" do
|
148
|
+
connection.transport.socket.ssl_version.should == "SSLv3"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe "TLS connection to RabbitMQ with tls_version TLSv1 specified" do
|
153
|
+
let(:connection) do
|
154
|
+
c = Bunny.new(:user => "bunny_gem",
|
155
|
+
:password => "bunny_password",
|
156
|
+
:vhost => "bunny_testbed",
|
157
|
+
:tls => true,
|
158
|
+
:tls_protocol => :TLSv1,
|
159
|
+
:tls_ca_certificates => ["./spec/tls/cacert.pem"])
|
160
|
+
c.start
|
161
|
+
c
|
162
|
+
end
|
163
|
+
|
164
|
+
after :each do
|
165
|
+
connection.close
|
166
|
+
end
|
167
|
+
|
168
|
+
include_examples "successful TLS connection"
|
169
|
+
|
170
|
+
it "connects using TLSv1" do
|
171
|
+
connection.transport.socket.ssl_version.should == "TLSv1"
|
172
|
+
end
|
173
|
+
end
|
127
174
|
end
|
@@ -1,15 +1,21 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "Rapidly opening and closing lots of channels" do
|
4
|
-
|
5
|
-
c
|
4
|
+
before :all do
|
5
|
+
@connection = Bunny.new(:automatic_recovery => false).tap do |c|
|
6
|
+
c.start
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
after :all do
|
11
|
+
@connection.close
|
6
12
|
end
|
7
13
|
|
8
14
|
context "in a single-threaded scenario" do
|
9
15
|
let(:n) { 500 }
|
10
16
|
|
11
17
|
it "works correctly" do
|
12
|
-
xs = Array.new(n) { connection.create_channel }
|
18
|
+
xs = Array.new(n) { @connection.create_channel }
|
13
19
|
puts "Opened #{n} channels"
|
14
20
|
|
15
21
|
xs.size.should == n
|
@@ -35,12 +41,12 @@ describe "Rapidly opening and closing lots of channels" do
|
|
35
41
|
|
36
42
|
n.times do
|
37
43
|
t = Thread.new do
|
38
|
-
ch1 = connection.create_channel
|
44
|
+
ch1 = @connection.create_channel
|
39
45
|
q = ch1.queue("", :exclusive => true)
|
40
46
|
q.delete
|
41
47
|
ch1.close
|
42
48
|
|
43
|
-
ch2 = connection.create_channel
|
49
|
+
ch2 = @connection.create_channel
|
44
50
|
ch2.close
|
45
51
|
end
|
46
52
|
t.abort_on_exception = true
|
@@ -62,7 +68,7 @@ describe "Rapidly opening and closing lots of channels" do
|
|
62
68
|
n.times do
|
63
69
|
t = Thread.new do
|
64
70
|
3.times do
|
65
|
-
ch = connection.create_channel
|
71
|
+
ch = @connection.create_channel
|
66
72
|
x = ch.topic('bunny.stress.topics.t2', :durable => false)
|
67
73
|
ch.close
|
68
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Duncan
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-10-
|
15
|
+
date: 2014-10-22 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: amq-protocol
|