Skip to content

Commit

Permalink
Fix network error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
comandeo-mongo committed Nov 18, 2024
1 parent 5e26ab4 commit fd95db4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/mongo/crypt/encryption_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,10 @@ def with_ssl_socket(endpoint, tls_options, timeout_ms: nil)
tls_options.merge(socket_options)
)
yield(mongo_socket.socket)
rescue EOFError => e
rescue Error::KmsError
raise
rescue StandardError => e
raise Error::KmsError.new("Error when connecting to KMS provider: #{e.class}: #{e.message}", network_error: true)
rescue => e
raise Error::KmsError.new("Error when connecting to KMS provider: #{e.class}: #{e.message}")
ensure
mongo_socket&.close
end
Expand Down
2 changes: 0 additions & 2 deletions lib/mongo/socket/ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,6 @@ def create_context(options)
context.options = context.options | OpenSSL::SSL::OP_NO_RENEGOTIATION
end

context.options |= OpenSSL::SSL::OP_IGNORE_UNEXPECTED_EOF

if context.respond_to?(:renegotiation_cb=)
# Disable renegotiation for older Ruby versions per the sample code at
# https://rubydocs.org/d/ruby-2-6-0/classes/OpenSSL/SSL/SSLContext.html
Expand Down

0 comments on commit fd95db4

Please sign in to comment.