mongo 2.8.0.rc0 → 2.8.0

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: 5c0c1dd6dd1ce8ec0ce98e4f038bb188a743d65b0fd45f42383e732b8a9fe6e0
4
- data.tar.gz: 69a9fcd5c2284e95b7af207ae381bc5fb4b9a0d00d941b54bb7d86a126a62e70
3
+ metadata.gz: 9696938332fb0fee42821edacd510e1a83217adf91e8418655d54da3c14edbc3
4
+ data.tar.gz: 12bd18e5b2f36f28f8efca9d5cd03851f0ca593a3bc0e72f57404479bd837e34
5
5
  SHA512:
6
- metadata.gz: eb0c350dc452f0eb60656e0a2e6657e0002a7760de5bb3af7820af77876046f48bd7946e8d7d39a727dd80eda43e48656db52b941c2ab45ea6096ba826049a4d
7
- data.tar.gz: d13ac4eec40c58e932f61fe5cb3f52259ca77a8ed08f079edf910927b9bb5e0c0ec77e0461374ab6c0f783726b1a5c7972e12c63c8a6d2eb46a6170a80543538
6
+ metadata.gz: bf455a48c0b6def9c3e509660b3eacfe8a5cba5578cfd181f621edbaeef497fbd04da6706e80edcf5a879aedd54fdc95fa3f94e2a4d3f64e311291a53cd0c5b5
7
+ data.tar.gz: 290186d4c7f26812685b26543a392dc5fe82847c8f2071746ba1d1d83af44c9a6ecedc69ebd41df09f96d7950844c41f44cdd1b02c5f1cc870a84b0416479684
checksums.yaml.gz.sig CHANGED
@@ -1 +1,3 @@
1
- �aJc&�$�ϻi#+�r��~��ga��d��l�����C��8i�J�Z+� �� !{X3 'R��n(��Jg�}n&����.��
1
+ ����(F�����d� :�������ͯ�Z����� �eZ�)7~��g�̍wc�o���0|_�JS���_�!��7t��_�z���d��>�U�s�xY�>
2
+ ?> � �� ��g��᱋�Re
3
+ v��^#߿+�6��I��D��6��+�t�(�E�Klԃ�[YA�ɲ���*Q�����큒�݃"����$��������le+y��t3�*�-�L���H�_i'�ʡ�Լ���K�ٝ�rc�
data.tar.gz.sig CHANGED
Binary file
@@ -196,7 +196,7 @@ module Mongo
196
196
  @features = Features.new(wire_versions, me || @address.to_s)
197
197
  end
198
198
  @average_round_trip_time = average_round_trip_time
199
- @last_update_time = Time.now.freeze
199
+ @last_update_time = Time.now.dup.freeze
200
200
 
201
201
  if Mongo::Lint.enabled?
202
202
  # prepopulate cache instance variables
data/lib/mongo/session.rb CHANGED
@@ -812,6 +812,7 @@ module Mongo
812
812
  if e.label?(Mongo::Error::UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL)
813
813
  # WriteConcernFailed
814
814
  if e.is_a?(Mongo::Error::OperationFailure) && e.code == 64 && e.wtimeout?
815
+ transaction_in_progress = false
815
816
  raise
816
817
  end
817
818
  if Time.now >= deadline
data/lib/mongo/uri.rb CHANGED
@@ -155,7 +155,7 @@ module Mongo
155
155
  # @since 2.1.0
156
156
  UNESCAPED_UNIX_SOCKET = "UNIX domain sockets must be urlencoded.".freeze
157
157
 
158
- # Error details for a non-urlencoded auth databsae name.
158
+ # Error details for a non-urlencoded auth database name.
159
159
  #
160
160
  # @since 2.1.0
161
161
  UNESCAPED_DATABASE = "Auth database must be urlencoded.".freeze
@@ -201,8 +201,13 @@ module Mongo
201
201
 
202
202
  # Options that are allowed to appear more than once in the uri.
203
203
  #
204
+ # In order to follow the URI options spec requirement that all instances of 'tls' and 'ssl' have
205
+ # the same value, we need to keep track of all of the values passed in for those options.
206
+ # Assuming they don't conflict, they will be condensed to a single value immediately after
207
+ # parsing the URI.
208
+ #
204
209
  # @since 2.1.0
205
- REPEATABLE_OPTIONS = [ :tag_sets ]
210
+ REPEATABLE_OPTIONS = [ :tag_sets, :ssl ]
206
211
 
207
212
  # Get either a URI object or a SRVProtocol URI object.
208
213
  #
@@ -257,16 +262,25 @@ module Mongo
257
262
  raise_invalid_error!(INVALID_SCHEME) unless parsed_scheme == scheme
258
263
  parse!(remaining)
