ENV issue with ruby script and WGET

I am working on a script that sets the proxy server then uses WGET to
hit the internet as a test. In part 2 of the script, I change the ENV
variable for the proxy server to a different proxy server and do the
same HTTP GET to test the other proxy server to the internet.

When I run this off of a Windows box, it works perfectly but not when I
run it on my linux box.

ENV['http_proxy'] = "http://10.1.1.1:8080" html = `wget -T2 -t2 -qO - "http://www.ipchicken.com/"` puts html

sleep 1

ENV[‘http_proxy’] = “http://10.2.2.2:8080
html = wget -T2 -t2 -qO - "http://www.ipchicken.com/"
puts html

The problem is the continual setting of the ENV variable. If I run this
withougt setting the ENV variable more than once, it works fine. If I
try to set the ENV before each GET, the first GET always works but the
second will stop working after several tries…I think the environment
might be getting hosed.

Can anyone suggest a better way to set the environment here or see what
I’m doing wrong?

thanks

jackster

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs