# File nqxml/uri.rb, line 72 def fetchHTTP http = Net::HTTP.new(@host, @port) # If authentication is required, prepare the proper HTTP header. auth = nil if @username auth = { 'authorization' => 'Basic ' + ["#{@username}:#{@password}"].pack('m').gsub(/\+/, '') } end # Read headers (ignored) and document body body = nil path = @path begin response, body = http.get(@path, auth) rescue Net::ProtoRetriableError => e head = e.data if head.code == '301' # Moved permanently uri = URI.parse(head['location']) http.finish() http = Net::HTTP.new(uri.host, uri.port) path = uri.path retry end end http.finish() return body end