"bulletproof" http connection

D

davidnwelton

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
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top