bug on resolv.rb? or I'm just a newbe?

R

Rodrigo Urubatan

I can't get the point in this problem ...
this code works fine ...
require 'resolv'
r = Resolv::DNS.new
puts r.getaddress("www.google.com")
r.each_resource("urubatan.com.br", Resolv::DNS::Resource::IN::A) { |mx|
puts mx
}

but if I change to this
require 'resolv'
r = Resolv::DNS.new
puts r.getaddress("www.google.com")
r.each_resource("urubatan.com.br", Resolv::DNS::Resource::CNAME) { |mx|
puts mx
}

ot this (that is what I want to do)
require 'resolv'
r = Resolv::DNS.new
puts r.getaddress("www.google.com")
r.each_resource("urubatan.com.br", Resolv::DNS::Resource::MX) { |mx|
puts mx
}


I get this error:
/usr/lib/ruby/1.8/resolv.rb:1171:in `pack': can't convert nil into
Integer (TypeError)
from /usr/lib/ruby/1.8/resolv.rb:1171:in `put_pack'
from /usr/lib/ruby/1.8/resolv.rb:1142:in `encode'
from /usr/lib/ruby/1.8/resolv.rb:1139:in `each'
from /usr/lib/ruby/1.8/resolv.rb:1139:in `encode'
from /usr/lib/ruby/1.8/resolv.rb:1159:in `initialize'
from /usr/lib/ruby/1.8/resolv.rb:1125:in `new'
from /usr/lib/ruby/1.8/resolv.rb:1125:in `encode'
from /usr/lib/ruby/1.8/resolv.rb:652:in `sender'
... 6 levels...
from /usr/lib/ruby/1.8/resolv.rb:868:in `each'
from /usr/lib/ruby/1.8/resolv.rb:868:in `resolv'
from /usr/lib/ruby/1.8/resolv.rb:470:in `each_resource'
from teste.rb:4

I think it is a bug in the ruby base library.
I'm using ruby 1.8, and I have tried this in tree different machines ...

Can some one help me with this please?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top