diff options
author | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-26 02:47:03 +0000 |
---|---|---|
committer | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-26 02:47:03 +0000 |
commit | 4ff4a7d915f01dabcb87125aa89159fcc5d48534 (patch) | |
tree | 69359452775dfb27b5bbcf7ca90f7f48db47c3fc | |
parent | 14fc77f607e47f2adf77b31457d0c8a7a3300af6 (diff) | |
download | unicorn-4ff4a7d915f01dabcb87125aa89159fcc5d48534.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@740 19e92222-5c0b-0410-8929-a290d50e31e9
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | lib/mongrel/handlers.rb | 9 | ||||
-rw-r--r-- | test/test_handlers.rb | 4 |
3 files changed, 10 insertions, 5 deletions
@@ -1,2 +1,2 @@ -v1.0.2. Signed gem; various bugfixes and patches. +v1.0.2. Signed gem; many minor bugfixes and patches. diff --git a/lib/mongrel/handlers.rb b/lib/mongrel/handlers.rb index 9981a18..385f958 100644 --- a/lib/mongrel/handlers.rb +++ b/lib/mongrel/handlers.rb @@ -218,11 +218,14 @@ module Mongrel if same_response response.start(304) {} else - # first we setup the headers and status then we do a very fast send on the socket directly - response.status ||= 200 + + # First we setup the headers and status then we do a very fast send on the socket directly + + # Support custom responses except 404, which is the default. A little awkward. + response.status = 200 if response.status == 404 header[Const::LAST_MODIFIED] = mtime.httpdate - # set the mime type from our map based on the ending + # Set the mime type from our map based on the ending dot_at = req_path.rindex('.') if dot_at header[Const::CONTENT_TYPE] = MIME_TYPES[req_path[dot_at .. -1]] || @default_content_type diff --git a/test/test_handlers.rb b/test/test_handlers.rb index ef858c8..72abbbc 100644 --- a/test/test_handlers.rb +++ b/test/test_handlers.rb @@ -44,8 +44,9 @@ class HandlersTest < Test::Unit::TestCase uri "/dumb", :handler => Mongrel::DeflateFilter.new uri "/dumb", :handler => DumbHandler.new, :in_front => true uri "/files", :handler => Mongrel::DirHandler.new("doc") - uri "/files_nodir", :handler => Mongrel::DirHandler.new("doc",listing_allowed=false, index_html="none") + uri "/files_nodir", :handler => Mongrel::DirHandler.new("doc", listing_allowed=false, index_html="none") uri "/status", :handler => Mongrel::StatusHandler.new(:stats_filter => stats) + uri "/relative", :handler => Mongrel::DirHandler.new(nil, listing_allowed=false, index_html="none") end end @config.run @@ -66,6 +67,7 @@ class HandlersTest < Test::Unit::TestCase "http://localhost:9998/status", ]) + # XXX This can't possibly have good coverage. check_status res, String end |