lib/fluent/plugin/in_http.rb in fluentd-0.10.45 vs lib/fluent/plugin/in_http.rb in fluentd-0.10.46
- old
+ new
@@ -23,10 +23,11 @@
require 'http/parser'
def initialize
require 'webrick/httputils'
+ require 'uri'
super
end
config_param :port, :integer, :default => 9880
config_param :bind, :string, :default => '0.0.0.0'
@@ -244,20 +245,21 @@
def on_message_complete
return if closing?
@env['REMOTE_ADDR'] = @remote_addr if @remote_addr
- params = WEBrick::HTTPUtils.parse_query(@parser.query_string)
+ uri = URI.parse(@parser.request_url)
+ params = WEBrick::HTTPUtils.parse_query(uri.query)
if @content_type =~ /^application\/x-www-form-urlencoded/
params.update WEBrick::HTTPUtils.parse_query(@body)
elsif @content_type =~ /^multipart\/form-data; boundary=(.+)/
boundary = WEBrick::HTTPUtils.dequote($1)
params.update WEBrick::HTTPUtils.parse_form_data(@body, boundary)
elsif @content_type =~ /^application\/json/
params['json'] = @body
end
- path_info = @parser.request_path
+ path_info = uri.path
params.merge!(@env)
@env.clear
code, header, body = *@callback.call(path_info, params)