# Question about http-access2

**URL:** <https://www.ruby-forum.com/t/question-about-http-access2/53852>\
**Category:** Ruby\
**Created:** [February 15, 2006, 11:35am UTC](https://www.ruby-forum.com/t/question-about-http-access2/53852 "2006-02-15T11:35:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yin\_Chaoyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/48db29/32.png) [@Yin\_Chaoyi](https://www.ruby-forum.com/u/Yin_Chaoyi)\
**Post date:** [February 15, 2006, 11:35am UTC](https://www.ruby-forum.com/t/question-about-http-access2/53852/1 "2006-02-15T11:35:04Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Yin\_Chaoyi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/48db29/32.png) [@Yin\_Chaoyi](https://www.ruby-forum.com/u/Yin_Chaoyi)\
**Post date:** [February 15, 2006, 2:18pm UTC](https://www.ruby-forum.com/t/question-about-http-access2/53852/2 "2006-02-15T14:18:53Z")

</div>

Yin Chaoyi wrote:

> Any ideas? Thanks for helping!  
> Network (driver) timeout?

```
robert
```
