[Groonga-commit] groonga/fluent-plugin-groonga at 2098874 [master] Return error response instead of empty for invalid URI

Back to archive index

Masafumi Yokoyama null+****@clear*****
Tue Sep 27 18:55:26 JST 2016


Masafumi Yokoyama	2016-09-27 18:55:26 +0900 (Tue, 27 Sep 2016)

  New Revision: 20988747747eab37557e7273442f8bacff509317
  https://github.com/groonga/fluent-plugin-groonga/commit/20988747747eab37557e7273442f8bacff509317

  Merged 0163dec: Merge pull request #7 from groonga/return-error-response-for-invalid-uri

  Message:
    Return error response instead of empty for invalid URI

  Modified files:
    lib/fluent/plugin/in_groonga.rb

  Modified: lib/fluent/plugin/in_groonga.rb (+12 -4)
===================================================================
--- lib/fluent/plugin/in_groonga.rb    2016-09-27 17:05:32 +0900 (6163962)
+++ lib/fluent/plugin/in_groonga.rb    2016-09-27 18:55:26 +0900 (ade1efb)
@@ -72,7 +72,7 @@ module Fluent
       end
 
       def on_read(data)
-        @handler.write(data)
+        @handler.write_back(data)
       end
 
       def on_close
@@ -227,13 +227,21 @@ module Fluent
                        "failed to parse HTTP request:",
                        :error => $!.to_s)
             $log.error_backtrace
-            close
+            write("HTTP1.1 400 Bad Request\r\n")
+            write("Server: fluent-plugin-groonga\r\n")
+            write("Connection: close\r\n")
+            write("Content-Length: 0\r\n")
+            write("\r\n")
+            disable
+            on_write_complete do
+              close
+            end
           end
         end
 
-        def write(data)
+        def write_back(data)
           @response_handler << data
-          super
+          write(data)
         end
 
         def on_response_complete(response)
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index