259
264
 
260
- # Warn if conflicting insecure TLS options are provided.
261
- if @uri_options[:ssl_verify] == false
262
- if @uri_options[:ssl_verify_certificate]
263
- log_warn("tlsInsecure is set to disable verification, but tlsAllowInvalidCertificates " +
264
- "is set to enable it; tlsAllowInvalidCertificates takes precedence")
265
+ # The URI options spec requires that we raise an error if there are conflicting values of
266
+ # 'tls' and 'ssl'. In order to fulfill this, we parse the values of each instance into an
267
+ # array; assuming all values in the array are the same, we replace the array with that value.
268
+ unless @uri_options[:ssl].nil? || @uri_options[:ssl].empty?
269
+ unless @uri_options[:ssl].uniq.length == 1
270
+ raise_invalid_error_no_fmt!("all instances of 'tls' and 'ssl' must have the same value")
271
+ end
272
+
273
+ @uri_options[:ssl] = @uri_options[:ssl].first
274
+ end
275
+
276
+ # Check for conflicting TLS insecure options.
277
+ unless @uri_options[:ssl_verify].nil?
278
+ unless @uri_options[:ssl_verify_certificate].nil?
279
+ raise_invalid_error_no_fmt!("'tlsInsecure' and 'tlsAllowInvalidCertificates' cannot both be specified")
265
280
  end
266
281
 
267
- if @uri_options[:ssl_verify_hostname]
268
- log_warn("tlsInsecure is set to disable verification, but tlsAllowInvalidHostnames is " +
269
- "set to enable it; tlsAllowInvalidHostnames takes precedence")
282
+ unless @uri_options[:ssl_verify_hostname].nil?
283
+ raise_invalid_error_no_fmt!("tlsInsecure' and 'tlsAllowInvalidHostnames' cannot both be specified")
270
284
  end
271
285
  end
272
286
  end
@@ -413,6 +427,10 @@ module Mongo
413
427
  raise Error::InvalidURI.new(@string, details, FORMAT)
414
428
  end
415
429
 
430
+ def raise_invalid_error_no_fmt!(details)
431
+ raise Error::InvalidURI.new(@string, details)
432
+ end
433
+
416
434
  def decode(value)
417
435
  ::URI.decode(value)
418
436
  end
@@ -463,8 +481,8 @@ module Mongo
463
481
  uri_option 'waitqueuetimeoutms', :wait_queue_timeout, :type => :wait_queue_timeout
464
482
 
465
483
  # Security Options
466
- uri_option 'ssl', :ssl
467
- uri_option 'tls', :ssl
484
+ uri_option 'ssl', :ssl, :type => :ssl
485
+ uri_option 'tls', :ssl, :type => :tls
468
486
  uri_option 'tlsallowinvalidcertificates', :ssl_verify_certificate,
469
487
  :type => :ssl_verify_certificate
470
488
  uri_option 'tlsallowinvalidhostnames', :ssl_verify_hostname,
@@ -703,6 +721,26 @@ module Mongo
703
721
  bool('journal', value)
704
722
  end
705
723
 
724
+ # Parses the ssl value from the URI.
725
+ #
726
+ # @param value [ String ] The ssl value.
727
+ #
728
+ # @return [ Array<true | false> ] The ssl value parsed out (stored in an array to facilitate
729
+ # keeping track of all values).
730
+ def ssl(value)
731
+ [bool('ssl', value)]
732
+ end
733
+
734
+ # Parses the tls value from the URI.
735
+ #
736
+ # @param value [ String ] The tls value.
737
+ #
738
+ # @return [ Array<true | false> ] The tls value parsed out (stored in an array to facilitate
739
+ # keeping track of all values).
740
+ def tls(value)
741
+ [bool('tls', value)]
742
+ end
743
+
706
744
  # Parses the ssl_verify value from the tlsInsecure URI value. Note that this will be the inverse
707
745
  # of the value of tlsInsecure (if present).
708
746
  #
data/lib/mongo/version.rb CHANGED
@@ -17,5 +17,5 @@ module Mongo
17
17
  # The current version of the driver.
18
18
  #
19
19
  # @since 2.0.0
20
- VERSION = '2.8.0.rc0'.freeze
20
+ VERSION = '2.8.0'.freeze
21
21
  end
@@ -49,6 +49,20 @@ describe Mongo::Server::Description do
49
49
  end
50
50
  end
51
51
 
52
+ describe '#initialize' do
53
+ context 'when Time.now is mocked' do
54
+ it 'does not freeze mocked time' do
55
+ obj = Time.now
56
+ expect(Time).to receive(:now).at_least(:once).and_return(obj)
57
+ expect(obj.frozen?).to be false
58
+
59
+ description = described_class.new(address)
60
+ expect(description.last_update_time).to eq(obj)
61
+ expect(obj.frozen?).to be false
62
+ end
63
+ end
64
+ end
65
+
52
66
  describe '#arbiters' do
