IPv6-compatible fix for latest Philip Taylor Phun

This is better than Revision 228.
This commit is contained in:
Jacques Distler 2008-03-14 17:25:02 -05:00
parent d46798dd08
commit 35257b5fae

View file

@ -3,6 +3,7 @@ require 'maruku'
require 'parsedate' require 'parsedate'
require 'zip/zip' require 'zip/zip'
require 'sanitize' require 'sanitize'
require 'resolv'
class WikiController < ApplicationController class WikiController < ApplicationController
@ -412,7 +413,7 @@ class WikiController < ApplicationController
def remote_ip def remote_ip
ip = request.remote_ip ip = request.remote_ip
logger.info(ip) logger.info(ip)
ip.gsub!(/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/, '\1') ip.gsub!(Regexp.union(Resolv::IPv4::Regex, Resolv::IPv6::Regex), '\0') || 'bogus address'
end end
def render_atom(hide_description = false, limit = 15) def render_atom(hide_description = false, limit = 15)