From b5521a2651b5444f10c20803279af6d9570069b7 Mon Sep 17 00:00:00 2001 From: Kent Sibilev Date: Fri, 1 Sep 2006 02:18:52 +0000 Subject: ActionWebService WSDL generation ignores HTTP_X_FORWARDED_HOST git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4891 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionwebservice/CHANGELOG | 4 +++- .../action_web_service/dispatcher/action_controller_dispatcher.rb | 2 +- actionwebservice/test/dispatcher_action_controller_soap_test.rb | 6 ++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/actionwebservice/CHANGELOG b/actionwebservice/CHANGELOG index 5a98b032d2..8b120360f6 100644 --- a/actionwebservice/CHANGELOG +++ b/actionwebservice/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* ActionWebService WSDL generation ignores HTTP_X_FORWARDED_HOST [Paul Butcher ] + * Tighten rescue clauses. #5985 [james@grayproductions.net] * Fixed XMLRPC multicall when one of the called methods returns a struct object. [Kent Sibilev] @@ -14,7 +16,7 @@ * Fix test database name typo. [Marcel Molina Jr.] -*1.1.2* (April 9th, 2005) +*1.1.2* (April 9th, 2006) * Rely on Active Record 1.14.2 diff --git a/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb b/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb index a959150f9d..2c7d5a0948 100644 --- a/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +++ b/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb @@ -167,7 +167,7 @@ module ActionWebService # :nodoc: private def base_uri - host = request.env['HTTP_HOST'] || request.env['SERVER_NAME'] || 'localhost' + host = request.host_with_port relative_url_root = request.relative_url_root scheme = request.ssl? ? 'https' : 'http' '%s://%s%s/%s/' % [scheme, host, relative_url_root, self.class.controller_path] diff --git a/actionwebservice/test/dispatcher_action_controller_soap_test.rb b/actionwebservice/test/dispatcher_action_controller_soap_test.rb index 681c7c548b..0b58af3006 100644 --- a/actionwebservice/test/dispatcher_action_controller_soap_test.rb +++ b/actionwebservice/test/dispatcher_action_controller_soap_test.rb @@ -121,17 +121,15 @@ class TC_DispatcherActionControllerSoap < Test::Unit::TestCase end location = definitions.services[0].ports[0].soap_address.location if controller.is_a?(DelegatedController) - assert_match %r{http://localhost/dispatcher_test/delegated/test_service$}, location + assert_match %r{http://test.host/dispatcher_test/delegated/test_service$}, location elsif controller.is_a?(DirectController) - assert_match %r{http://localhost/dispatcher_test/direct/api$}, location + assert_match %r{http://test.host/dispatcher_test/direct/api$}, location end definitions.collect_complextypes end def ensure_valid_wsdl_action(controller) test_request = ActionController::TestRequest.new({ 'action' => 'wsdl' }) - test_request.env['REQUEST_METHOD'] = 'GET' - test_request.env['HTTP_HOST'] = 'localhost' test_response = ActionController::TestResponse.new wsdl = controller.process(test_request, test_response).body ensure_valid_wsdl(controller, wsdl, DispatcherTest::WsdlNamespace) -- cgit v1.2.3