fluent-plugin-http-ex 0.0.2 → 0.0.3

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 381930bb5a6ff262ddd7571c9215a3cc10b23042
4
+ data.tar.gz: 919056fbf480696d77fbb97ae9cd33e2c5bc53e0
5
+ SHA512:
6
+ metadata.gz: 08826a856199a2005c950712cbf5a3529fa36f17c83641c4d3906c8211826a3a5649dd7ac2a1cbf79d81715ec08f6097621ec280145e9f45c4c83e8187a7189b
7
+ data.tar.gz: 8b87217718f5701c8841b26fe0f9baf6cc6005ae822404a8fdfdd80cad6fac881e9c70675db3e51cbbfa30e06bc8a86867be8abeacec5e2aebec5f8ba1ecc5e1
data/Gemfile CHANGED
@@ -4,4 +4,5 @@ gem "fluentd"
4
4
 
5
5
  group :test do
6
6
  gem "nio4r"
7
+ gem "test-unit"
7
8
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-http-ex"
7
- spec.version = "0.0.2"
7
+ spec.version = "0.0.3"
8
8
  spec.authors = ["hiro-su"]
9
9
  spec.email = ["h.sugipon@gmail.com"]
10
10
  spec.description = %q{fluent plugin to accept multiple json/msgpack events in HTTP request}
@@ -16,7 +16,6 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.add_development_dependency "fluentd"
20
- spec.add_development_dependency "rake"
21
- spec.add_runtime_dependency "fluentd"
19
+ spec.add_runtime_dependency "fluentd", "~> 0.12.0"
20
+ spec.add_development_dependency "rake", "~> 0.9.2"
22
21
  end
@@ -46,7 +46,9 @@ class ExHttpInput < HttpInput
46
46
  detach_multi_process do
47
47
  Input.new.start
48
48
  @km = KeepaliveManager.new(@keepalive_timeout)
49
- @lsock = Coolio::TCPServer.new(lsock, nil, ExHandler, @km, method(:on_request), @body_size_limit, $log)
49
+ @lsock = Coolio::TCPServer.new(lsock, nil, ExHandler, @km, method(:on_request),
50
+ @body_size_limit, nil, $log,
51
+ @cors_allow_origins)
50
52
 
51
53
  @loop = Coolio::Loop.new
52
54
  @loop.attach(@km)
@@ -182,8 +184,8 @@ class ExHttpInput < HttpInput
182
184
  end
183
185
 
184
186
  def on_read_msgpack(data)
185
- params = WEBrick::HTTPUtils.parse_query(@parser.query_string)
186
- path_info = @parser.request_path
187
+ path_info, query_string = @parser.request_url.split("?", 2)
188
+ params = WEBrick::HTTPUtils.parse_query(query_string)
187
189
  @u.feed_each(data) do |obj|
188
190
  params["chunked"] = obj
189
191
  params["REMOTE_ADDR"] = @remote_addr
@@ -198,10 +200,21 @@ class ExHttpInput < HttpInput
198
200
  def on_message_complete
199
201
  return if closing?
200
202
 
203
+ # CORS check
204
+ # ==========
205
+ # For every incoming request, we check if we have some CORS
206
+ # restrictions and white listed origins through @cors_allow_origins.
207
+ unless @cors_allow_origins.nil?
208
+ unless @cors_allow_origins.include?(@origin)
209
+ send_response_and_close("403 Forbidden", {'Connection' => 'close'}, "")
210
+ return
211
+ end
212
+ end
213
+
201
214
  @env['REMOTE_ADDR'] = @remote_addr
202
215
 
203
- params = WEBrick::HTTPUtils.parse_query(@parser.query_string)
204
- path_info = @parser.request_path
216
+ path_info, query_string = @parser.request_url.split("?", 2)
217
+ params = WEBrick::HTTPUtils.parse_query(query_string)
205
218
 
206
219
  params = check_content_type(params, @content_type, @body, path_info)
207
220
  params.merge!(@env)
metadata CHANGED
@@ -1,64 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-http-ex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - hiro-su
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-20 00:00:00.000000000 Z
11
+ date: 2015-04-16 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: fluentd
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
19
+ version: 0.12.0
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
- version: '0'
26
+ version: 0.12.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: '0'
33
+ version: 0.9.2
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: fluentd
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
37
  requirements:
59
- - - ! '>='
38
+ - - "~>"
60
39
  - !ruby/object:Gem::Version
61
- version: '0'
40
+ version: 0.9.2
62
41
  description: fluent plugin to accept multiple json/msgpack events in HTTP request
63
42
  email:
64
43
  - h.sugipon@gmail.com
@@ -66,7 +45,7 @@ executables: []
66
45
  extensions: []
67
46
  extra_rdoc_files: []
68
47
  files:
69
- - .gitignore
48
+ - ".gitignore"
70
49
  - Gemfile
71
50
  - LICENSE.txt
72
51
  - README.md
@@ -85,29 +64,29 @@ files:
85
64
  - test/plugin/test_in_http_ex.rb
86
65
  homepage: https://github.com/hiro-su/fluent-plugin-http-ex
87
66
  licenses: []
67
+ metadata: {}
88
68
  post_install_message:
89
69
  rdoc_options: []
90
70
  require_paths:
91
71
  - lib
92
72
  required_ruby_version: !ruby/object:Gem::Requirement
93
- none: false
94
73
  requirements:
95
- - - ! '>='
74
+ - - ">="
96
75
  - !ruby/object:Gem::Version
97
76
  version: '0'
98
77
  required_rubygems_version: !ruby/object:Gem::Requirement
99
- none: false
100
78
  requirements:
101
- - - ! '>='
79
+ - - ">="
102
80
  - !ruby/object:Gem::Version
103
81
  version: '0'
104
82
  requirements: []
105
83
  rubyforge_project:
106
- rubygems_version: 1.8.23
84
+ rubygems_version: 2.4.5
107
85
  signing_key:
108
- specification_version: 3
86
+ specification_version: 4
109
87
  summary: fluent plugin to accept multiple json/msgpack events in HTTP request
110
88
  test_files:
111
89
  - test/helper.rb
112
90
  - test/in_http_ex_test.rb
113
91
  - test/plugin/test_in_http_ex.rb
92
+ has_rdoc: