From: Yin Chaoyi Date: 2006-02-15T19:33:27+09:00 Subject: question about http-access2 Hello, I am a ruby newbie. When I use the attached script, the file downloaded over a slow link is always incomplete. I can successfully download a much larger file over a fast link. I use ethereal to capture the communication. It's the client which initials the disconnection by first sending a FIN then followed by several RSTs. Any ideas? Thanks for helping! ------ #!/usr/bin/env ruby require 'http-access2' def fetch(url, filename) proxy = ENV['HTTP_PROXY'] clnt = HTTPAccess2::Client.new(proxy) begin target = url clnt.reset(target) result = clnt.get(target) rescue SystemCallError return "Connection Error" end if result.contenttype != "application/pdf" return "can't get pdf!" else f = File.new(filename, File::CREAT|File::RDWR|File::TRUNC, 0644) f.puts result.content f.close end "Success" end puts fetch(ARGV.shift, ARGV.shift)