From dca702a599df033acd114e1d3eea52b2c82f4001 Mon Sep 17 00:00:00 2001
From: NLR <nilsleroux@gmail.com>
Date: Fri, 1 Jun 2018 14:32:10 +0000
Subject: [PATCH] Make http_io honor HTTP(S)_PROXY environment.

---
 changelogs/unreleased/fix-http-proxy.yml | 5 +++++
 lib/gitlab/ci/trace/http_io.rb           | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
 create mode 100644 changelogs/unreleased/fix-http-proxy.yml

diff --git a/changelogs/unreleased/fix-http-proxy.yml b/changelogs/unreleased/fix-http-proxy.yml
new file mode 100644
index 0000000000000..806b7d0a38c63
--- /dev/null
+++ b/changelogs/unreleased/fix-http-proxy.yml
@@ -0,0 +1,5 @@
+---
+title: Fixed HTTP_PROXY environment not honored when reading remote traces.
+merge_request: 19282
+author: NLR
+type: fixed
diff --git a/lib/gitlab/ci/trace/http_io.rb b/lib/gitlab/ci/trace/http_io.rb
index cff924e27ef30..8788af57a678c 100644
--- a/lib/gitlab/ci/trace/http_io.rb
+++ b/lib/gitlab/ci/trace/http_io.rb
@@ -148,7 +148,7 @@ def in_range?
 
         def get_chunk
           unless in_range?
-            response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
+            response = Net::HTTP.start(uri.hostname, uri.port, proxy_from_env: true, use_ssl: uri.scheme == 'https') do |http|
               http.request(request)
             end
 
-- 
GitLab