[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

"bulletproof" http connection

davidnwelton

4/11/2006 8:55:00 AM

Hi,

I need to continually hit a server that sometimes fails. I'm currently
doing things like this:

h = Net::HTTP::Proxy(proxy_addr, proxy_port)

i = 0
start = Time.new

begin
h.start('xxxxxxxxxxx', 80) { |session|

a_loop .....

.....

begin
puts "Fetching #{target}"
resp, data = session.get(target)
rescue Exception
bad[target] = $!
next
end

.....

that doesn't seem to do quite what I want, though, because after it
fails the first time, it keeps failing. Is it legit to put something
in the rescue clause like this?

session = h.start('xxxxxxxxxxxxx', 80)

Thanks,
Dave