Skip to content

Net::HTTP returns empty response body for HTTPS requests in 2.0 mode #1216

@rykov

Description

@rykov

Gemfury customers are reporting problems using the service with jRuby in Ruby 2.0 mode. We've tracked it down to an odd issue where Net::HTTP returns a successful response, but response.body returns an empty string for https:// requests.

Here's a test program to reproduce:

require "net/https"

uri = URI.parse("https://rubygems.org/")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
puts "#{response.code} - #{response.body.size}"

And the output (tested in 1.7.5 and 1.7.6):

$ jruby -S ./test.rb
200 - 9188
$ jruby --2.0 -S ./test.rb 
200 - 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions