Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix peeraddr raises Errno::EINVAL inside reactor #2014

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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