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

Issue without openssl installed #206

Closed
epinault opened this issue Apr 23, 2013 · 1 comment
Closed

Issue without openssl installed #206

epinault opened this issue Apr 23, 2013 · 1 comment

Comments

@epinault
Copy link

Bundler goes to the wrong server if I install ruby without openssl. Currently with Ruby 1.9.3-p392 and 1.9.3-p362, and bundler 1.3.x,

If I do the following

bundle install --path vendor --verbose
Fetching from: http://rubygems.org/api/v1/dependencies
HTTP Success
Fetching source index from http://rubygems.org/
Fetching from: http://rubygems.org/quick/Marshal.4.8/actionmailer-3.2.11.gemspec.rz
HTTP Redirection
Fetching from: http://production.cf.rubygems.org/quick/Marshal.4.8/actionmailer-3.2.11.gemspec.rz
HTTP Redirection
Fetching from: http://production.cf.rubygems.org/quick/Marshal.4.8/actionmailer-3.2.11.gemspec.rz
HTTP Redirection
Fetching from: http://production.cf.rubygems.org/quick/Marshal.4.8/actionmailer-3.2.11.gemspec.rz
HTTP Redirection
Fetching from: http://production.cf.rubygems.org/quick/Marshal.4.8/actionmailer-3.2.11.gemspec.rz

Notice the infinite loop to the 2nd url...

What is wrong is the code when looking at it closely. The way it is coded is roughly equivalent to the following code

require "net/http"

host = "rubygems.org"
port = "80"
connection = Net::HTTP.new(host, port)

request_uri = "/quick/Marshal.4.8/actionmailer-3.2.11.gemspec.rz"
req = Net::HTTP::Get.new request_uri
puts req.inspect
puts connection.inspect
response = connection.request(req)

puts response.inspect

request_uri = "http://production.cf.rubygems.org/quick/Marshal.4.8/actionmailer-3.2.11.gemspec.rz"
req = Net::HTTP::Get.new request_uri
puts req.inspect
puts connection.inspect
response = connection.request(req)

puts response.inspect

You cannot pass a request object the 2nd time as the host is not being reset correctly. Hence then infinite loop as it talks to the first host with same path over and over...

Checkin the fetch method in lib/bundler/fetcher.rb, and in the else, it needs to propage the host and port from the new URI or reset to a new connection object. See the bold line.. I will try to submit a patch later

def fetch(uri, counter = 0)
      raise HTTPError, "Too many redirects" if counter >= REDIRECT_LIMIT

      begin
        Bundler.ui.debug "Fetching from: #{uri}"
        puts defined?(Net::HTTP::Persistent)

        if defined?(Net::HTTP::Persistent)
          response = @connection.request(uri)
        else
         ***@connection = Net::HTTP.new(uri.host, uri.port)***

          req = Net::HTTP::Get.new uri.request_uri
          @connection.host = uri.host
          response = @connection.request(req)
        end
      rescue OpenSSL::SSL::SSLError
@epinault
Copy link
Author

epinault commented Feb 4, 2023

closing as not needing it anymore .I don t use ruby anymore

@epinault epinault closed this as completed Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant