Skip to content

Commit 761132c

Browse files
committed
[release/2.1] Do not escape cookie names in lookups
- **Do Not Merge** - always fail `RequestCookieCollection.ContainsKey(...)` and `RequestCookieCollection.TryGetValue(...)` - undo an important part of #24264 and demonstrate #29023 problem - shows many tests working despite break of an indirect reference
1 parent 3d0f8db commit 761132c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

eng/PatchConfig.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Later on, this will be checked using this condition:
8585
</PropertyGroup>
8686
<PropertyGroup Condition=" '$(VersionPrefix)' == '2.1.25' ">
8787
<PackagesInPatch>
88+
Microsoft.AspNetCore.Http;
8889
Microsoft.AspNetCore.Server.Kestrel.Core;
8990
</PackagesInPatch>
9091
</PropertyGroup>

src/Http/Http/src/Internal/RequestCookieCollection.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ internal static RequestCookieCollection ParseInternal(IList<string> values, bool
8888
{
8989
name = Uri.UnescapeDataString(name);
9090
}
91+
9192
var value = Uri.UnescapeDataString(cookie.Value.Value);
9293
store[name] = value;
9394
}
@@ -127,8 +128,8 @@ public bool ContainsKey(string key)
127128
{
128129
return false;
129130
}
130-
return Store.ContainsKey(key)
131-
|| !_enableCookieNameDecoding && Store.ContainsKey(Uri.EscapeDataString(key));
131+
132+
return false;
132133
}
133134

134135
public bool TryGetValue(string key, out string value)
@@ -139,8 +140,8 @@ public bool TryGetValue(string key, out string value)
139140
return false;
140141
}
141142

142-
return Store.TryGetValue(key, out value)
143-
|| !_enableCookieNameDecoding && Store.TryGetValue(Uri.EscapeDataString(key), out value);
143+
value = null;
144+
return false;
144145
}
145146

146147
/// <summary>

0 commit comments

Comments
 (0)