Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit da2d666

Browse files
committed
Faster output header handling
1 parent 0f389f0 commit da2d666

File tree

4 files changed

+282
-193
lines changed

4 files changed

+282
-193
lines changed

src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,14 +640,13 @@ private Task CreateResponseHeader(
640640
{
641641
var begin = SocketOutput.ProducingStart();
642642
var end = begin;
643-
if (_keepAlive)
643+
if (_keepAlive && _responseHeaders.HasConnection)
644644
{
645-
foreach (var connectionValue in _responseHeaders.HeaderConnection)
645+
var connection = _responseHeaders.HeaderConnection.ToString();
646+
647+
if (connection.IndexOf("close", StringComparison.OrdinalIgnoreCase) != -1)
646648
{
647-
if (connectionValue.IndexOf("close", StringComparison.OrdinalIgnoreCase) != -1)
648-
{
649-
_keepAlive = false;
650-
}
649+
_keepAlive = false;
651650
}
652651
}
653652

0 commit comments

Comments
 (0)