Control-flow simplification in Frame.CreateResponseHeader() (#1168).

This commit is contained in:
Cesar Blum Silveira 2016-10-24 11:07:06 -07:00
parent 610601cc6e
commit d64b4c7acb
1 changed files with 9 additions and 6 deletions

View File

@ -865,13 +865,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http
responseHeaders.SetReadOnly();
if (!_keepAlive && !hasConnection)
if (!hasConnection)
{
responseHeaders.SetRawConnection("close", _bytesConnectionClose);
}
else if (_keepAlive && !hasConnection && _httpVersion == Http.HttpVersion.Http10)
{
responseHeaders.SetRawConnection("keep-alive", _bytesConnectionKeepAlive);
if (!_keepAlive)
{
responseHeaders.SetRawConnection("close", _bytesConnectionClose);
}
else if (_httpVersion == Http.HttpVersion.Http10)
{
responseHeaders.SetRawConnection("keep-alive", _bytesConnectionKeepAlive);
}
}
if (ServerOptions.AddServerHeader && !responseHeaders.HasServer)