From 7bb755306aa57000166582dc1e7f2dcc528038d0 Mon Sep 17 00:00:00 2001 From: Christian Menges Date: Sun, 4 Feb 2024 11:50:15 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Daijiro Fukuda --- lib/fluent/plugin/out_http.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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)