aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-21 05:14:26 -0800
committerJosé Valim <jose.valim@gmail.com>2011-12-21 05:14:26 -0800
commit618cb4429191290b957391c314a55b4d59f381f3 (patch)
treebef72ad2005a08efb4faa6e8192cec506f591420 /railties/test
parent1f75a1fea12ead1370113ea1be0272667ab7da88 (diff)
parent3131a9379766a735a80220fd2e94cb07791bed9c (diff)
downloadrails-618cb4429191290b957391c314a55b4d59f381f3.tar.gz
rails-618cb4429191290b957391c314a55b4d59f381f3.tar.bz2
rails-618cb4429191290b957391c314a55b4d59f381f3.zip
Merge pull request #4079 from drogus/http_digest_issue
Fix http digest authentication when url ends with `/` or `?`
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/build_original_fullpath_test.rb27
-rw-r--r--railties/test/application/middleware_test.rb11
2 files changed, 37 insertions, 1 deletions
diff --git a/railties/test/application/build_original_fullpath_test.rb b/railties/test/application/build_original_fullpath_test.rb
new file mode 100644
index 0000000000..7a679ea04e
--- /dev/null
+++ b/railties/test/application/build_original_fullpath_test.rb
@@ -0,0 +1,27 @@
+require "abstract_unit"
+
+module ApplicationTests
+ class BuildOriginalPathTest < Test::Unit::TestCase
+ def test_include_original_PATH_info_in_ORIGINAL_FULLPATH
+ env = { 'PATH_INFO' => '/foo/' }
+ assert_equal "/foo/", Rails.application.send(:build_original_fullpath, env)
+ end
+
+ def test_include_SCRIPT_NAME
+ env = {
+ 'SCRIPT_NAME' => '/foo',
+ 'PATH_INFO' => '/bar'
+ }
+
+ assert_equal "/foo/bar", Rails.application.send(:build_original_fullpath, env)
+ end
+
+ def test_include_QUERY_STRING
+ env = {
+ 'PATH_INFO' => '/foo',
+ 'QUERY_STRING' => 'bar',
+ }
+ assert_equal "/foo?bar", Rails.application.send(:build_original_fullpath, env)
+ end
+ end
+end
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index 578370cfca..9e02ef9c66 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -1,5 +1,6 @@
require 'isolation/abstract_unit'
require 'stringio'
+require 'rack/test'
module ApplicationTests
class MiddlewareTest < Test::Unit::TestCase
@@ -75,7 +76,7 @@ module ApplicationTests
add_to_config "config.force_ssl = true"
add_to_config "config.ssl_options = { :host => 'example.com' }"
boot!
-
+
assert_equal AppTemplate::Application.middleware.first.args, [{:host => 'example.com'}]
end
@@ -193,6 +194,14 @@ module ApplicationTests
assert_equal nil, last_response.headers["Etag"]
end
+ test "ORIGINAL_FULLPATH is passed to env" do
+ boot!
+ env = ::Rack::MockRequest.env_for("/foo/?something")
+ Rails.application.call(env)
+
+ assert_equal "/foo/?something", env["ORIGINAL_FULLPATH"]
+ end
+
private
def boot!