diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-09 10:16:50 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-09 10:16:50 +0000 |
commit | d99801bbc86dbdbf8832475a56fd7e9b07e58b4f (patch) | |
tree | 48f7fa7b62df2c5af22ec1fc14b986cd9605d018 | |
parent | 11b3b5ed9024fa0d02400f90373269c0b91bbddf (diff) | |
download | ruby-d99801bbc86dbdbf8832475a56fd7e9b07e58b4f.tar.gz |
* lib/webrick/accesslog.rb (WEBrick::AccessLog#format): support
%{remote}p for logging remote (client) port number.
[ruby-dev:42670]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | lib/webrick/accesslog.rb | 7 |
3 files changed, 15 insertions, 0 deletions
@@ -1,3 +1,9 @@ +Thu Dec 9 18:51:06 2010 Tanaka Akira <akr@fsij.org> + + * lib/webrick/accesslog.rb (WEBrick::AccessLog#format): support + %{remote}p for logging remote (client) port number. + [ruby-dev:42670] + Thu Dec 9 11:00:30 2010 Yukihiro Matsumoto <matz@ruby-lang.org> * array.c (rb_ary_dup): should copy contents only. no instance @@ -74,6 +74,8 @@ with all sufficient information, see the ChangeLog file. * webrick * new method: * WEBrick::HTTPRequest#continue for generating '100 continue' response. + * new logging directive: + * %{remote}p for remote (client) port number. * uri * new methods: diff --git a/lib/webrick/accesslog.rb b/lib/webrick/accesslog.rb index 0bed8097d5..a9e8533fd1 100644 --- a/lib/webrick/accesslog.rb +++ b/lib/webrick/accesslog.rb @@ -56,6 +56,13 @@ module WEBrick (param = params[spec][param]) ? escape(param) : "-" when ?t params[spec].strftime(param || CLF_TIME_FORMAT) + when ?p + case param + when 'remote' + escape(params["i"].peeraddr[1].to_s) + else + escape(params["p"].to_s) + end when ?% "%" else |