1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

11 commits

Author SHA1 Message Date
Andre Arko
f05ccf805a Revert "Revert "Merge pull request #3640 from indirect/remote_ip""
This reverts commit 8d1a2b3ecd, because I have fixed the issues this commit caused in the next commit.
2011-11-16 12:53:43 -10:00
Jon Leighton
8d1a2b3ecd Revert "Merge pull request #3640 from indirect/remote_ip"
This reverts commit 6491aadc52, reversing
changes made to 83bf0b626c.

See https://github.com/rails/rails/pull/3640#issuecomment-2752761 for
explanation.
2011-11-15 22:47:18 +00:00
Andre Arko
d743954792 GetIp#to_s should never return nil. That's icky. 2011-11-14 16:43:21 -10:00
Andre Arko
cda1a5d5fe memoize the relatively expensive remote IP code 2011-11-14 11:20:57 -10:00
Andre Arko
00a0a4ddeb cleaner names 2011-11-14 11:20:20 -10:00
Andre Arko
9c4532bf74 remove ignored flag, fixes warnings 2011-11-13 10:22:12 -10:00
Andre Arko
2d063c6269 turns out the tests expect remote_addrs.first 2011-11-13 10:20:55 -10:00
Andre Arko
2189bff732 correctly raise IpSpoofAttackError message 2011-11-13 10:20:29 -10:00
Andre Arko
317f4e2236 defer calculating the remote IP until requested 2011-11-12 00:45:31 -10:00
Andre Arko
9432163c60 refactor RemoteIp middleware
- return the last forwarded IP before REMOTE_ADDR to handle proxies
- remove completely superfluous RemoteIpGetter class
- remove duplication of trusted proxies regexp
- remove unused constant from Request
- move comments from Request to where they are actually relevant
- edit comments for clarity of purpose

The original code (confusingly) tried to return REMOTE_ADDR both at the beginning and the end of the chain of options. Since REMOTE_ADDR is _always_ set, this is kind of silly. This change leaves REMOTE_ADDR as the last option, so that proxied requests will be assigned the correct remote IP address.
2011-11-11 21:25:08 -10:00
Carlhuda
93422af5d5 Move remote_ip to a middleware:
* ActionController::Base.ip_spoofing_check deprecated => config.action_dispatch.ip_spoofing_check
  * ActionController::Base.trusted_proxies deprecated => config.action_dispatch.trusted_proxies
2010-03-03 21:24:00 -08:00