Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Http/Headers/src/CookieHeaderParser.cs')
-rw-r--r--src/Http/Headers/src/CookieHeaderParser.cs39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/Http/Headers/src/CookieHeaderParser.cs b/src/Http/Headers/src/CookieHeaderParser.cs
index 00f473b31e..ca65e83d58 100644
--- a/src/Http/Headers/src/CookieHeaderParser.cs
+++ b/src/Http/Headers/src/CookieHeaderParser.cs
@@ -3,33 +3,32 @@
using Microsoft.Extensions.Primitives;
-namespace Microsoft.Net.Http.Headers
+namespace Microsoft.Net.Http.Headers;
+
+internal sealed class CookieHeaderParser : HttpHeaderParser<CookieHeaderValue>
{
- internal sealed class CookieHeaderParser : HttpHeaderParser<CookieHeaderValue>
+ internal CookieHeaderParser(bool supportsMultipleValues)
+ : base(supportsMultipleValues)
+ {
+ }
+
+ public override bool TryParseValue(StringSegment value, ref int index, out CookieHeaderValue? cookieValue)
{
- internal CookieHeaderParser(bool supportsMultipleValues)
- : base(supportsMultipleValues)
+ cookieValue = null;
+
+ if (!CookieHeaderParserShared.TryParseValue(value, ref index, SupportsMultipleValues, out var parsedName, out var parsedValue))
{
+ return false;
}
- public override bool TryParseValue(StringSegment value, ref int index, out CookieHeaderValue? cookieValue)
+ if (parsedName == null || parsedValue == null)
{
- cookieValue = null;
-
- if (!CookieHeaderParserShared.TryParseValue(value, ref index, SupportsMultipleValues, out var parsedName, out var parsedValue))
- {
- return false;
- }
-
- if (parsedName == null || parsedValue == null)
- {
- // Successfully parsed, but no values.
- return true;
- }
-
- cookieValue = new CookieHeaderValue(parsedName.Value, parsedValue.Value);
-
+ // Successfully parsed, but no values.
return true;
}
+
+ cookieValue = new CookieHeaderValue(parsedName.Value, parsedValue.Value);
+
+ return true;
}
}