Skip to content

Commit

Permalink
Temporarily disabling ServicePointManager usage
Browse files Browse the repository at this point in the history
  • Loading branch information
chynesNR committed Sep 16, 2024
1 parent cfa5adb commit c94a0e1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ public static IWebHost BuildWebHost(string[] args) =>
/// </summary>
private static void OverrideSslSettingsForMockNewRelic()
{
#if !NET9_0_OR_GREATER
ServicePointManager.ServerCertificateValidationCallback = delegate
{
//force trust on all certificates for simplicity
return true;
};
#endif
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ public static IWebHost BuildWebHost(string[] args) =>
/// </summary>
private static void OverrideSslSettingsForMockNewRelic()
{
#if !NET9_0_OR_GREATER
ServicePointManager.ServerCertificateValidationCallback = delegate
{
//force trust on all certificates for simplicity
return true;
};
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public void ThrowException()
[HttpGet]
public async Task<ActionResult> SimulateLostTransaction()
{
#if !NET9_0_OR_GREATER
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
#endif

using (var client = new HttpClient())
{
Expand Down Expand Up @@ -99,7 +101,9 @@ public async Task<string> HttpClient()
[HttpGet]
public async Task<string> HttpClientTaskCancelled()
{
#if !NET9_0_OR_GREATER
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
#endif

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ protected void Application_BeginRequest(object sender, EventArgs e)
/// </summary>
private static void OverrideSslSettingsForMockNewRelic()
{
#if !NET9_0_OR_GREATER
ServicePointManager.ServerCertificateValidationCallback = delegate
{
//force trust on all certificates for simplicity
return true;
};
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ class Program

static void Main(string[] args)
{
#if !NET9_0_OR_GREATER
ServicePointManager.ServerCertificateValidationCallback = delegate
{
//force trust on all certificates for simplicity
return true;
};

#endif
_applicationName =
Path.GetFileNameWithoutExtension(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath) + ".exe";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ public MockNewRelicFixture(RemoteApplication remoteApplication) : base(remoteApp
MockNewRelicApplication.CopyToRemote();
MockNewRelicApplication.Start(string.Empty, environmentVariables, doProfile: false);
#if !NET9_0_OR_GREATER
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
ServicePointManager.ServerCertificateValidationCallback = delegate
{
//force trust on all certificates for simplicity
return true;
};
#endif
//Core apps need the collector warmed up before the core app is started so we cannot
//wait until exerciseApplication is called to call these methods
WarmUpCollector();
Expand Down

0 comments on commit c94a0e1

Please sign in to comment.