Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lib/fluent/plugin/in_monitor_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#

require 'json'
require 'cgi'

require 'fluent/config/types'
require 'fluent/plugin/input'
Expand Down Expand Up @@ -150,9 +149,7 @@ def build_object(opts)
def build_option(req)
qs = Hash.new { |_, _| [] }
# parse ?=query string
if req.query_string
qs.merge!(CGI.parse(req.query_string))
end
qs.merge!(req.query || {})

# if ?debug=1 is set, set :with_debug_info for get_monitor_info
# and :pretty_json for render_json_error
Expand Down
10 changes: 8 additions & 2 deletions lib/fluent/plugin_helper/http_server/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#

require 'cgi'
require 'uri'
require 'async/http/protocol'
require 'fluent/plugin_helper/http_server/methods'

Expand All @@ -35,7 +35,13 @@ def headers
end

def query
@query_string && CGI.parse(@query_string)
if @query_string
hash = Hash.new { |h, k| h[k] = [] }
# For compatibility with CGI.parse
URI.decode_www_form(@query_string).each_with_object(hash) do |(key, value), h|
h[key] << value
end
end
end

def body
Expand Down
1 change: 1 addition & 0 deletions test/plugin/test_in_monitor_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'fluent/config'
require 'fluent/event_router'
require 'fluent/supervisor'
require 'fluent/version'
require 'net/http'
require 'json'
require_relative '../test_plugin_classes'
Expand Down
Loading