Commit e77d6e1 1 parent a09e608 commit e77d6e1 Copy full SHA for e77d6e1
File tree 1 file changed +2
-3
lines changed
src/OpenTelemetry.Exporter.OpenTelemetryProtocol
1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -76,9 +76,7 @@ internal OtlpExporterOptions(
76
76
this . DefaultHttpClientFactory = ( ) =>
77
77
{
78
78
#if NET6_0_OR_GREATER
79
- // Create a new handler
80
79
var handler = new HttpClientHandler ( ) ;
81
- // Load certificates (including client & server certificates if configured)
82
80
HttpClient client = this . AddCertificatesToHttpClient ( handler ) ;
83
81
client . Timeout = TimeSpan . FromMilliseconds ( this . TimeoutMilliseconds ) ;
84
82
return client ;
@@ -257,6 +255,7 @@ internal OtlpExporterOptions ApplyDefaults(OtlpExporterOptions defaultExporterOp
257
255
return this ;
258
256
}
259
257
258
+ #if NET6_0_OR_GREATER
260
259
internal HttpClient AddCertificatesToHttpClient ( HttpClientHandler handler )
261
260
{
262
261
// Configure server certificate validation if CertificateFile is provided
@@ -281,14 +280,14 @@ internal HttpClient AddCertificatesToHttpClient(HttpClientHandler handler)
281
280
// Add client certificate if both files are provided
282
281
if ( ! string . IsNullOrEmpty ( this . ClientCertificateFile ) && ! string . IsNullOrEmpty ( this . ClientKeyFile ) )
283
282
{
284
- // Load the client certificate from PEM files
285
283
var clientCertificate = X509Certificate2 . CreateFromPemFile ( this . ClientCertificateFile , this . ClientKeyFile ) ;
286
284
handler . ClientCertificates . Add ( clientCertificate ) ;
287
285
}
288
286
289
287
// Create and return an HttpClient with the modified handler
290
288
return new HttpClient ( handler ) ;
291
289
}
290
+ #endif
292
291
293
292
private static string GetUserAgentString ( )
294
293
{
You can’t perform that action at this time.
0 commit comments