Skip to content

Commit

Permalink
wip peeraddr raises error
Browse files Browse the repository at this point in the history
  • Loading branch information
hahmed committed Oct 6, 2019
1 parent 0bbb495 commit 1817773
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puma/reactor.rb
Expand Up @@ -237,7 +237,7 @@ def run_internal
ssl_socket = c.io
begin
addr = ssl_socket.peeraddr.last
rescue IOError
rescue IOError, Errno::EINVAL
addr = "<unknown>"
end

Expand Down
12 changes: 12 additions & 0 deletions test/test_puma_server_ssl.rb
Expand Up @@ -199,6 +199,18 @@ def test_tls_v1_1_rejection
assert_match(msg, @events.error.message) if @events.error
end
end

def test_peeraddr_raises
port = UniquePort.call

s = TCPServer.new("127.0.0.1", port)

def s.peeraddr
raise Errno::EINVAL
end

assert_raises { s.peeraddr }
end
end unless DISABLE_SSL

# client-side TLS authentication tests
Expand Down

0 comments on commit 1817773

Please sign in to comment.