diff --git a/lib/fluent/plugin/out_http.rb b/lib/fluent/plugin/out_http.rb index 767f27ca55..611576f006 100644 --- a/lib/fluent/plugin/out_http.rb +++ b/lib/fluent/plugin/out_http.rb @@ -282,15 +282,11 @@ def make_request_cached(uri, req) @cache[id].conn.request(req) end - def make_request(uri, req) + def make_request(uri, req, &block) if @proxy_uri - Net::HTTP.start(uri.host, uri.port, @proxy_uri.host, @proxy_uri.port, @proxy_uri.user, @proxy_uri.password, @http_opt) { |http| - http.request(req) - } + Net::HTTP.start(uri.host, uri.port, @proxy_uri.host, @proxy_uri.port, @proxy_uri.user, @proxy_uri.password, @http_opt, &block) else - Net::HTTP.start(uri.host, uri.port, @http_opt) { |http| - http.request(req) - } + Net::HTTP.start(uri.host, uri.port, @http_opt, &block) end end @@ -298,7 +294,7 @@ def send_request(uri, req) res = if @reuse_connections make_request_cached(uri, req) else - make_request(uri, req) + make_request(uri, req) { |http| http.request(req) } end if res.is_a?(Net::HTTPSuccess)