mirror of
https://github.com/github/rails.git
synced 2026-01-12 08:08:31 -05:00
Compare commits
6 Commits
github41
...
2-3-stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8c05974e1 | ||
|
|
2229a7e8e8 | ||
|
|
8fff8f0410 | ||
|
|
27a508c91e | ||
|
|
2eb197e72f | ||
|
|
cd2136aed6 |
@@ -79,7 +79,7 @@ spec = Gem::Specification.new do |s|
|
||||
s.requirements << 'none'
|
||||
|
||||
s.add_dependency('activesupport', '= 2.3.14' + PKG_BUILD)
|
||||
s.add_dependency('rack', '~> 1.1.0')
|
||||
s.add_dependency('rack', '~> 1.1.3')
|
||||
|
||||
s.require_path = 'lib'
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ rescue LoadError
|
||||
end
|
||||
end
|
||||
|
||||
gem 'rack', '~> 1.1.0'
|
||||
gem 'rack', '~> 1.1.3'
|
||||
require 'rack'
|
||||
require 'action_controller/cgi_ext'
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ module ActionController
|
||||
not_trusted_addrs = remote_addr_list.reject {|addr| addr =~ TRUSTED_PROXIES}
|
||||
return not_trusted_addrs.first unless not_trusted_addrs.empty?
|
||||
end
|
||||
remote_ips = @env['HTTP_X_FORWARDED_FOR'] && @env['HTTP_X_FORWARDED_FOR'].split(',')
|
||||
remote_ips = @env['HTTP_X_FORWARDED_FOR'].present? && @env['HTTP_X_FORWARDED_FOR'].split(',')
|
||||
|
||||
if @env.include? 'HTTP_CLIENT_IP'
|
||||
if ActionController::Base.ip_spoofing_check && remote_ips && !remote_ips.include?(@env['HTTP_CLIENT_IP'])
|
||||
|
||||
@@ -20,6 +20,9 @@ class RequestTest < ActiveSupport::TestCase
|
||||
'HTTP_X_FORWARDED_FOR' => '3.4.5.6'
|
||||
assert_equal '1.2.3.4', request.remote_ip
|
||||
|
||||
request = stub_request 'HTTP_X_FORWARDED_FOR' => ''
|
||||
assert_nil request.remote_ip
|
||||
|
||||
request = stub_request 'REMOTE_ADDR' => '127.0.0.1',
|
||||
'HTTP_X_FORWARDED_FOR' => '3.4.5.6'
|
||||
assert_equal '3.4.5.6', request.remote_ip
|
||||
|
||||
@@ -602,14 +602,14 @@ module ActiveRecord
|
||||
# Validates that the specified attribute matches the length restrictions supplied. Only one option can be used at a time:
|
||||
#
|
||||
# class Person < ActiveRecord::Base
|
||||
# validates_length_of :first_name, :maximum=>30
|
||||
# validates_length_of :last_name, :maximum=>30, :message=>"less than %{count} if you don't mind"
|
||||
# validates_length_of :first_name, :maximum => 30
|
||||
# validates_length_of :last_name, :maximum => 30, :message => "less than %{count} if you don't mind"
|
||||
# validates_length_of :fax, :in => 7..32, :allow_nil => true
|
||||
# validates_length_of :phone, :in => 7..32, :allow_blank => true
|
||||
# validates_length_of :user_name, :within => 6..20, :too_long => "pick a shorter name", :too_short => "pick a longer name"
|
||||
# validates_length_of :fav_bra_size, :minimum => 1, :too_short => "please enter at least %{count} character"
|
||||
# validates_length_of :smurf_leader, :is => 4, :message => "papa is spelled with %{count} characters... don't play me."
|
||||
# validates_length_of :essay, :minimum => 100, :too_short => "Your essay must be at least %{count} words."), :tokenizer => lambda {|str| str.scan(/\w+/) }
|
||||
# validates_length_of :zip_code, :minimum => 5, :too_short => "please enter at least %{count} characters"
|
||||
# validates_length_of :smurf_leader, :is => 4, :message => "papa is spelled with %{count} characters... don't play me"
|
||||
# validates_length_of :essay, :minimum => 100, :too_short => "Your essay must be at least %{count} words"), :tokenizer => lambda {|str| str.scan(/\w+/) }
|
||||
# end
|
||||
#
|
||||
# Configuration options:
|
||||
|
||||
Reference in New Issue
Block a user