Hi
I am not able to access any http via Ruby program.I access internet
using proxy server. On runniong following program , it generates
error :
c:/ruby/lib/ruby/1.8/net/protocol.rb:83:in `initialize': getaddrinfo:
no address
associated with hostname. (SocketError)
from c:/ruby/lib/ruby/1.8/net/protocol.rb:83:in `new'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:83:in `connect'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:82:in `timeout'
from c:/ruby/lib/ruby/1.8/timeout.rb:55:in `timeout'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:82:in `connect'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:64:in `initialize'
from c:/ruby/lib/ruby/1.8/net/http.rb:430:in `open'
from c:/ruby/lib/ruby/1.8/net/http.rb:430:in `do_start'
from c:/ruby/lib/ruby/1.8/net/http.rb:419:in `start'
from c:/ruby/lib/ruby/1.8/net/http.rb:821:in `request'
from c:/ruby/lib/ruby/1.8/net/http.rb:615:in `get'
from url.rb:4
require 'net/http'
require 'socket'
h = Net::HTTP.new('www.pragmaticprogrammer.com'', 80)
resp, data = h.get('/index.html', nil )
puts "Code = #{resp.code}"
puts "Message = #{resp.message}"
resp.each {|key, val| printf "%-14s = %-40.40s\n", key, val }
p data[0..55]
How to correct the code