diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/open-uri.rb | 9 |
2 files changed, 14 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Sun Feb 1 03:07:25 2004 Tanaka Akira <akr@m17n.org> + + * lib/open-uri.rb (URI::Generic#find_proxy): warn HTTP_PROXY. + raise an errror on non-http proxy URI. + Sun Feb 1 00:57:41 2004 Kouhei Sutou <kou@cozmixng.org> * lib/rss/parser.rb (RSS::Parser): added @@default_parser. Used diff --git a/lib/open-uri.rb b/lib/open-uri.rb index e448e47af5..22c27c8ccc 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -477,12 +477,21 @@ module URI # Use CGI_HTTP_PROXY. cf. libwww-perl. proxy_uri = ENV["CGI_#{name.upcase}"] end + elsif name == 'http_proxy' + unless proxy_uri = ENV[name] + if proxy_uri = ENV[name.upcase] + warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.' + end + end else proxy_uri = ENV[name] || ENV[name.upcase] end if proxy_uri proxy_uri = URI.parse(proxy_uri) + unless URI::HTTP === proxy_uri + raise "Non-http proxy URI: #{proxy_uri}" + end name = 'no_proxy' if no_proxy = ENV[name] || ENV[name.upcase] no_proxy.scan(/([^:,]*)(?::(\d+))?/) {|host, port| |