gem update --system (undefined method `downcase' for nil:NilClass) #322

Closed
spastorino opened this Issue May 4, 2012 · 6 comments

Comments

Projects
None yet
4 participants
@spastorino

I'm getting this issue running on an "unreal" internet connection :P.
Basically you can't update rubygems if you're in the Westfield mall in San Francisco :P.

➜  ~  gem update --system --backtrace                                                              
ERROR:  While executing gem ... (NoMethodError)
    undefined method `downcase' for nil:NilClass
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:514:in `https?'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:216:in `fetch_http'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:220:in `fetch_http'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:220:in `fetch_http'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:220:in `fetch_http'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:238:in `fetch_path'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:260:in `load_specs'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:231:in `block in list'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:227:in `each'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:227:in `list'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:150:in `find_matching_with_errors'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:177:in `find_matching'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/commands/update_command.rb:210:in `block in which_to_update'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/commands/update_command.rb:203:in `each'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/commands/update_command.rb:203:in `which_to_update'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/commands/update_command.rb:158:in `update_rubygems'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/commands/update_command.rb:61:in `execute'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/command.rb:278:in `invoke'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:147:in `process_args'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:117:in `run'
    /Users/santiago/.rbenv/versions/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:65:in `run'
    /Users/santiago/.rbenv/versions/1.9.3/bin/gem:30:in `<main>'
➜  ~  gem update --system -V         
GET http://rubygems.org/latest_specs.4.8.gz
307 Temporary Redirect
GET https://n17.meraki.com/splash/?mac=00%3A18%3A0A%3A30%3A10%3A54&client_ip=10.66.221.69&client_mac=70:56:81:8D:18:FB&vap=0&a=1b04f217730b9e677ec7021775bb6c2c8f8ca543&b=95521&auth_version=4&key=0722fff2443022216c3ab89401b29556b3a7417c&node_ip=6.48.16.84&continue_url=http%3A%2F%2Frubygems.org%2Flatest_specs.4.8.gz
302 Found
GET https://www.boingohotspot.net/Redirect.aspx?isinit=1&apName=WFM-SFC&login_url=https%3A%2F%2Fn17.meraki.com%2Fsplash%2Flogin%3Fmauth%3DMM3QdBpDNJxejHok5_jVg6A2_-IyZkA5Pm6m2s8kY2NUeakTs1CJPxnJnJTae0wCD4LpCPAlSPjQIQeF5g9XtGaTtLSPB_ES4WjtuQWrNdRBhQw-KuqaN-GUfoP1p1v--Gfq6-crOQFC1twa2WYB1XwxO986GRNrZMC_zUM4vF1kAb1a7qoH1rWw%26continue_url%3Dhttp%253A%252F%252Frubygems.org%252Flatest_specs.4.8.gz&continue_url=http%3A%2F%2Frubygems.org%2Flatest_specs.4.8.gz&ap_mac=00%3A18%3A0a%3A30%3A10%3A54&ap_name=C.10+-+Emporium+%231B&ap_tags=good+nintendo&client_mac=70%3A56%3A81%3A8d%3A18%3Afb
302 Found
GET https://www.boingohotspot.net/PreRoll.aspx
302 Found
ERROR:  While executing gem ... (NoMethodError)
    undefined method `downcase' for nil:NilClass
@luislavena

This comment has been minimized.

Show comment Hide comment
@luislavena

luislavena May 4, 2012

Member

Hmn @spastorino looks like you're behind a transparent proxy like the ones in the hotel rooms that you need to login every time you connect to the internetz

Can you confirm that accessing from the browser to rubygems.org works?

Member

luislavena commented May 4, 2012

Hmn @spastorino looks like you're behind a transparent proxy like the ones in the hotel rooms that you need to login every time you connect to the internetz

Can you confirm that accessing from the browser to rubygems.org works?

@drbrain

This comment has been minimized.

Show comment Hide comment
@drbrain

drbrain May 4, 2012

Member

@luislavena yeah, he is, but we could at least not crash on the HTTP -> HTTPS switch

We could probably also have some friendly way to say "can't find a gem repository, check your proxy?"

Member

drbrain commented May 4, 2012

@luislavena yeah, he is, but we could at least not crash on the HTTP -> HTTPS switch

We could probably also have some friendly way to say "can't find a gem repository, check your proxy?"

@spastorino

This comment has been minimized.

Show comment Hide comment
@spastorino

spastorino May 4, 2012

@luislavena yeah I am and accessing rubygems.org works. I'm leaving this mall so I won't be able to test that again :).
But come on, rubygems is not hotel / mall compatible :P.

@luislavena yeah I am and accessing rubygems.org works. I'm leaving this mall so I won't be able to test that again :).
But come on, rubygems is not hotel / mall compatible :P.

@luislavena

This comment has been minimized.

Show comment Hide comment
@luislavena

luislavena May 4, 2012

Member

@spastorino :trollface:

Somehow I missed the lines were you said you're at the mall.

But getting more serious, @drbrain, after the GET https://www.boingohotspot.net/PreRoll.aspx it gets a 302 Found, but no location?

So makes location be nil?

      location = URI.parse response['Location']

      if https?(uri) && !https?(location)
        raise FetchError.new("redirecting to non-https resource: #{location}", uri)
      end
irb(main):001:0> require "uri"
=> true
irb(main):002:0> location = URI.parse ""
=> #<URI::Generic:0x297eb50 URL:>
irb(main):003:0> location.scheme.downcase
NoMethodError: undefined method `downcase' for nil:NilClass
        from (irb):3
Member

luislavena commented May 4, 2012

@spastorino :trollface:

Somehow I missed the lines were you said you're at the mall.

But getting more serious, @drbrain, after the GET https://www.boingohotspot.net/PreRoll.aspx it gets a 302 Found, but no location?

So makes location be nil?

      location = URI.parse response['Location']

      if https?(uri) && !https?(location)
        raise FetchError.new("redirecting to non-https resource: #{location}", uri)
      end
irb(main):001:0> require "uri"
=> true
irb(main):002:0> location = URI.parse ""
=> #<URI::Generic:0x297eb50 URL:>
irb(main):003:0> location.scheme.downcase
NoMethodError: undefined method `downcase' for nil:NilClass
        from (irb):3
@spastorino

This comment has been minimized.

Show comment Hide comment
@spastorino

spastorino May 4, 2012

What about making https?(uri) return false on those weird cases ...

  def https?(uri)
    (scheme = uri.scheme) && scheme.downcase == 'https'
  end

or

  def https?(uri)
    uri.scheme.to_s.downcase == 'https'
  end

What about making https?(uri) return false on those weird cases ...

  def https?(uri)
    (scheme = uri.scheme) && scheme.downcase == 'https'
  end

or

  def https?(uri)
    uri.scheme.to_s.downcase == 'https'
  end

@drbrain drbrain closed this in 850ab87 Nov 27, 2012

@aguynamedben

This comment has been minimized.

Show comment Hide comment
@aguynamedben

aguynamedben Mar 9, 2016

FYI in case it helps a future internet-searcher... I saw a similar issue while developing on rubygems.org locally...

This failed:

gem push hola-0.0.1.gem --host localhost:3000 --backtrace

This worked:

gem push hola-0.0.1.gem --host "http://localhost:3000" --backtrace

FYI in case it helps a future internet-searcher... I saw a similar issue while developing on rubygems.org locally...

This failed:

gem push hola-0.0.1.gem --host localhost:3000 --backtrace

This worked:

gem push hola-0.0.1.gem --host "http://localhost:3000" --backtrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment