rack-parser 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +2 -1
- data/lib/rack/parser.rb +2 -2
- data/rack-parser.gemspec +1 -1
- data/test/parser_test.rb +6 -0
- data/test/teststrap.rb +2 -0
- metadata +20 -33
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 669beb8cc96fc852dc771cd9c9a95639668c4e13
|
4
|
+
data.tar.gz: dc190ec4551249620a769cb0ee42a1157903f5c1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7c957776b51e2325400b40bc52ac23fe7c0f7b175ec6ca20aa89329b8a93a12c362414e885b8ee5a5c14bcbb49796f93b11441bb7ff75d7dd811e199eba88bc6
|
7
|
+
data.tar.gz: d46f6696f9e4b74a84cb0157c8a2bc4130682592a6774a97d1fb4cf696687a7175f9697c4ae4d7bae915ab0e208c3f99bb3bf3b28db673f8cdcdeab0ab6d4886
|
data/README.md
CHANGED
@@ -107,8 +107,9 @@ This project came to being because of:
|
|
107
107
|
* [Tom May](https://github.com/tommay) - skip loading post body unless content type is set.
|
108
108
|
* [Moonsik Kang](https://github.com/deepblue) - skip rack parser for content types that are not explicitly set.
|
109
109
|
* [Guillermo Iguaran](https://github.com/guilleiguaran) - Updating `multi_xml` version dependency for XML/YAML exploit
|
110
|
+
* [Doug Orleans](https://github.com/dougo) - Handle only post-body parsing errors and let upstream errors propogate downstream
|
110
111
|
|
111
112
|
## Copyright
|
112
113
|
|
113
|
-
Copyright © 2011 Arthur Chiu. See [MIT-LICENSE](https://github.com/achiu/rack-parser/blob/master/MIT-LICENSE) for details.
|
114
|
+
Copyright © 2011,2012,2013 Arthur Chiu. See [MIT-LICENSE](https://github.com/achiu/rack-parser/blob/master/MIT-LICENSE) for details.
|
114
115
|
|
data/lib/rack/parser.rb
CHANGED
@@ -69,12 +69,12 @@ module Rack
|
|
69
69
|
begin
|
70
70
|
result = @content_types[content_type].call(body)
|
71
71
|
env.update FORM_HASH => result, FORM_INPUT => env[POST_BODY]
|
72
|
-
@app.call env
|
73
72
|
rescue Exception => e
|
74
73
|
logger.warn "#{self.class} #{content_type} parsing error: #{e.to_s}" if respond_to? :logger # Send to logger if its there.
|
75
74
|
err = @error_responses[content_type] ? content_type : 'default'
|
76
|
-
@error_responses[err].call(e, content_type) # call the error responses
|
75
|
+
return @error_responses[err].call(e, content_type) # call the error responses
|
77
76
|
end
|
77
|
+
@app.call env
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
data/rack-parser.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "rack-parser"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.3.0"
|
7
7
|
s.authors = ["Arthur Chiu"]
|
8
8
|
s.email = ["mr.arthur.chiu@gmail.com"]
|
9
9
|
s.homepage = "https://www.github.com/achiu/rack-parser"
|
data/test/parser_test.rb
CHANGED
@@ -91,4 +91,10 @@ context "Rack::Parser" do
|
|
91
91
|
asserts(:body).equals({'foo' => 'bar'}.inspect)
|
92
92
|
end
|
93
93
|
|
94
|
+
context "for upstream errors" do
|
95
|
+
asserts('/error') do
|
96
|
+
post '/error', '{}', { 'CONTENT_TYPE' => 'application/json' }
|
97
|
+
end.raises(Exception, 'OOOPS!!')
|
98
|
+
end
|
99
|
+
|
94
100
|
end
|
data/test/teststrap.rb
CHANGED
metadata
CHANGED
@@ -1,110 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Arthur Chiu
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-05-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rack
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: multi_json
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: multi_xml
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 0.5.2
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 0.5.2
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: riot
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rack-test
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: json
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
description: Rack Middleware for parsing post body data for json, xml and various
|
@@ -126,28 +113,28 @@ files:
|
|
126
113
|
- test/teststrap.rb
|
127
114
|
homepage: https://www.github.com/achiu/rack-parser
|
128
115
|
licenses: []
|
116
|
+
metadata: {}
|
129
117
|
post_install_message:
|
130
118
|
rdoc_options: []
|
131
119
|
require_paths:
|
132
120
|
- lib
|
133
121
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
-
none: false
|
135
122
|
requirements:
|
136
|
-
- -
|
123
|
+
- - '>='
|
137
124
|
- !ruby/object:Gem::Version
|
138
125
|
version: '0'
|
139
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
127
|
requirements:
|
142
|
-
- -
|
128
|
+
- - '>='
|
143
129
|
- !ruby/object:Gem::Version
|
144
130
|
version: '0'
|
145
131
|
requirements: []
|
146
132
|
rubyforge_project: rack-parser
|
147
|
-
rubygems_version:
|
133
|
+
rubygems_version: 2.0.3
|
148
134
|
signing_key:
|
149
|
-
specification_version:
|
135
|
+
specification_version: 4
|
150
136
|
summary: Rack Middleware for parsing post body data
|
151
137
|
test_files:
|
152
138
|
- test/parser_test.rb
|
153
139
|
- test/teststrap.rb
|
140
|
+
has_rdoc:
|