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

undefined method `closed?' for nil:NilClass #44

Closed
buntine opened this issue Oct 4, 2010 · 3 comments
Closed

undefined method `closed?' for nil:NilClass #44

buntine opened this issue Oct 4, 2010 · 3 comments

Comments

@buntine
Copy link

buntine commented Oct 4, 2010

Upon attempting to login, I receive the following error from Garb. See my irb session:

  irb(main):001:0> require 'rubygems'
  => true
  irb(main):002:0> require 'garb'
  => true
  irb(main):003:0> Garb::Session.login("login", "pass")
  NoMethodError: undefined method `closed?' for nil:NilClass
  from /usr/lib/ruby/1.8/net/http.rb:1060:in `request'
  from /usr/lib/ruby/gems/1.8/gems/garb-0.8.0/lib/garb/authentication_request.rb:36:in `send_request'
  from /usr/lib/ruby/gems/1.8/gems/garb-0.8.0/lib/garb/authentication_request.rb:49:in `auth_token'
  from /usr/lib/ruby/gems/1.8/gems/garb-0.8.0/lib/garb/session.rb:10:in `login'
  from (irb):3
  from /usr/local/lib/site_ruby/1.8/rubygems/exceptions.rb:8

I am running Ruby 1.8.7 and have tried with ActiveSupport 3.0.0 and 2.3.8. My crack version is 0.1.8

EDIT: It seems this error is only happening when the user/pass is incorrect.

@tpitale
Copy link
Contributor

tpitale commented Oct 10, 2010

Which patch level of 1.8.7? I'm using 1.8.7-p299 and this is what I get:

tpitale@localhost@~> irb
ruby-1.8.7-p299 > require 'rubygems'
=> true
ruby-1.8.7-p299 > require 'garb'
=> true
ruby-1.8.7-p299 > Garb::Session.login('user', 'pass')
Garb::AuthenticationRequest::AuthError: Garb::AuthenticationRequest::AuthError
from /Users/tpitale/.rvm/gems/ruby-1.8.7-p299/gems/garb-0.8.1/lib/garb/authentication_request.rb:37:in send_request' from /Users/tpitale/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/net/http.rb:1054:inrequest'
from /Users/tpitale/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/net/http.rb:2144:in reading_body' from /Users/tpitale/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/net/http.rb:1053:inrequest'
from /Users/tpitale/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/net/http.rb:1037:in request' from /Users/tpitale/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/net/http.rb:543:instart'
from /Users/tpitale/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/net/http.rb:1035:in request' from /Users/tpitale/.rvm/gems/ruby-1.8.7-p299/gems/garb-0.8.1/lib/garb/authentication_request.rb:36:insend_request'
from /Users/tpitale/.rvm/gems/ruby-1.8.7-p299/gems/garb-0.8.1/lib/garb/authentication_request.rb:49:in auth_token' from /Users/tpitale/.rvm/gems/ruby-1.8.7-p299/gems/garb-0.8.1/lib/garb/session.rb:10:inlogin'
from (irb):3

@buntine
Copy link
Author

buntine commented Oct 10, 2010

Hey, this is on patch level 249. According to the Changelog, it looks like the problem may have been fixed in net/http on May 22nd, 2010.

For reference, in debug mode, it's clear that Garb is raising the correct exception, but Ruby is raising another. I'm not exactly sure what's going on here as I'd have thought the first exception would halt execution.

irb(main):002:0> Garb::Session.login("a", "s")
Exception `Garb::AuthenticationRequest::AuthError' at /var/lib/gems/1.8/gems/garb-0.8.0/lib/garb/authentication_request.rb:37 - Garb::AuthenticationRequest::AuthError
Exception `Garb::AuthenticationRequest::AuthError' at /usr/lib/ruby/1.8/net/http.rb:1061 - Garb::AuthenticationRequest::AuthError
Exception `NoMethodError' at /usr/lib/ruby/1.8/net/http.rb:1060 - undefined method `closed?' for nil:NilClass
Exception `NoMethodError' at /usr/lib/ruby/1.8/irb/workspace.rb:81 - undefined method `closed?' for nil:NilClass
NoMethodError: undefined method `closed?' for nil:NilClass
    from /usr/lib/ruby/1.8/net/http.rb:1060:in `request'
    from /var/lib/gems/1.8/gems/garb-0.8.0/lib/garb/authentication_request.rb:36:in `send_request'
    from /var/lib/gems/1.8/gems/garb-0.8.0/lib/garb/authentication_request.rb:49:in `auth_token'
    from /var/lib/gems/1.8/gems/garb-0.8.0/lib/garb/session.rb:10:in `login'
    from (irb):2

Thanks! :)

@nbibler
Copy link

nbibler commented Jan 25, 2011

If it helps, I just saw this same exception (undefined method closed?) raised from within ruby-1.8.7-p248, x86_64, using ActiveResource 3.0.3 with an empty application. Outside of garb. Just a straight ActiveResource::Base inherited class call.

This issue was closed.
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

3 participants