Skip to content
Merged
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
4 changes: 2 additions & 2 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ def use_ssl=(flag)
:verify_depth,
:verify_mode,
:verify_hostname,
] # :nodoc:
].freeze # :nodoc:

SSL_IVNAMES = SSL_ATTRIBUTES.map { |a| "@#{a}".to_sym }.freeze # :nodoc:

Expand Down Expand Up @@ -2428,7 +2428,7 @@ def send_entity(path, data, initheader, dest, type, &block)

# :stopdoc:

IDEMPOTENT_METHODS_ = %w/GET HEAD PUT DELETE OPTIONS TRACE/ # :nodoc:
IDEMPOTENT_METHODS_ = %w/GET HEAD PUT DELETE OPTIONS TRACE/.freeze # :nodoc:

def transport_request(req)
count = 0
Expand Down
25 changes: 25 additions & 0 deletions test/net/http/test_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1400,3 +1400,28 @@ def test_partial_response
assert_raise(EOFError) {http.get('/')}
end
end

class TestNetHTTPInRactor < Test::Unit::TestCase
CONFIG = {
'host' => '127.0.0.1',
'proxy_host' => nil,
'proxy_port' => nil,
}

include TestNetHTTPUtils

def test_get
assert_ractor(<<~RUBY, require: 'net/http')
expected = #{$test_net_http_data.dump}.b
ret = Ractor.new {
host = #{config('host').dump}
port = #{config('port')}
Net::HTTP.start(host, port) { |http|
res = http.get('/')
res.body
}
}.value
assert_equal expected, ret
RUBY
end
end if defined?(Ractor) && Ractor.method_defined?(:value)
18 changes: 18 additions & 0 deletions test/net/http/test_https.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,24 @@ def test_max_version
assert_match(re_msg, ex.message)
end

def test_ractor
assert_ractor(<<~RUBY, require: 'net/https')
expected = #{$test_net_http_data.dump}.b
ret = Ractor.new {
host = #{HOST.dump}
port = #{config('port')}
ca_cert_pem = #{CA_CERT.to_pem.dump}
cert_store = OpenSSL::X509::Store.new.tap { |s|
s.add_cert(OpenSSL::X509::Certificate.new(ca_cert_pem))
}
Net::HTTP.start(host, port, use_ssl: true, cert_store: cert_store) { |http|
res = http.get('/')
res.body
}
}.value
assert_equal expected, ret
RUBY
end if defined?(Ractor) && Ractor.method_defined?(:value)
end

class TestNetHTTPSIdentityVerifyFailure < Test::Unit::TestCase
Expand Down