# Thread error "undefined method \`keys' for nil:NilClass"

**URL:** <https://www.ruby-forum.com/t/thread-error-undefined-method-keys-for-nil-nilclass/178136>\
**Category:** Ruby\
**Created:** [October 29, 2009, 5:21pm UTC](https://www.ruby-forum.com/t/thread-error-undefined-method-keys-for-nil-nilclass/178136 "2009-10-29T17:21:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![acemutha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c77e96/32.png) [@acemutha](https://www.ruby-forum.com/u/acemutha)\
**Post date:** [October 29, 2009, 5:21pm UTC](https://www.ruby-forum.com/t/thread-error-undefined-method-keys-for-nil-nilclass/178136/1 "2009-10-29T17:21:31Z")

</div>

Hi all I have this prog taken from a book.

require ‘net/http’

pages = [“[www.rubycentral.com](http://www.rubycentral.com)”, “[www.awl.com](http://www.awl.com)”, “[www.davidecasale.com](http://www.davidecasale.com)”]

threads = []

pages.each do |page|  
threads \<\< Thread.new(page) { |myPage|

```
h = Net::HTTP.new(myPage, 80)
puts "Fetching: #{myPage}"
resp, data = h.get('/', nil )
puts "Got #{myPage}: #{resp.message}"

```

}  
end

but when i run it It gives me this error.

/usr/local/lib/ruby/1.9.1/net/http.rb:809:in `get': undefined method `keys’ for nil:NilClass (NoMethodError) from Threads.rb:19:in `block (2  
levels) in ’

It’s weird because it’s working on ruby 1.8.7
