rails/rails — pull request #14886 by estsauver (2014-04-27 23:54:37+00:00)
Title: LOCALHOST definition should match any 127.0.0.0/8 address

(I saw the PR for https://github.com/rails/rails/pull/14743 hadn't been updated in two weeks,
so I added a couple test cases. )

The entire 127.0.0.0/8 range is assigned to the loopback address, not
only 127.0.0.0/24. This patch allows ActionDispatch::Request::LOCALHOST
to match any IPv4 127.0.0.0/8 loopback address.

The only place that the #local? method was previously under test was
in the show_expectations_test.rb file. I don't particularly like that
that's implicitly where this code is under test, and I feel like I
should move some of that testing code into the
test/dispatch/request_test.rb file, but I wanted some feedback first.

Credit goes to @sriedel for discovering the issue and adding the
patch.