diff --git a/CHANGELOG.md b/CHANGELOG.md index 878895b1..04f5b291 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## Version 2.7.0 +- [Remove unused reference to System.Net.Http](https://github.com/microsoft/ApplicationInsights-aspnetcore/pull/879) + ## Version 2.7.0-beta4 - [RequestTrackingTelemetryModule is modified to stop tracking exceptions by default, as exceptions are captured by ApplicationInsightsLoggerProvider.](https://github.com/Microsoft/ApplicationInsights-aspnetcore/issues/861) - Updated Web/Base SDK version dependency to 2.10.0-beta4 diff --git a/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HostingDiagnosticListener.cs b/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HostingDiagnosticListener.cs index 9bb00959..d080a877 100644 --- a/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HostingDiagnosticListener.cs +++ b/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HostingDiagnosticListener.cs @@ -5,7 +5,6 @@ using System.Diagnostics; using System.Globalization; using System.Linq; - using System.Net.Http.Headers; using System.Text; using Extensibility.Implementation.Tracing; using Microsoft.ApplicationInsights.AspNetCore.DiagnosticListeners.Implementation; @@ -550,10 +549,11 @@ private void ReadCorrelationContext(IHeaderDictionary requestHeaders, Activity a { foreach (var item in baggage) { - if (NameValueHeaderValue.TryParse(item, out var baggageItem)) + var parts = item.Split('='); + if (parts.Length == 2) { - var itemName = StringUtilities.EnforceMaxLength(baggageItem.Name, InjectionGuardConstants.ContextHeaderKeyMaxLength); - var itemValue = StringUtilities.EnforceMaxLength(baggageItem.Value, InjectionGuardConstants.ContextHeaderValueMaxLength); + var itemName = StringUtilities.EnforceMaxLength(parts[0], InjectionGuardConstants.ContextHeaderKeyMaxLength); + var itemValue = StringUtilities.EnforceMaxLength(parts[1], InjectionGuardConstants.ContextHeaderValueMaxLength); activity.AddBaggage(itemName, itemValue); } } diff --git a/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HttpHeadersUtilities.cs b/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HttpHeadersUtilities.cs index d1002896..2fa55332 100644 --- a/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HttpHeadersUtilities.cs +++ b/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HttpHeadersUtilities.cs @@ -9,16 +9,6 @@ namespace Microsoft.ApplicationInsights.AspNetCore.DiagnosticListeners internal static class HttpHeadersUtilities { - internal static IEnumerable GetHeaderValues(HttpHeaders headers, string headerName) - { - IEnumerable result; - if (headers == null || !headers.TryGetValues(headerName, out result)) - { - result = Enumerable.Empty(); - } - return result; - } - internal static IEnumerable GetHeaderValues(IHeaderDictionary headers, string headerName) { IEnumerable result = Enumerable.Empty(); @@ -33,33 +23,17 @@ internal static IEnumerable GetHeaderValues(IHeaderDictionary headers, s return result; } - internal static string GetHeaderKeyValue(HttpHeaders headers, string headerName, string keyName) - { - IEnumerable headerValues = GetHeaderValues(headers, headerName); - return HeadersUtilities.GetHeaderKeyValue(headerValues, keyName); - } - internal static string GetHeaderKeyValue(IHeaderDictionary headers, string headerName, string keyName) { IEnumerable headerValues = GetHeaderValues(headers, headerName); return HeadersUtilities.GetHeaderKeyValue(headerValues, keyName); } - internal static string GetRequestContextKeyValue(HttpHeaders headers, string keyName) - { - return GetHeaderKeyValue(headers, RequestResponseHeaders.RequestContextHeader, keyName); - } - internal static string GetRequestContextKeyValue(IHeaderDictionary headers, string keyName) { return GetHeaderKeyValue(headers, RequestResponseHeaders.RequestContextHeader, keyName); } - internal static bool ContainsRequestContextKeyValue(HttpHeaders headers, string keyName) - { - return !string.IsNullOrEmpty(GetHeaderKeyValue(headers, RequestResponseHeaders.RequestContextHeader, keyName)); - } - internal static bool ContainsRequestContextKeyValue(IHeaderDictionary headers, string keyName) { return !string.IsNullOrEmpty(GetHeaderKeyValue(headers, RequestResponseHeaders.RequestContextHeader, keyName)); diff --git a/src/Microsoft.ApplicationInsights.AspNetCore/Microsoft.ApplicationInsights.AspNetCore.csproj b/src/Microsoft.ApplicationInsights.AspNetCore/Microsoft.ApplicationInsights.AspNetCore.csproj index 2915a9aa..44679c7b 100644 --- a/src/Microsoft.ApplicationInsights.AspNetCore/Microsoft.ApplicationInsights.AspNetCore.csproj +++ b/src/Microsoft.ApplicationInsights.AspNetCore/Microsoft.ApplicationInsights.AspNetCore.csproj @@ -102,7 +102,6 @@ -