Skip to content

Commit

Permalink
fix: Redirects from the RDAP server were causing an SSL EOF error
Browse files Browse the repository at this point in the history
The root of the issue appears to be a change made in later versions of
OpenSSL that raises a `SSL_read: unexpected eof while reading` if the
server sends an `EOF` before sending `close notify`

see openssl/openssl#11378

It seems that `Net::HTTP` can handle this situation when the session is
manually started (`http.start`) but not when it is auto started as soon
as the request is made. This may be a bug in `Net::HTTP``, and something
I'd like to investigate further given time, but for now manually
starting session fixes the issue
  • Loading branch information
mattbearman committed Jun 27, 2024
1 parent dd6c35e commit 0943545
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ip_contact_finder/rdap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def request(uri, redirect_count: 0)

@logger&.info "Making request to #{uri}"

http.start
response = http.request(request)
@logger&.info "Got response #{response.code}"

Expand All @@ -74,6 +75,8 @@ def request(uri, redirect_count: 0)
rescue SocketError, Errno::ECONNRESET, EOFError, Errno::EINVAL, Errno::ENETUNREACH, Errno::EHOSTUNREACH,
Errno::ECONNREFUSED, OpenSSL::SSL::SSLError, Timeout::Error => e
raise RequestError, "#{e.message} (#{e.class})"
ensure
http.finish
end
end
end

0 comments on commit 0943545

Please sign in to comment.