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 <[email protected]>
  • Loading branch information
Garfield96 and daipom committed Apr 30, 2024
1 parent fa5b183 commit fdf8914
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/fluent/plugin/out_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,23 +340,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 fdf8914

Please sign in to comment.