Skip to content

Commit d64b4c7

Browse files
author
Cesar Blum Silveira
committed
Control-flow simplification in Frame.CreateResponseHeader() (#1168).
1 parent 610601c commit d64b4c7

File tree

1 file changed

+9
-6
lines changed
  • src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http

1 file changed

+9
-6
lines changed

src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/Frame.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -865,13 +865,16 @@ private void CreateResponseHeader(
865865

866866
responseHeaders.SetReadOnly();
867867

868-
if (!_keepAlive && !hasConnection)
868+
if (!hasConnection)
869869
{
870-
responseHeaders.SetRawConnection("close", _bytesConnectionClose);
871-
}
872-
else if (_keepAlive && !hasConnection && _httpVersion == Http.HttpVersion.Http10)
873-
{
874-
responseHeaders.SetRawConnection("keep-alive", _bytesConnectionKeepAlive);
870+
if (!_keepAlive)
871+
{
872+
responseHeaders.SetRawConnection("close", _bytesConnectionClose);
873+
}
874+
else if (_httpVersion == Http.HttpVersion.Http10)
875+
{
876+
responseHeaders.SetRawConnection("keep-alive", _bytesConnectionKeepAlive);
877+
}
875878
}
876879

877880
if (ServerOptions.AddServerHeader && !responseHeaders.HasServer)

0 commit comments

Comments
 (0)