firebug 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/action_dispatch/session/code_igniter_store.rb +13 -4
- data/lib/firebug/configuration.rb +2 -2
- data/lib/firebug/session.rb +1 -1
- data/lib/firebug/version.rb +1 -1
- 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: 5bf90b694d5688ace43fb531d31216567031e06e
|
4
|
+
data.tar.gz: f288b37697c98a382964584e7615851541aa085e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7b1d536b012704b0fec305424c05f81426494023f064816941f056f9553a125f4f3050a28aef1d979fe36784739a5a0b00a6c801b7b9b1d9fc751d528659b4f
|
7
|
+
data.tar.gz: afb6a295079c61ee39530b773711227c90e1422e8fc8b9d1e55f2ce494a3c2d0c985c38e63c5e2b7e479bed11f7b163ccef29f92ab23325f246977ec6f8adc7a
|
data/Gemfile.lock
CHANGED
@@ -76,10 +76,7 @@ module ActionDispatch
|
|
76
76
|
# @return [Firebug::Session]
|
77
77
|
def find_session_model(req, sid=nil)
|
78
78
|
if sid
|
79
|
-
|
80
|
-
p[:user_agent] = req.user_agent if Firebug.configuration.match_user_agent
|
81
|
-
p[:ip_address] = req.remote_ip if Firebug.configuration.match_ip_address
|
82
|
-
model = Firebug::Session.find_by(p)
|
79
|
+
model = Firebug::Session.find_by(find_by_params(req, sid))
|
83
80
|
return model if model
|
84
81
|
# use a different session ID in case the reason for not finding the record is because the user_agent
|
85
82
|
# or ip_address didn't match.
|
@@ -93,6 +90,18 @@ module ActionDispatch
|
|
93
90
|
ip_address: req.remote_ip
|
94
91
|
)
|
95
92
|
end
|
93
|
+
|
94
|
+
# @param [ActionDispatch::Request] req
|
95
|
+
# @param [String] sid
|
96
|
+
# @return [Hash]
|
97
|
+
def find_by_params(req, sid)
|
98
|
+
params = { session_id: sid }
|
99
|
+
params[:ip_address] = req.remote_ip if Firebug.configuration.match_ip_address
|
100
|
+
if Firebug.configuration.match_user_agent
|
101
|
+
params[:user_agent] = Firebug.configuration.truncate_user_agent ? req.user_agent[0...120] : req.user_agent
|
102
|
+
end
|
103
|
+
params
|
104
|
+
end
|
96
105
|
end
|
97
106
|
end
|
98
107
|
end
|
@@ -5,14 +5,14 @@ module Firebug
|
|
5
5
|
#
|
6
6
|
# @attr [String] key the encryption key used to encrypt and decrypt cookies.
|
7
7
|
# @attr [String] table_name the name of the sessions table.
|
8
|
-
# @attr [Boolean]
|
8
|
+
# @attr [Boolean] truncate_user_agent truncate the user-agent to 120 characters.
|
9
9
|
# @attr [Boolean] match_user_agent use the user-agent in addition to the session ID.
|
10
10
|
# @attr [Boolean] match_ip_address use the remote ip address in addition to the session ID.
|
11
11
|
class Configuration
|
12
12
|
attr_reader :table_name
|
13
13
|
|
14
14
|
attr_accessor :key
|
15
|
-
attr_accessor :
|
15
|
+
attr_accessor :truncate_user_agent
|
16
16
|
attr_accessor :match_user_agent
|
17
17
|
attr_accessor :match_ip_address
|
18
18
|
|
data/lib/firebug/session.rb
CHANGED
@@ -21,7 +21,7 @@ module Firebug
|
|
21
21
|
def user_agent=(value)
|
22
22
|
# Pyro seems to truncate the value and since it also uses this value when finding the session, it's important
|
23
23
|
# we do the same.
|
24
|
-
super(Firebug.configuration.
|
24
|
+
super(Firebug.configuration.truncate_user_agent ? value[0...120] : value)
|
25
25
|
end
|
26
26
|
|
27
27
|
# @return [String]
|
data/lib/firebug/version.rb
CHANGED