# Question about http-access2

**URL:** <https://rubytalk.org/t/question-about-http-access2/24921>\
**Category:** ruby-talk\
**Created:** [15 February 2006 10:33 UTC](https://rubytalk.org/t/question-about-http-access2/24921 "2006-02-15T10:33:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yin\_Chaoyi](https://avatars.discourse-cdn.com/v4/letter/y/48db29/32.png) [@Yin\_Chaoyi](https://rubytalk.org/u/Yin_Chaoyi)\
**Post date:** [15 February 2006 10:33 UTC](https://rubytalk.org/t/question-about-http-access2/24921/1 "2006-02-15T10:33:27Z")

</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)  
> &nbsp;&nbsp;&nbsp;proxy = ENV['HTTP\_PROXY']  
> &nbsp;&nbsp;&nbsp;clnt = HTTPAccess2::Client.new(proxy)
> 
> &nbsp;&nbsp;&nbsp;begin  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target = url  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clnt.reset(target)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result = clnt.get(target)  
> &nbsp;&nbsp;&nbsp;rescue SystemCallError  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "Connection Error"  
> &nbsp;&nbsp;&nbsp;end
> 
> &nbsp;&nbsp;&nbsp;if result.contenttype != "application/pdf"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "can't get pdf!"  
> &nbsp;&nbsp;&nbsp;else  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f = File.new(filename, File::CREAT|File::RDWR|File::TRUNC, 0644)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f.puts result.content  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f.close  
> &nbsp;&nbsp;&nbsp;end  
> &nbsp;&nbsp;&nbsp;"Success"  
> end
> 
> puts fetch(ARGV.shift, ARGV.shift)

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://rubytalk.org/u/Robert)\
**Post date:** [15 February 2006 13:18 UTC](https://rubytalk.org/t/question-about-http-access2/24921/2 "2006-02-15T13:18:32Z")

</div>

Yin Chaoyi wrote:

> 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?

&nbsp;&nbsp;&nbsp;&nbsp;robert
