mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/soap/netHttpClient.rb: follow http-access2. hosts which matches
ENV['no_proxy'] or ENV['NO_PROXY'] is not proxyed. - [,:] separated. ("ruby-lang.org:rubyist.net") - no regexp. (give "ruby-lang.org", not "*.ruby-lang.org") - if you want specify hot by IP address, give full address. ("192.168.1.1, 192.168.1.2") * lib/soap/rpc/cgistub.rb: return "Status: XXX MMM" line. * test/runner.rb: give testsuite name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
94e01ab645
commit
cbef5b65db
4 changed files with 43 additions and 5 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
Sat Oct 4 17:52:59 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/soap/netHttpClient.rb: follow http-access2. hosts which matches
|
||||||
|
ENV['no_proxy'] or ENV['NO_PROXY'] is not proxyed.
|
||||||
|
- [,:] separated. ("ruby-lang.org:rubyist.net")
|
||||||
|
- no regexp. (give "ruby-lang.org", not "*.ruby-lang.org")
|
||||||
|
- if you want specify hot by IP address, give full address.
|
||||||
|
("192.168.1.1, 192.168.1.2")
|
||||||
|
|
||||||
|
* lib/soap/rpc/cgistub.rb: return "Status: XXX MMM" line.
|
||||||
|
|
||||||
|
* test/runner.rb: give testsuite name.
|
||||||
|
|
||||||
Sat Oct 4 14:59:51 2003 Tanaka Akira <akr@m17n.org>
|
Sat Oct 4 14:59:51 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* lib/pathname.rb (initialize): raise ArgumentError if argument has
|
* lib/pathname.rb (initialize): raise ArgumentError if argument has
|
||||||
|
|
|
@ -26,6 +26,7 @@ module SOAP
|
||||||
class NetHttpClient
|
class NetHttpClient
|
||||||
|
|
||||||
attr_accessor :proxy
|
attr_accessor :proxy
|
||||||
|
attr_accessor :no_proxy
|
||||||
attr_accessor :debug_dev
|
attr_accessor :debug_dev
|
||||||
attr_reader :session_manager
|
attr_reader :session_manager
|
||||||
|
|
||||||
|
@ -54,6 +55,8 @@ class NetHttpClient
|
||||||
@agent = agent
|
@agent = agent
|
||||||
@debug_dev = nil
|
@debug_dev = nil
|
||||||
@session_manager = SessionManager.new
|
@session_manager = SessionManager.new
|
||||||
|
name = 'no_proxy'
|
||||||
|
@no_proxy = ENV[name] || ENV[name.upcase]
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset(url)
|
def reset(url)
|
||||||
|
@ -83,8 +86,11 @@ class NetHttpClient
|
||||||
private
|
private
|
||||||
|
|
||||||
def start(url)
|
def start(url)
|
||||||
proxy_host = @proxy ? @proxy.host : nil
|
proxy_host = proxy_port = nil
|
||||||
proxy_port = @proxy ? @proxy.port : nil
|
unless no_proxy?(url)
|
||||||
|
proxy_host = @proxy.host
|
||||||
|
proxy_port = @proxy.port
|
||||||
|
end
|
||||||
response = nil
|
response = nil
|
||||||
Net::HTTP::Proxy(proxy_host, proxy_port).start(url.host, url.port) { |http|
|
Net::HTTP::Proxy(proxy_host, proxy_port).start(url.host, url.port) { |http|
|
||||||
if http.respond_to?(:set_debug_output)
|
if http.respond_to?(:set_debug_output)
|
||||||
|
@ -95,6 +101,24 @@ private
|
||||||
}
|
}
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
||||||
|
NO_PROXY_HOSTS = ['localhost']
|
||||||
|
|
||||||
|
def no_proxy?(uri)
|
||||||
|
if !@proxy or NO_PROXY_HOSTS.include?(uri.host)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
if @no_proxy
|
||||||
|
@no_proxy.scan(/([^:,]*)(?::(\d+))?/) do |host, port|
|
||||||
|
if /(\A|\.)#{Regexp.quote(host)}\z/i =~ uri.host &&
|
||||||
|
(!port || uri.port == port.to_i)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -172,6 +172,7 @@ private
|
||||||
log(INFO) { "Received a request from '#{ @remote_user }@#{ @remote_host }'." }
|
log(INFO) { "Received a request from '#{ @remote_user }@#{ @remote_host }'." }
|
||||||
# SOAP request parsing.
|
# SOAP request parsing.
|
||||||
@request = SOAPRequest.new.init
|
@request = SOAPRequest.new.init
|
||||||
|
@response['Status'] = 200
|
||||||
req_charset = @request.charset
|
req_charset = @request.charset
|
||||||
req_string = @request.dump
|
req_string = @request.dump
|
||||||
log(DEBUG) { "XML Request: #{req_string}" }
|
log(DEBUG) { "XML Request: #{req_string}" }
|
||||||
|
@ -185,14 +186,14 @@ private
|
||||||
@response['content-type'] = @mediatype
|
@response['content-type'] = @mediatype
|
||||||
end
|
end
|
||||||
if is_fault
|
if is_fault
|
||||||
@response.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
|
@response['Status'] = 500
|
||||||
end
|
end
|
||||||
@response.body = res_string
|
@response.body = res_string
|
||||||
rescue Exception
|
rescue Exception
|
||||||
res_string = create_fault_response($!)
|
res_string = create_fault_response($!)
|
||||||
@response['Cache-Control'] = 'private'
|
@response['Cache-Control'] = 'private'
|
||||||
@response['content-type'] = @mediatype
|
@response['content-type'] = @mediatype
|
||||||
@response.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR
|
@response['Status'] = 500
|
||||||
ensure
|
ensure
|
||||||
buf = ''
|
buf = ''
|
||||||
@response.send_response(buf)
|
@response.send_response(buf)
|
||||||
|
|
|
@ -8,7 +8,7 @@ Release = rcsid[3].freeze
|
||||||
|
|
||||||
class BulkTestSuite < Test::Unit::TestSuite
|
class BulkTestSuite < Test::Unit::TestSuite
|
||||||
def self.suite
|
def self.suite
|
||||||
suite = Test::Unit::TestSuite.new
|
suite = Test::Unit::TestSuite.new(self.name)
|
||||||
ObjectSpace.each_object(Class) do |klass|
|
ObjectSpace.each_object(Class) do |klass|
|
||||||
suite << klass.suite if (Test::Unit::TestCase > klass)
|
suite << klass.suite if (Test::Unit::TestCase > klass)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue