Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
needs: ruby-verions
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJson(needs.ruby-verions.outputs.versions) }}
os: [ ubuntu-latest, macos-latest, windows-latest ]
Expand Down
10 changes: 10 additions & 0 deletions lib/net/protocol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ def ssl_socket_connect(s, timeout)
s.connect
end
end

tcp_socket_parameters = TCPSocket.instance_method(:initialize).parameters
TCP_SOCKET_NEW_HAS_OPEN_TIMEOUT = if tcp_socket_parameters != [[:rest]]
tcp_socket_parameters.include?([:key, :open_timeout])
else
# Use Socket.tcp to find out since there is no parameters information for TCPSocket#initialize
# See discussion in https://github.com/ruby/net-http/pull/224
Socket.method(:tcp).parameters.include?([:key, :open_timeout])
end
private_constant :TCP_SOCKET_NEW_HAS_OPEN_TIMEOUT
end


Expand Down