File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
src/Servers/Kestrel/Core/src/Internal/Http Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -27,18 +27,22 @@ public HttpRequestHeaders(bool reuseHeaderValues = true, bool useLatin1 = false)
27
27
28
28
public void OnHeadersComplete ( )
29
29
{
30
- var bitsToClear = _previousBits & ~ _bits ;
30
+ var newHeaderFlags = _bits ;
31
+ var previousHeaderFlags = _previousBits ;
31
32
_previousBits = 0 ;
32
33
33
- if ( bitsToClear != 0 )
34
+ var headersToClear = ( ~ newHeaderFlags ) & previousHeaderFlags ;
35
+ if ( headersToClear == 0 )
34
36
{
35
- // Some previous headers were not reused or overwritten.
36
-
37
- // While they cannot be accessed by the current request (as they were not supplied by it)
38
- // there is no point in holding on to them, so clear them now,
39
- // to allow them to get collected by the GC.
40
- Clear ( bitsToClear ) ;
37
+ // All headers were resued.
38
+ return ;
41
39
}
40
+
41
+ // Some previous headers were not reused or overwritten.
42
+ // While they cannot be accessed by the current request (as they were not supplied by it)
43
+ // there is no point in holding on to them, so clear them now,
44
+ // to allow them to get collected by the GC.
45
+ Clear ( headersToClear ) ;
42
46
}
43
47
44
48
protected override void ClearFast ( )
You can’t perform that action at this time.
0 commit comments