Class: Fluent::GroongaInput::HTTPInput::Handler
- Inherits:
-
Coolio::Socket
- Object
- Coolio::Socket
- Fluent::GroongaInput::HTTPInput::Handler
- Defined in:
- lib/fluent/plugin/in_groonga.rb
Instance Method Summary collapse
-
#initialize(socket, input) ⇒ Handler
constructor
A new instance of Handler.
- #on_body(chunk) ⇒ Object
- #on_connect ⇒ Object
- #on_headers_complete(headers) ⇒ Object
- #on_message_begin ⇒ Object
- #on_message_complete ⇒ Object
- #on_read(data) ⇒ Object
Constructor Details
#initialize(socket, input) ⇒ Handler
Returns a new instance of Handler.
179 180 181 182 |
# File 'lib/fluent/plugin/in_groonga.rb', line 179 def initialize(socket, input) super(socket) @input = input end |
Instance Method Details
#on_body(chunk) ⇒ Object
201 202 203 |
# File 'lib/fluent/plugin/in_groonga.rb', line 201 def on_body(chunk) @body << chunk end |
#on_connect ⇒ Object
184 185 186 187 |
# File 'lib/fluent/plugin/in_groonga.rb', line 184 def on_connect @parser = HTTP::Parser.new(self) @repeater = @input.create_repeater(self) end |
#on_headers_complete(headers) ⇒ Object
198 199 |
# File 'lib/fluent/plugin/in_groonga.rb', line 198 def on_headers_complete(headers) end |
#on_message_begin ⇒ Object
194 195 196 |
# File 'lib/fluent/plugin/in_groonga.rb', line 194 def @body = "" end |
#on_message_complete ⇒ Object
205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/fluent/plugin/in_groonga.rb', line 205 def uri = URI.parse(@parser.request_url) params = WEBrick::HTTPUtils.parse_query(uri.query) path_info = uri.path case path_info when /\A\/d\// command = $POSTMATCH if command == "load" params["values"] = @body unless @body.empty? end @input.emit(command, params) end end |
#on_read(data) ⇒ Object
189 190 191 192 |
# File 'lib/fluent/plugin/in_groonga.rb', line 189 def on_read(data) @parser << data @repeater.write(data) end |