question about http-access2

Y

Yin Chaoyi

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)
 
R

Robert Klemme

Yin said:
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!

Network (driver) timeout?

robert
 

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

Forum statistics

Threads
473,787
Messages
2,569,631
Members
45,338
Latest member
41Pearline46

Latest Threads

Top