diff --git a/.travis.yml b/.travis.yml index ce66cd82e2..742dd54b60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,8 @@ matrix: dist: xenial - rvm: 2.6.5 os: linux + - rvm: 2.7.0 + os: linux - rvm: ruby-head os: linux - rvm: ruby-head @@ -57,9 +59,6 @@ branches: - v0.12 - v0.14 -before_install: - - gem update --system=2.7.8 - sudo: false dist: trusty # for TLSv1.2 support diff --git a/fluentd.gemspec b/fluentd.gemspec index 2263821ff2..52ec2f4aaf 100644 --- a/fluentd.gemspec +++ b/fluentd.gemspec @@ -40,7 +40,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency("certstore_c", ["~> 0.1.2"]) end - gem.add_development_dependency("rake", ["~> 11.0"]) + gem.add_development_dependency("rake", ["~> 12.0"]) gem.add_development_dependency("flexmock", ["~> 2.0"]) gem.add_development_dependency("parallel_tests", ["~> 0.15.3"]) gem.add_development_dependency("simplecov", ["~> 0.7"]) diff --git a/lib/fluent/config/literal_parser.rb b/lib/fluent/config/literal_parser.rb index 3a798cb429..ce9307b3ce 100644 --- a/lib/fluent/config/literal_parser.rb +++ b/lib/fluent/config/literal_parser.rb @@ -19,7 +19,7 @@ require 'json' require 'yajl' require 'socket' -require 'irb/ruby-lex' # RubyLex +require 'ripper' require 'fluent/config/basic_parser' @@ -155,15 +155,20 @@ def scan_nonquoted_string(boundary_charset = LINE_END) end def scan_embedded_code - rlex = RubyLex.new - src = '"#{'+@ss.rest+"\n=end\n}" + src = '"#{'+@ss.rest+"\n=begin\n=end\n}" - input = StringIO.new(src) - input.define_singleton_method(:encoding) { external_encoding } - rlex.set_input(input) + seek = -1 + while (seek = src.index('}', seek + 1)) + unless Ripper.sexp(src[0..seek] + '"').nil? # eager parsing until valid expression + break + end + end + + unless seek + raise Fluent::ConfigParseError, @ss.rest + end - tk = rlex.token - code = src[3,tk.seek-3] + code = src[3, seek-3] if @ss.rest.length < code.length @ss.pos += @ss.rest.length diff --git a/lib/fluent/plugin/out_http.rb b/lib/fluent/plugin/out_http.rb index 4536fa3acd..8c225822ae 100644 --- a/lib/fluent/plugin/out_http.rb +++ b/lib/fluent/plugin/out_http.rb @@ -212,9 +212,9 @@ def send_request(uri, req) end if res.is_a?(Net::HTTPSuccess) - log.debug { "#{res.code} #{res.message}#{res.body}" } + log.debug { "#{res.code} #{res.message.rstrip}#{res.body.lstrip}" } else - msg = "#{res.code} #{res.message}#{res.body}" + msg = "#{res.code} #{res.message.rstrip} #{res.body.lstrip}" if @retryable_response_codes.include?(res.code.to_i) raise RetryableResponse, msg