carnivore-http 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +4 -0
- data/lib/carnivore-http/http.rb +14 -8
- data/lib/carnivore-http/http_endpoints.rb +2 -0
- data/lib/carnivore-http/point_builder.rb +0 -1
- data/lib/carnivore-http/utils.rb +1 -1
- data/lib/carnivore-http/version.rb +2 -5
- metadata +24 -32
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 254e80996f94e8fb440fd9e685205764dc4c1d6d
|
4
|
+
data.tar.gz: 56d1e0aab6e50decb27265752c90cb7490daf033
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 92ef01935a6852996c57cb73b290d67d9ecae93f0b4cff4b96cbc98e6fc25ef2fc31e57ba4c168eb89889055a2615784ef7a4bbfa909f226d7b24e1364593cce
|
7
|
+
data.tar.gz: 0e1e6bea0f6e36e5d305c720aaf83add3c420c61fd6bd6b3b460835096f7b4bf211160ff6a380e76f54f3b8bdea00a120f5b4f8a2696b76293dd1030981f456b
|
data/CHANGELOG.md
CHANGED
data/lib/carnivore-http/http.rb
CHANGED
@@ -111,18 +111,24 @@ module Carnivore
|
|
111
111
|
def build_message(con, req)
|
112
112
|
msg = Smash.new(
|
113
113
|
:request => req,
|
114
|
-
:headers =>
|
114
|
+
:headers => Smash[
|
115
|
+
req.headers.map{ |k,v| [k.downcase.tr('-', '_'), v]}
|
116
|
+
],
|
115
117
|
:connection => con,
|
116
118
|
:query => parse_query_string(req.query_string)
|
117
119
|
)
|
118
|
-
if(
|
119
|
-
msg[:
|
120
|
-
|
121
|
-
req.body.to_s
|
122
|
-
)
|
120
|
+
if(msg[:headers][:content_type] == 'application/json')
|
121
|
+
msg[:body] = MultiJson.load(
|
122
|
+
req.body.to_s
|
123
123
|
)
|
124
|
-
|
125
|
-
|
124
|
+
elsif(msg[:headers][:content_type] == 'application/x-www-form-urlencoded')
|
125
|
+
msg[:body] = parse_query_string(
|
126
|
+
req.body.to_s
|
127
|
+
)
|
128
|
+
if(msg[:body].size == 1 && msg[:body].values.first.is_a?(Array) && msg[:body].values.first.empty?)
|
129
|
+
msg[:body] = msg[:body].keys.first
|
130
|
+
end
|
131
|
+
elsif(msg[:headers][:content_length].to_i > BODY_TO_FILE_SIZE)
|
126
132
|
msg[:body] = Tempfile.new('carnivore-http')
|
127
133
|
while((chunk = req.body.readpartial(2048)))
|
128
134
|
msg[:body] << chunk
|
@@ -78,6 +78,7 @@ module Carnivore
|
|
78
78
|
|
79
79
|
# Start processing
|
80
80
|
def connect
|
81
|
+
info 'Override initialization process startup. Force enabling processing.'
|
81
82
|
async.process
|
82
83
|
end
|
83
84
|
|
@@ -88,6 +89,7 @@ module Carnivore
|
|
88
89
|
begin
|
89
90
|
msg = build_message(con, req)
|
90
91
|
unless(@points.deliver(msg))
|
92
|
+
warn "No match found for request: #{msg}"
|
91
93
|
req.respond(:ok, 'So long, and thanks for all the fish!')
|
92
94
|
end
|
93
95
|
rescue => e
|
data/lib/carnivore-http/utils.rb
CHANGED
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carnivore-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Chris Roberts
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: carnivore
|
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.1.8
|
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.1.8
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: reel
|
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.5.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.5.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: blockenspiel
|
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'
|
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'
|
62
55
|
description: Carnivore HTTP source
|
@@ -65,45 +58,44 @@ executables: []
|
|
65
58
|
extensions: []
|
66
59
|
extra_rdoc_files: []
|
67
60
|
files:
|
68
|
-
-
|
69
|
-
-
|
61
|
+
- CHANGELOG.md
|
62
|
+
- CONTRIBUTING.md
|
63
|
+
- Gemfile
|
64
|
+
- Gemfile.lock
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- carnivore-http.gemspec
|
68
|
+
- lib/carnivore-http.rb
|
70
69
|
- lib/carnivore-http/http.rb
|
71
|
-
- lib/carnivore-http/utils.rb
|
72
70
|
- lib/carnivore-http/http_endpoints.rb
|
73
|
-
- lib/carnivore-http.rb
|
71
|
+
- lib/carnivore-http/point_builder.rb
|
72
|
+
- lib/carnivore-http/utils.rb
|
73
|
+
- lib/carnivore-http/version.rb
|
74
74
|
- test/spec.rb
|
75
75
|
- test/specs/http.rb
|
76
|
-
- Gemfile
|
77
|
-
- README.md
|
78
|
-
- LICENSE
|
79
|
-
- carnivore-http.gemspec
|
80
|
-
- CHANGELOG.md
|
81
|
-
- CONTRIBUTING.md
|
82
|
-
- Gemfile.lock
|
83
76
|
homepage: https://github.com/carnivore-rb/carnivore-http
|
84
77
|
licenses:
|
85
78
|
- Apache 2.0
|
79
|
+
metadata: {}
|
86
80
|
post_install_message:
|
87
81
|
rdoc_options: []
|
88
82
|
require_paths:
|
89
83
|
- lib
|
90
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
85
|
requirements:
|
93
|
-
- -
|
86
|
+
- - ">="
|
94
87
|
- !ruby/object:Gem::Version
|
95
88
|
version: '0'
|
96
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
90
|
requirements:
|
99
|
-
- -
|
91
|
+
- - ">="
|
100
92
|
- !ruby/object:Gem::Version
|
101
93
|
version: '0'
|
102
94
|
requirements: []
|
103
95
|
rubyforge_project:
|
104
|
-
rubygems_version:
|
96
|
+
rubygems_version: 2.2.2
|
105
97
|
signing_key:
|
106
|
-
specification_version:
|
98
|
+
specification_version: 4
|
107
99
|
summary: Message processing helper
|
108
100
|
test_files: []
|
109
101
|
has_rdoc:
|