rack-www_form_encoding 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/www_form_encoding.rb +8 -3
- data/lib/rack/www_form_encoding/version.rb +1 -1
- data/rack-www_form_encoding.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec96895f42073bef7afea330e0a9bb2ba719db21
|
4
|
+
data.tar.gz: 6482f6061c259549fafa7dc416fe8d2441b454f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dd45715ac0f055fe1d005ab6c6062acea2154804685894668be4bbf5aa0651ca5b83e455ec7d2085ad589143819473a31da55f2c5f47e43f2204e664f476545
|
7
|
+
data.tar.gz: 492b0ebf671abf4f30df356623b05b2e160e75d9c026025ab6076d25ab5f65629aa9c1d06f9216ba4980a4d3509e403e97ffe99e923a1bae4e6ea39b74224623
|
@@ -11,8 +11,11 @@ module Rack
|
|
11
11
|
|
12
12
|
def call(env)
|
13
13
|
post_body = env['rack.input'].read
|
14
|
-
|
15
|
-
env['
|
14
|
+
|
15
|
+
unless env['CONTENT_TYPE'] && env['CONTENT_TYPE'].start_with?("multipart/form-data;")
|
16
|
+
converted = convert_form(post_body, @encoding)
|
17
|
+
env['rack.input'] = StringIO.new(converted)
|
18
|
+
end
|
16
19
|
|
17
20
|
env['QUERY_STRING'] = convert_form(env['QUERY_STRING'], @encoding)
|
18
21
|
|
@@ -22,10 +25,12 @@ module Rack
|
|
22
25
|
private
|
23
26
|
|
24
27
|
def convert_form(params_string, encoding)
|
25
|
-
return unless params_string
|
28
|
+
return params_string unless params_string
|
26
29
|
params = URI.decode_www_form(params_string, @encoding)
|
27
30
|
params.map!{|k,v| [k, encode(v)] }
|
28
31
|
URI.encode_www_form(params)
|
32
|
+
rescue ArgumentError => e # the input of decode_www_form must be ASCII only string
|
33
|
+
params_string
|
29
34
|
end
|
30
35
|
|
31
36
|
def encode(string)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-www_form_encoding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HORII Keima
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Encode from not UTF-8 www-form-urlencoded params to UTF-8 www-form-urlencoded
|
70
84
|
params
|
71
85
|
email:
|