web-connect 0.4.12 → 0.4.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/netfira/web_connect/request_filter.rb +29 -8
- data/lib/netfira/web_connect/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52cd6dd3ae425d48864e984ed72dd41b35ef1f4a
|
4
|
+
data.tar.gz: ec3b4953d6f45e8be6074fb603145da6e78ba2a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e455749ad8bb95f79ebd8947eb3f4d02572ad7bfad0009cb5a40b042de0aa9791d9414536941fe9648c09fc6c8d4cde9c9d61974d7f50d8515612bd51f22f98e
|
7
|
+
data.tar.gz: 6c8036b621934fb75db6ba1d082d8f370fb00e6d3c11039bdea5c86e0d91e8a721b4932ab8a860f6a5ad3c1b386f8094a311ac892ac2ceeb03a275bcb550d1c0
|
@@ -9,21 +9,42 @@ module Netfira::WebConnect
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(env)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
begin
|
13
|
+
if (env['CONTENT_TYPE'] || env['HTTP_CONTENT_TYPE']) == 'application/x-netfira-webconnect-packed'
|
14
|
+
begin
|
15
|
+
unpack env
|
16
|
+
rescue Zlib::GzipFile::Error, Zlib::DataError => e
|
17
|
+
return [400, {}, {errorCode: 19, errorMessage: "Decompression error: #{e.message}"}]
|
18
|
+
end
|
17
19
|
end
|
20
|
+
env['WC_ACCEPTABLE_REQUEST_TYPES'] = %w[packed unpacked]
|
21
|
+
@app.call env
|
22
|
+
rescue Exception => error
|
23
|
+
# TODO: this mirrors code in rack_app.rb. Consolidate?
|
24
|
+
[
|
25
|
+
500,
|
26
|
+
{'Content-Type' => 'application/json'},
|
27
|
+
{
|
28
|
+
errorCode: 1,
|
29
|
+
errorMessage: 'Uncaught Exception',
|
30
|
+
exception: {
|
31
|
+
class: error.class.name,
|
32
|
+
message: error.message,
|
33
|
+
backtrace: error.backtrace
|
34
|
+
}
|
35
|
+
}
|
36
|
+
]
|
18
37
|
end
|
19
|
-
env['WC_ACCEPTABLE_REQUEST_TYPES'] = %w[packed unpacked]
|
20
|
-
@app.call env
|
21
38
|
end
|
22
39
|
|
23
40
|
def unpack(env)
|
24
41
|
env['original.rack.input'] = input = env['rack.input']
|
25
42
|
|
26
|
-
input =
|
43
|
+
input = case env['CONTENT_ENCODING'] || env['HTTP_CONTENT_ENCODING']
|
44
|
+
when 'gzip' then Zlib::GzipReader.new(input)
|
45
|
+
when 'deflate' then StringIO.new(Zlib::Inflate.inflate input.read)
|
46
|
+
else input
|
47
|
+
end
|
27
48
|
|
28
49
|
method, path, query_string, headers, body = parse_request(input)
|
29
50
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil E. Pearson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-09-
|
12
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|