Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Daijiro Fukuda <fukuda@clear-code.com>
  • Loading branch information
Garfield96 and daipom committed Feb 4, 2024
1 parent 87135fc commit 7bb7553
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/fluent/plugin/out_http.rb
Expand Up @@ -282,23 +282,19 @@ 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

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)
Expand Down

0 comments on commit 7bb7553

Please sign in to comment.