зеркало из https://github.com/github/codeql.git
Use proxy for feed reachability check
This commit is contained in:
Родитель
50b7257e02
Коммит
cffb3e1717
|
@ -3,6 +3,7 @@ using System.Collections.Concurrent;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
@ -598,6 +599,17 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
|||
// we disable certificate validation.
|
||||
var handler = new HttpClientHandler();
|
||||
|
||||
var proxyHost = Environment.GetEnvironmentVariable("CODEQL_PROXY_HOST");
|
||||
var proxyPort = Environment.GetEnvironmentVariable("CODEQL_PROXY_PORT");
|
||||
if (!string.IsNullOrWhiteSpace(proxyHost) && !string.IsNullOrWhiteSpace(proxyPort))
|
||||
{
|
||||
var proxyAddress = new Uri($"http://{proxyHost}:{proxyPort}");
|
||||
handler.Proxy = new WebProxy(proxyAddress);
|
||||
handler.Proxy.Credentials = new NetworkCredential(Environment.GetEnvironmentVariable("CODEQL_PROXY_USER"), Environment.GetEnvironmentVariable("CODEQL_PROXY_PASSWORD"));
|
||||
|
||||
logger.LogInfo($"Using proxy at {proxyAddress}...");
|
||||
}
|
||||
|
||||
if (feed.DisableTlsCertificateValidation)
|
||||
{
|
||||
logger.LogInfo($"Disabling TLS certificate validation for '{feed}'...");
|
||||
|
|
Загрузка…
Ссылка в новой задаче