Skip to content

Commit

Permalink
Delete WebHeaderCollection's event source (dotnet#38871)
Browse files Browse the repository at this point in the history
The logging is verbose, arbitrary, expensive, and duplicative of logging that happens when headers are actually read/written by the underlying networking stack.  Delete.
  • Loading branch information
stephentoub authored Jul 9, 2020
1 parent 6eff584 commit bdfbf0c
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<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"
Expand All @@ -20,8 +19,6 @@
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" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public override void Set(string name, string? value)
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)
Expand Down Expand Up @@ -372,7 +371,6 @@ public void Add(string header)
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)
Expand Down Expand Up @@ -400,7 +398,6 @@ public override void Add(string name, string? value)
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)
Expand All @@ -416,7 +413,6 @@ protected void AddWithoutValidate(string headerName, string? headerValue)
{
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)
Expand Down Expand Up @@ -469,7 +465,6 @@ public override void Remove(string name)
}
ThrowOnRestrictedHeader(name);
name = HttpValidationHelpers.CheckBadHeaderNameChars(name);
if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"calling InnerCollection.Remove() key:[{name}]");
if (_innerCollection != null)
{
InvalidateCachedArrays();
Expand Down Expand Up @@ -512,7 +507,6 @@ public override string ToString()
}

sb.Append("\r\n");
if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"ToString: {sb}");
return sb.ToString();
}

Expand Down
23 changes: 0 additions & 23 deletions src/libraries/System.Net.WebHeaderCollection/tests/LoggingTest.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="WebHeaderCollectionTest.cs" />
<Compile Include="LoggingTest.cs" />
</ItemGroup>
</Project>

0 comments on commit bdfbf0c

Please sign in to comment.