Hi all,
I'm playing around with mongrel handlers and I came across a behaviour
that seems abnormal to me with regard to the Configurator#uri calls. It
appears that order matters.
For instance:
...
listener do
uri "/icons", :handler => DirHandler.new("/var/www/icons")
uri "/", :handler => DirHandler.new("/var/app/html")
uri "/", :handler => stats
end
...
with this sort of configuration, any URI that is alphabetically AFTER
"/icons" will be short circuited to a 404 error in mongrel.
The cause is basically :
@classifier.resolve("/junk") # => [nil,nil,nil]
Instead of :
["/junk", "/", [#<Mongrel::DirHandler>, #<Mongrel::StatusHandler>]]
I've attached a unit test that shows this effect by calling the
URIClassifier directly. I'm not sure if this is a bug or a
misunderstanding on my part.
enjoy,
-jeremy
--
========================================================================
Jeremy Hinegardner [EMAIL PROTECTED]
require 'test/unit'
require 'rubygems'
require 'mongrel'
include Mongrel
class URIClassifierText < Test::Unit::TestCase
def test_classifier_order
u = URIClassifier.new
root = "/"
path = "/path"
u.register(path,1)
u.register(root,2)
["/before", "/way_past"].each do |uri|
sn,pi,h = u.resolve(uri)
assert_equal root,sn
assert_equal uri, pi
assert_equal 2,h
end
end
end
_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users