Fix Revision 601

With tests, this time.
This commit is contained in:
Jacques Distler 2010-02-28 23:51:33 -06:00
parent 70aa50ad4b
commit 7b22daa784
3 changed files with 13 additions and 4 deletions

View file

@ -31,7 +31,11 @@
</h1>
<div id="Error-Content">
<%= h @content_for_layout %>
<%= if :raw
@content_for_layout
else
h @content_for_layout
end %>
</div> <!-- Error-Content -->

View file

@ -765,6 +765,11 @@ class WikiControllerTest < ActionController::TestCase
'author' => 'AuthorOfNewPage'
assert_equal 403, r.response_code
resp = %{<p>Access denied. Your IP address, 127.0.0.2, was found on one or more DNSBL blocking } +
%{list(s).</p>\n<p>See <a href='http://www.spamcop.net/w3m?action=checkblock&amp;ip=127.0.0.2} +
%{'>here</a> for more information.</p>\n<p>See <a href='http://www.spamhaus.org/query/bl?ip=1} +
%{27.0.0.2'>here</a> for more information.</p>\n}
assert_match Regexp.new(Regexp.escape(resp)), r.body
end
def test_dnsbl_filter_allow_action

View file

@ -45,7 +45,7 @@ module DNSBL_Check
addr = Resolv.getaddress("#{host}") rescue ''
if addr[0,7]=="127.0.0"
logger.info("#{request.remote_addr} found using DNSBL #{host}")
ban_help << " See <a href='#{DNSBLS[host]}#{request.remote_addr}'>here</a> for more information."
ban_help << "\n<p>See <a href='#{DNSBLS[dnsbl]}#{request.remote_addr}'>here</a> for more information.</p>"
passed = false
end
end
@ -58,8 +58,8 @@ module DNSBL_Check
$dnsbl_passed.push request.remote_addr
logger.warn("#{request.remote_addr} added to DNSBL passed cache")
else
render( :text => "Access denied. Your IP address, #{request.remote_addr}, was found on one or more DNSBL" +
" blocking list(s).#{ban_help}", :status => 403, :layout => 'error')
render( :text => "<p>Access denied. Your IP address, #{request.remote_addr}, was found on one or more DNSBL" +
" blocking list(s).</p>#{ban_help}", :status => 403, :layout => 'error', :locals => {:raw => true})
return false
end
end