fluent-plugin-groonga 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5947627fa2f465811a846d3cd3ced7a8ac367674
4
- data.tar.gz: cc846ea63eca88bdadbb9d5dceab7b806e36762d
3
+ metadata.gz: 0bc265b245e6b9c918bfdc1834791265151c8ba3
4
+ data.tar.gz: 0b6c197b73a5c68fa979390206f23dc32d43dc0c
5
5
  SHA512:
6
- metadata.gz: 386b7122fc93b2bba7f8fdfea1648ce66b7ad4e20929ad1ea7ea7fae0fd731d6168e6aac8c18567af14cfb621bbe1b95fe8d9903f11e7e2a78aaf53db18bf6a3
7
- data.tar.gz: f56bf5c5848837eca8cc8de484c8493aad1467a3655594963670118ca3dfa14aa6fa326927f3e557fdb58175982beac9a39fda56f263ca852fa7ddb8bc4e2e8a
6
+ metadata.gz: 14ad67248ed757b0c8c4536eafd4a50899b3a4e2d001d56b1793a0481d2ee41c1a4f21be3914fbbd68ea81d6a6e76fca8e8ea46d92aaff9ba759a651032fac15
7
+ data.tar.gz: 39b32665c9bb1a0442a08b1e03c03c89ddffaaedaa61582e15a1d164880fcc2504fbee61b9d987bcef8a4e8a390c21809b8ecb1ac97f3f3b28638a862bccd7d6
@@ -2,6 +2,14 @@
2
2
 
3
3
  # News
4
4
 
5
+ ## 1.1.4: 2016-09-28
6
+
7
+ ### Improvements
8
+
9
+ * Supported invalid request URL.
10
+ * Added error class to log.
11
+ * Added log on failing to connect to Groonga.
12
+
5
13
  ## 1.1.3: 2016-09-02
6
14
 
7
15
  ### Improvements
@@ -17,7 +17,7 @@
17
17
 
18
18
  Gem::Specification.new do |spec|
19
19
  spec.name = "fluent-plugin-groonga"
20
- spec.version = "1.1.3"
20
+ spec.version = "1.1.4"
21
21
  spec.authors = ["Kouhei Sutou"]
22
22
  spec.email = ["kou@clear-code.com"]
23
23
  spec.summary = "Fluentd plugin to store data into Groonga and implement Groonga replication system."
@@ -72,7 +72,7 @@ module Fluent
72
72
  end
73
73
 
74
74
  def on_read(data)
75
- @handler.write(data)
75
+ @handler.write_back(data)
76
76
  end
77
77
 
78
78
  def on_close
@@ -213,6 +213,10 @@ module Fluent
213
213
  def on_connect
214
214
  @repeater = @input.create_repeater(self)
215
215
  @repeater.on_connect_failed do
216
+ $log.error("[input][groonga][error] " +
217
+ "failed to connect to Groonga:",
218
+ :real_host => @input.real_host,
219
+ :real_port => @input.real_port)
216
220
  close
217
221
  end
218
222
  @request_handler = RequestHandler.new(@input, @repeater)
@@ -222,18 +226,24 @@ module Fluent
222
226
  def on_read(data)
223
227
  begin
224
228
  @request_handler << data
225
- rescue HTTP::Parser::Error
229
+ rescue HTTP::Parser::Error, URI::InvalidURIError
226
230
  $log.error("[input][groonga][error] " +
227
231
  "failed to parse HTTP request:",
228
- :error => $!.to_s)
232
+ :error => "#{$!.class}: #{$!}")
229
233
  $log.error_backtrace
230
- close
234
+ reply_error_response("400 Bad Request")
235
+ rescue
236
+ $log.error("[input][groonga][error] " +
237
+ "failed to handle HTTP request:",
238
+ :error => "#{$!.class}: #{$!}")
239
+ $log.error_backtrace
240
+ reply_error_response("500 Internal Server Error")
231
241
  end
232
242
  end
233
243
 
234
- def write(data)
244
+ def write_back(data)
235
245
  @response_handler << data
236
- super
246
+ write(data)
237
247
  end
238
248
 
239
249
  def on_response_complete(response)
@@ -261,6 +271,19 @@ module Fluent
261
271
  false
262
272
  end
263
273
  end
274
+
275
+ def reply_error_response(status)
276
+ write("HTTP1.1 #{status}\r\n")
277
+ write("Server: fluent-plugin-groonga\r\n")
278
+ write("Connection: close\r\n")
279
+ write("Content-Length: 0\r\n")
280
+ write("\r\n")
281
+ disable
282
+ @repeater.close
283
+ on_write_complete do
284
+ close
285
+ end
286
+ end
264
287
  end
265
288
 
266
289
  class RequestHandler
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-groonga
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-02 00:00:00.000000000 Z
11
+ date: 2016-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -193,9 +193,8 @@ summary: Fluentd plugin to store data into Groonga and implement Groonga replica
193
193
  system.
194
194
  test_files:
195
195
  - test/test_input.rb
196
- - test/run-test.rb
197
- - test/test_output.rb
196
+ - test/output/test_table_definition.rb
198
197
  - test/output/test_table_index_definition.rb
199
198
  - test/output/test_type_guesser.rb
200
- - test/output/test_table_definition.rb
201
- has_rdoc:
199
+ - test/run-test.rb
200
+ - test/test_output.rb