53
67
 
54
68
  context 'when the replica set has arbiters' do
@@ -71,19 +71,67 @@ tests:
71
71
  auth: ~
72
72
  options: {}
73
73
  -
74
- description: "tlsInsecure=true and tlsAllowInvalidCertificates=false warns"
75
- uri: "mongodb://example.com/?tlsInsecure=true&tlsAllowInvalidCertificates=false"
74
+ description: "tlsInsecure and tlsAllowInvalidCertificates both present (and true) raises an error"
75
+ uri: "mongodb://example.com/?tlsInsecure=true&tlsAllowInvalidCertificates=true"
76
+ valid: false
77
+ warning: false
78
+ hosts: ~
79
+ auth: ~
80
+ options: {}
81
+ -
82
+ description: "tlsInsecure and tlsAllowInvalidCertificates both present (and false) raises an error"
83
+ uri: "mongodb://example.com/?tlsInsecure=false&tlsAllowInvalidCertificates=false"
84
+ valid: false
85
+ warning: false
86
+ hosts: ~
87
+ auth: ~
88
+ options: {}
89
+ -
90
+ description: "tlsInsecure and tlsAllowInvalidHostnames both present (and true) raises an error"
91
+ uri: "mongodb://example.com/?tlsInsecure=true&tlsAllowInvalidHostnames=true"
92
+ valid: false
93
+ warning: false
94
+ hosts: ~
95
+ auth: ~
96
+ options: {}
97
+ -
98
+ description: "tlsInsecure and tlsAllowInvalidHostnames both present (and false) raises an error"
99
+ uri: "mongodb://example.com/?tlsInsecure=false&tlsAllowInvalidHostnames=false"
100
+ valid: false
101
+ warning: false
102
+ hosts: ~
103
+ auth: ~
104
+ options: {}
105
+ -
106
+ description: "tls=true and ssl=true doesn't warn"
107
+ uri: "mongodb://example.com/?tls=true&ssl=true"
76
108
  valid: true
77
- warning: true
109
+ warning: false
78
110
  hosts: ~
79
111
  auth: ~
80
112
  options: {}
81
113
  -
82
- description: "tlsInsecure=true and tlsAllowInvalidHostnames=false warns"
83
- uri: "mongodb://example.com/?tlsInsecure=true&tlsAllowInvalidHostnames=false"
114
+ description: "tls=false and ssl=false doesn't warn"
115
+ uri: "mongodb://example.com/?tls=false&ssl=false"
84
116
  valid: true
85
- warning: true
117
+ warning: false
118
+ hosts: ~
119
+ auth: ~
120
+ options: {}
121
+ -
122
+ description: "tls=false and ssl=true raises error"
123
+ uri: "mongodb://example.com/?tls=false&ssl=true"
124
+ valid: false
125
+ warning: false
126
+ hosts: ~
127
+ auth: ~
128
+ options: {}
129
+ -
130
+ description: "tls=true and ssl=false raises error"
131
+ uri: "mongodb://example.com/?tls=true&ssl=false"
132
+ valid: false
133
+ warning: false
86
134
  hosts: ~
87
135
  auth: ~
88
136
  options: {}
89
-
137
+
@@ -40,7 +40,7 @@ describe 'Uri Options' do
40
40
  end
41
41
  end
42
42
 
43
- context 'when the uri should not warn', if: !test.warn? do
43
+ context 'when the uri should not warn', if: !test.warn? && test.valid? do
44
44
 
45
45
  before do
46
46
  expect(Mongo::Logger.logger).not_to receive(:warn)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0.rc0
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -31,7 +31,7 @@ cert_chain:
31
31
  bMYVwXXhV8czdzgkQB/ZPWHSbEWXnmkze1mzvqWBCPOVXYrcnL9cnEl/RoxtS1hr
32
32
  Db6Ac6mCUSYfYHBWpWqxjc45n70i5Xi1
33
33
  -----END CERTIFICATE-----
34
- date: 2019-02-27 00:00:00.000000000 Z
34
+ date: 2019-03-21 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bson
@@ -971,9 +971,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
971
971
  version: '0'
972
972
  required_rubygems_version: !ruby/object:Gem::Requirement
973
973
  requirements:
974
- - - ">"
974
+ - - ">="
975
975
  - !ruby/object:Gem::Version
976
- version: 1.3.1
976
+ version: '0'
977
977
  requirements: []
978
978
  rubygems_version: 3.0.1
979
979
  signing_key:
metadata.gz.sig CHANGED
Binary file