sbsm 1.5.5 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/lib/sbsm/app.rb +4 -0
- data/lib/sbsm/session.rb +7 -0
- data/lib/sbsm/version.rb +1 -1
- data/test/test_session.rb +17 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2938a44d2cbad70bde08139096f8578c00cb635
|
4
|
+
data.tar.gz: ffef6523d8bcdae0ea1d9b1b553c704c1da2de66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22b3f3a5ef861c0737eb309f77820f722ca88076913c9b99ee9c409db66832f57c9d656b50aa5c0716d24b73de9fcfa8994052692523ff22d475fea1d6ef4c30
|
7
|
+
data.tar.gz: 3e7225581937bf52e25000c34525e58565d9d85c1514b610508784f607de82abdd065d933fb56ff92cdd4b27cb86310c3da712ecad9f300fb422976c16244381
|
data/History.txt
CHANGED
data/lib/sbsm/app.rb
CHANGED
data/lib/sbsm/session.rb
CHANGED
@@ -518,6 +518,13 @@ module SBSM
|
|
518
518
|
@remote_ip ||= if(@request.respond_to?(:remote_host))
|
519
519
|
@request.remote_host
|
520
520
|
end
|
521
|
+
if @remote_ip.to_s.index(',')
|
522
|
+
saved = @remote_ip.clone
|
523
|
+
@remote_ip = @remote_ip.first if @remote_ip.is_a?(Array)
|
524
|
+
@remote_ip = @remote_ip.split(',').first.gsub(/[\[\]]/, '') if @remote_ip.is_a?(String)
|
525
|
+
SBSM.info("remote_ip is weird #{saved.inspect} => #{@remote_ip.inspect}")
|
526
|
+
end
|
527
|
+
@remote_ip
|
521
528
|
end
|
522
529
|
def set_cookie_input(key, val)
|
523
530
|
SBSM.debug"set_cookie_input #{key} #{val}"
|
data/lib/sbsm/version.rb
CHANGED
data/test/test_session.rb
CHANGED
@@ -142,6 +142,23 @@ class StubSessionSession < SBSM::Session
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
+
class TestSessionApp < Minitest::Test
|
146
|
+
include Rack::Test::Methods
|
147
|
+
# attr_reader :app
|
148
|
+
def app
|
149
|
+
app = SBSM::RackInterface.new(app: SBSM::App)
|
150
|
+
builder = Rack::Builder.new
|
151
|
+
builder.run app
|
152
|
+
end
|
153
|
+
def test_request_remote_ip
|
154
|
+
get '/'
|
155
|
+
assert_nil SBSM::RackInterface.last_session.remote_ip
|
156
|
+
header 'X_FORWARDED_FOR', '[212.51.146.241],[66.249.93.27]' # a HTTP_ will be prepended to it
|
157
|
+
get '/'
|
158
|
+
assert_equal '212.51.146.241', SBSM::RackInterface.last_session.remote_ip
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
145
162
|
class TestSession < Minitest::Test
|
146
163
|
include Rack::Test::Methods
|
147
164
|
def setup
|