rack-request_police 0.0.3alpha → 0.0.4alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/request_police/middleware.rb +7 -1
- data/lib/rack/request_police/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b19dd3ef21082440b913381f62d63a583824518
|
4
|
+
data.tar.gz: 6fe2b2f75c81e661b70b87fb00bd9a27196e1892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 033dd061cbb11b0f89575066515d53401dc8b52e999414f1fd1e8b202f37b0ad5ff91033f5ea993a1873dd41ae7eb08bf0119ef0efeeab878c6ea4aee4f67ba0
|
7
|
+
data.tar.gz: 6d9d3df6d4e7823642340d830ad157278fd08280cafb9fd285365e9e6433766534f800877663c8aa9620e222083bb93d44190ef328edf0624f921b65ffe47b5d
|
@@ -23,7 +23,7 @@ module Rack
|
|
23
23
|
}
|
24
24
|
|
25
25
|
if %w(POST PATCH DELETE).include?(env['REQUEST_METHOD'])
|
26
|
-
request_params.merge!('data' => env
|
26
|
+
request_params.merge!('data' => utf8_input(env))
|
27
27
|
end
|
28
28
|
::Rack::RequestPolice.storage.log_request(request_params)
|
29
29
|
end
|
@@ -34,6 +34,12 @@ module Rack
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
+
def utf8_input(env)
|
38
|
+
env['rack.input'].read
|
39
|
+
.force_encoding('utf-8')
|
40
|
+
.encode('utf-8', 'utf-8', invalid: :replace, replace: '')
|
41
|
+
end
|
42
|
+
|
37
43
|
def ip_address(env)
|
38
44
|
if !env['HTTP_X_FORWARDED_FOR'] || env['HTTP_X_FORWARDED_FOR'].empty?
|
39
45
|
env['REMOTE_ADDR']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-request_police
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafał Wojsznis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
200
|
version: 1.3.1
|
201
201
|
requirements: []
|
202
202
|
rubyforge_project:
|
203
|
-
rubygems_version: 2.4.
|
203
|
+
rubygems_version: 2.4.3
|
204
204
|
signing_key:
|
205
205
|
specification_version: 4
|
206
206
|
summary: Rack middleware for logging selected request for further investigation /
|