From 5625096185aab9c5fd05fe6b761306e87f46e00b Mon Sep 17 00:00:00 2001 From: Dex Date: Tue, 10 Oct 2017 15:05:30 -0700 Subject: [PATCH] Fixes #371 allow transparent proxy config in `Net::HTTP` via ENV["http_proxy"] --- lib/bugsnag/delivery/synchronous.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/bugsnag/delivery/synchronous.rb b/lib/bugsnag/delivery/synchronous.rb index f8d990fcf..bd60b96d5 100644 --- a/lib/bugsnag/delivery/synchronous.rb +++ b/lib/bugsnag/delivery/synchronous.rb @@ -24,7 +24,13 @@ def deliver(url, body, configuration) def request(url, body, configuration) uri = URI.parse(url) - http = Net::HTTP.new(uri.host, uri.port, configuration.proxy_host, configuration.proxy_port, configuration.proxy_user, configuration.proxy_password) + + if configuration.proxy_host + http = Net::HTTP.new(uri.host, uri.port, configuration.proxy_host, configuration.proxy_port, configuration.proxy_user, configuration.proxy_password) + else + http = Net::HTTP.new(uri.host, uri.port) + end + http.read_timeout = configuration.timeout http.open_timeout = configuration.timeout @@ -48,4 +54,4 @@ def path(uri) end end -Bugsnag::Delivery.register(:synchronous, Bugsnag::Delivery::Synchronous) \ No newline at end of file +Bugsnag::Delivery.register(:synchronous, Bugsnag::Delivery::Synchronous)