Skip to content

Commit cda8069

Browse files
committed
nits
1 parent 7f4a402 commit cda8069

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

src/Servers/IIS/IIS/src/Core/IISHttpContext.Log.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ private static class Log
2020
private static readonly Action<ILogger, string, string, Exception> _unexpectedError =
2121
LoggerMessage.Define<string, string>(LogLevel.Error, new EventId(3, "UnexpectedError"), @"Unexpected exception in ""{ClassName}.{MethodName}"".");
2222

23+
private static readonly Action<ILogger, string, string, Exception> _connectionBadRequest =
24+
LoggerMessage.Define<string, string>(LogLevel.Information, new EventId(4, nameof(ConnectionBadRequest)), @"Connection id ""{ConnectionId}"" bad request data: ""{message}""");
25+
2326
public static void ConnectionDisconnect(ILogger logger, string connectionId)
2427
{
2528
_connectionDisconnect(logger, connectionId, null);
@@ -34,6 +37,11 @@ public static void UnexpectedError(ILogger logger, string className, Exception e
3437
{
3538
_unexpectedError(logger, className, methodName, ex);
3639
}
40+
41+
public static void ConnectionBadRequest(ILogger logger, string connectionId, BadHttpRequestException ex)
42+
{
43+
_connectionBadRequest(logger, connectionId, ex.Message, ex);
44+
}
3745
}
3846
}
3947
}

src/Servers/IIS/IIS/src/Core/IISHttpContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ protected Task ProduceEnd()
352352
private void SetErrorResponseHeaders(int statusCode)
353353
{
354354
StatusCode = statusCode;
355-
ReasonPhrase = string.Empty; // TODO
355+
ReasonPhrase = string.Empty;
356356
HttpResponseHeaders.Clear();
357357
}
358358

@@ -479,7 +479,7 @@ protected async Task FireOnCompleted()
479479

480480
public void SetBadRequestState(BadHttpRequestException ex)
481481
{
482-
//Log.ConnectionBadRequest(ConnectionId, ex);
482+
Log.ConnectionBadRequest(_logger, RequestConnectionId, ex);
483483

484484
if (!HasResponseStarted)
485485
{

src/Servers/IIS/IIS/src/IISServerOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public class IISServerOptions
3838

3939
internal string[] ServerAddresses { get; set; }
4040

41-
4241
// Matches the default maxAllowedContentLength in IIS (~28.6 MB)
4342
// https://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits#005
4443
private long? _maxRequestBodySize = 30000000;

src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<Import Project="../FunctionalTest.props" />
44

@@ -11,7 +11,6 @@
1111

1212

1313
<ItemGroup>
14-
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Server.IIS.csproj" />
1514
<ProjectReference Include="..\Common.Tests\Common.Tests.csproj" />
1615
<ProjectReference Include="$(RepositoryRoot)src\Hosting\Server.IntegrationTesting\src\Microsoft.AspNetCore.Server.IntegrationTesting.csproj" />
1716
<ProjectReference Include="$(RepositoryRoot)src\Servers\IIS\IntegrationTesting.IIS\src\Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj" />

0 commit comments

Comments
 (0)