summaryrefslogtreecommitdiff
path: root/test/net/http/utils.rb
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-12-10 09:41:33 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-12-10 09:41:33 +0900
commit660388f6c5b148ea6f84d589482391bf78f35c6b (patch)
treed7890a0384bcfedac5a3848a5c568360d2ff773e /test/net/http/utils.rb
parent6a22b2a091eda81a473eb1b0cc69fe0792560e27 (diff)
test/net/http/test_https.rb (test_get_SNI_failure): stop proxy settings
Because the test fails under HTTP proxy settings. https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20191210T000004Z.fail.html.gz ``` 1) Failure: TestNetHTTPS#test_get_SNI_failure [/export/home/users/chkbuild/cb-gcc/tmp/build/20191210T000004Z/ruby/test/net/http/test_https.rb:81]: [OpenSSL::SSL::SSLError] exception expected, not #<Net::HTTPServerException: 403 "Forbidden">. ``` The new SNI feature introduced at 54072e329c may need to be improved for HTTP proxy environment.
Diffstat (limited to 'test/net/http/utils.rb')
-rw-r--r--test/net/http/utils.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/net/http/utils.rb b/test/net/http/utils.rb
index dbfd112f31..53f3be0b88 100644
--- a/test/net/http/utils.rb
+++ b/test/net/http/utils.rb
@@ -107,4 +107,23 @@ module TestNetHTTPUtils
def print(*args) end
def printf(*args) end
end
+
+ def self.clean_http_proxy_env
+ orig = {
+ 'http_proxy' => ENV['http_proxy'],
+ 'http_proxy_user' => ENV['http_proxy_user'],
+ 'http_proxy_pass' => ENV['http_proxy_pass'],
+ 'no_proxy' => ENV['no_proxy'],
+ }
+
+ orig.each_key do |key|
+ ENV.delete key
+ end
+
+ yield
+ ensure
+ orig.each do |key, value|
+ ENV[key] = value
+ end
+ end
end