<Compile Include="System\Net\HttpRequestHeader.cs" />
<Compile Include="System\Net\HeaderInfo.cs" />
<Compile Include="System\Net\HeaderInfoTable.cs" />
- <Compile Include="System\Net\NetEventSource.WebHeaderCollection.cs" />
<Compile Include="$(CommonPath)System\Net\CaseInsensitiveAscii.cs"
Link="Common\System\Net\CaseInsensitiveAscii.cs" />
<Compile Include="$(CommonPath)System\StringExtensions.cs"
Link="Common\System\Net\HttpKnownHeaderNames.cs" />
<Compile Include="$(CommonPath)System\Net\HttpValidationHelpers.cs"
Link="Common\System\Net\HttpValidationHelpers.cs" />
- <Compile Include="$(CommonPath)System\Net\Logging\NetEventSource.Common.cs"
- Link="Common\System\Net\Logging\NetEventSource.Common.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Collections" />
name = HttpValidationHelpers.CheckBadHeaderNameChars(name);
ThrowOnRestrictedHeader(name);
value = HttpValidationHelpers.CheckBadHeaderValueChars(value);
- if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"calling InnerCollection.Set() key:[{name}], value:[{value}]");
if (_type == WebHeaderCollectionType.WebResponse)
{
if (value != null && value.Length > ushort.MaxValue)
name = HttpValidationHelpers.CheckBadHeaderNameChars(name);
ThrowOnRestrictedHeader(name);
value = HttpValidationHelpers.CheckBadHeaderValueChars(value);
- if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"Add({header}) calling InnerCollection.Add() key:[{name}], value:[{value}]");
if (_type == WebHeaderCollectionType.WebResponse)
{
if (value != null && value.Length > ushort.MaxValue)
name = HttpValidationHelpers.CheckBadHeaderNameChars(name);
ThrowOnRestrictedHeader(name);
value = HttpValidationHelpers.CheckBadHeaderValueChars(value);
- if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"calling InnerCollection.Add() key:[{name}], value:[{value}]");
if (_type == WebHeaderCollectionType.WebResponse)
{
if (value != null && value.Length > ushort.MaxValue)
{
headerName = HttpValidationHelpers.CheckBadHeaderNameChars(headerName);
headerValue = HttpValidationHelpers.CheckBadHeaderValueChars(headerValue);
- if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"calling InnerCollection.Add() key:[{headerName}], value:[{headerValue}]");
if (_type == WebHeaderCollectionType.WebResponse)
{
if (headerValue != null && headerValue.Length > ushort.MaxValue)
}
ThrowOnRestrictedHeader(name);
name = HttpValidationHelpers.CheckBadHeaderNameChars(name);
- if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"calling InnerCollection.Remove() key:[{name}]");
if (_innerCollection != null)
{
InvalidateCachedArrays();
}
sb.Append("\r\n");
- if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"ToString: {sb}");
return sb.ToString();
}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Diagnostics.Tracing;
-using Xunit;
-
-namespace System.Net.Tests
-{
- public class WebHeaderCollectionLoggingTest
- {
- [Fact]
- public void EventSource_ExistsWithCorrectId()
- {
- Type esType = typeof(WebHeaderCollection).Assembly.GetType("System.Net.NetEventSource", throwOnError: true, ignoreCase: false);
- Assert.NotNull(esType);
-
- Assert.Equal("Microsoft-System-Net-WebHeaderCollection", EventSource.GetName(esType));
- Assert.Equal(Guid.Parse("fd36452f-9f2b-5850-d212-6c436231e3dc"), EventSource.GetGuid(esType));
-
- Assert.NotEmpty(EventSource.GenerateManifest(esType, esType.Assembly.Location));
- }
- }
-}