diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac8950a..1189830 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 ] diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index 1443f3e..8c81298 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -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