diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 04:35:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 04:35:54 +0000 |
commit | 17cfff2c246b479e4ec51c11cad4628049a5a9b3 (patch) | |
tree | bd43ae8b773f6c5eb8141b2f9a70252c13906e9f /lib/gitlab/http_connection_adapter.rb | |
parent | f07ef899392050329c1ed4de0ae8fd8480021d86 (diff) | |
download | gitlab-ce-17cfff2c246b479e4ec51c11cad4628049a5a9b3.tar.gz |
Add latest changes from gitlab-org/gitlab@15-11-stable-ee15-11-stable
Diffstat (limited to 'lib/gitlab/http_connection_adapter.rb')
-rw-r--r-- | lib/gitlab/http_connection_adapter.rb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/gitlab/http_connection_adapter.rb b/lib/gitlab/http_connection_adapter.rb index 2152f619228..afb740a902b 100644 --- a/lib/gitlab/http_connection_adapter.rb +++ b/lib/gitlab/http_connection_adapter.rb @@ -24,11 +24,18 @@ module Gitlab override :connection def connection - @uri, hostname = validate_url!(uri) + result = validate_url_with_proxy!(uri) + @uri = result.uri + hostname = result.hostname http = super http.hostname_override = hostname if hostname + unless result.use_proxy + http.proxy_from_env = false + http.proxy_address = nil + end + gitlab_http = Gitlab::NetHttpAdapter.new(http.address, http.port) http.instance_variables.each do |variable| @@ -40,12 +47,13 @@ module Gitlab private - def validate_url!(url) - Gitlab::UrlBlocker.validate!(url, allow_local_network: allow_local_requests?, - allow_localhost: allow_local_requests?, - allow_object_storage: allow_object_storage?, - dns_rebind_protection: dns_rebind_protection?, - schemes: %w[http https]) + def validate_url_with_proxy!(url) + Gitlab::UrlBlocker.validate_url_with_proxy!( + url, allow_local_network: allow_local_requests?, + allow_localhost: allow_local_requests?, + allow_object_storage: allow_object_storage?, + dns_rebind_protection: dns_rebind_protection?, + schemes: %w[http https]) rescue Gitlab::UrlBlocker::BlockedUrlError => e raise Gitlab::HTTP::BlockedUrlError, "URL is blocked: #{e.message}" end |