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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d13fc52b2497aa40b442a235a51589361abfe55c
4
- data.tar.gz: 53861595d2c9c9608c818a18f9a9d716365feca1
3
+ metadata.gz: 3b19dd3ef21082440b913381f62d63a583824518
4
+ data.tar.gz: 6fe2b2f75c81e661b70b87fb00bd9a27196e1892
5
5
  SHA512:
6
- metadata.gz: e1bee036da587a96b5f140550c61d164f8af9ca3d12e1a8776fa99e6111455c7cab8f1c5db6e22de553a85a048c037fb63179bcf9e4c1a4c5b4fe4d10a0c8749
7
- data.tar.gz: d10d467d3aaf8579a80e99773a37236b6bd81ba6295be316ca67a018d2c3ed438e1dbc3b5d292d844a992dfae641ac33940287305c19d1e39cf6c55afd011173
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['rack.input'].read)
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']
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module RequestPolice
3
- VERSION = "0.0.3alpha"
3
+ VERSION = "0.0.4alpha"
4
4
  end
5
5
  end
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.3alpha
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-07 00:00:00.000000000 Z
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.5
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 /