ruby-changes:20161
From: nahi <ko1@a...>
Date: Thu, 23 Jun 2011 18:45:17 +0900 (JST)
Subject: [ruby-changes:20161] nahi:r32209 (ruby_1_8_7): backported r26281 from ruby_1_8
nahi 2011-06-23 18:44:05 +0900 (Thu, 23 Jun 2011) New Revision: 32209 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32209 Log: backported r26281 from ruby_1_8 * lib/webrick/accesslog.rb (WEBrick::AccessLog.format): log parameter embedding did not work. See #4913. * test/webrick/test_accesslog.rb: Add for test it. Added files: branches/ruby_1_8_7/test/webrick/test_accesslog.rb Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/lib/webrick/accesslog.rb Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 32208) +++ ruby_1_8_7/ChangeLog (revision 32209) @@ -1,3 +1,12 @@ +Thu Jun 23 18:38:43 2011 Hiroshi Nakamura <nahi@r...> + + backported r26281 from ruby_1_8 + + * lib/webrick/accesslog.rb (WEBrick::AccessLog.format): log parameter + embedding did not work. See #4913. + + * test/webrick/test_accesslog.rb: Add for test it. + Thu Jun 16 22:55:02 2011 Hiroshi Nakamura <nahi@r...> * test/test_securerandom.rb: Add testcase. This testcase does NOT aim Index: ruby_1_8_7/lib/webrick/accesslog.rb =================================================================== --- ruby_1_8_7/lib/webrick/accesslog.rb (revision 32208) +++ ruby_1_8_7/lib/webrick/accesslog.rb (revision 32209) @@ -53,7 +53,7 @@ when ?e, ?i, ?n, ?o raise AccessLogError, "parameter is required for \"#{spec}\"" unless param - param = params[spec][param] ? escape(param) : "-" + (param = params[spec][param]) ? escape(param) : "-" when ?t params[spec].strftime(param || CLF_TIME_FORMAT) when ?% Index: ruby_1_8_7/test/webrick/test_accesslog.rb =================================================================== --- ruby_1_8_7/test/webrick/test_accesslog.rb (revision 0) +++ ruby_1_8_7/test/webrick/test_accesslog.rb (revision 32209) @@ -0,0 +1,10 @@ +require "test/unit" +require "webrick/accesslog" + +class TestWEBrickAccessLog < Test::Unit::TestCase + def test_format + format = "%{Referer}i and %{User-agent}i" + params = {"i" => {"Referer" => "ref", "User-agent" => "agent"}} + assert_equal("ref and agent", WEBrick::AccessLog.format(format, params)) + end +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/