102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/frameworks/cucumber.rb', line 102
def setup_mechanize(agent, http_proxy=nil)
http_proxy = http_proxy || ENV['HTTP_PROXY'] || ENV['http_proxy']
if ENV['FW_CERT_LOCATION']
agent.cert, agent.key = ENV['FW_CERT_LOCATION'], ENV['FW_CERT_LOCATION']
end
agent.ca_file = ENV['CA_CERT_LOCATION'] if ENV['CA_CERT_LOCATION']
agent.set_proxy(http_proxy.scan(/http:\/\/(.*):80/)[0][0].to_s,80) if http_proxy && !http_proxy.empty?
if(http_proxy)
no_proxy = ENV['NO_PROXY'] || ENV['no_proxy']
if(no_proxy)
no_proxy_qs = no_proxy.gsub(/[, ]+/,',')
agent.agent.http.proxy = URI(http_proxy + '?no_proxy=' + no_proxy_qs)
end
end
agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
agent.agent.allowed_error_codes = ['404', '503']
end
|