From: Jim Freeze Date: 2002-09-26T05:47:19+09:00 Subject: Re: http/net On Thu, Sep 26, 2002 at 04:47:51AM +0900, GOTO Kentaro wrote: > At Thu, 26 Sep 2002 04:10:34 +0900, > Jim Freeze wrote: > > > Net::HTTP.start( url ) {|http| > > should be Net::HTTP.start(host[, port]){|http| > > > ./get.rb > > /usr/local/lib/ruby/1.6/net/protocol.rb:469:in `new': getaddrinfo: no address associated with hostname. (SocketError) > > this was caused when Net::HTTP would lookup address of host "http://...". > Because http://... is not a hostname and DNS lookup failed. > > > net/http.rb include reference and samples. Try: > > % rd2 http.rb > http.html > > or > > % ruby -ne 'print if /^=begin/.../^/=end/' http.rb | more > > > > -- Gotoken Thanks, that helped. I changed the code to the following: ================================================ require 'net/http' Net::HTTP.version_1_1 # declear to use 1.1 features. url = "xyz.mycompany.com" port = 3000 path = "/scripts/isynch.dll" account = "me" passwd = "notarealpassword" Net::HTTP.start( url, port ) {|http| begin response, body = http.get( path, 'Authorization' => 'Basic ' + ["#{account}:#{passwd}"].pack('m').strip ) print body rescue Net::ProtoRetriableError => err if m = %r.match( err.response['location'] ) host = m[1].strip path = m.post_match retry end end } ================================================ The code works, but I get back a frame: Modeling Request System Is there way to automatically get the frame documents, or do I have to search the returned text and filter out the new paths? Thanks -- Jim Freeze ---------- Programming Ruby def initialize; fun; end A language with class