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
ENV[‘http_proxy’] = “http://10.2.2.2:8080”
wget -T2 -t2 -qO - "http://www.ipchicken.com/"
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?