diff --git a/src/Glyph11/Validation/BodyFramingDetector.cs b/src/Glyph11/Validation/BodyFramingDetector.cs
index a0f2357..dc9ad34 100644
--- a/src/Glyph11/Validation/BodyFramingDetector.cs
+++ b/src/Glyph11/Validation/BodyFramingDetector.cs
@@ -1,3 +1,4 @@
+using System.Runtime.CompilerServices;
using Glyph11.Parser;
using Glyph11.Protocol;
@@ -100,6 +101,7 @@ public static BodyFramingResult DetectResponseBodyFraming(
/// ( when there are none).
///
/// The Content-Length fields disagree.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static long ScanFramingFields(KeyValueList headers, out bool hasChunkedTE)
{
long contentLength = ContentLengthFields.Absent;
@@ -135,14 +137,13 @@ internal static ReadOnlySpan TrimOws(ReadOnlySpan value)
return value[start..end];
}
- internal static long ParseContentLengthDigits(ReadOnlySpan value)
+ ///
+ /// One decimal length with no list or whitespace around it —
+ /// splits and trims each field first: -1 if it is empty or not all digits,
+ /// if a long cannot hold it.
+ ///
+ internal static long ParseDecimalDigits(ReadOnlySpan value)
{
- // Handle comma-separated: take first segment, without the OWS a list allows before its
- // comma - "5 ,5" is 5 (RFC 9110 §5.6.1), exactly as the validator read it.
- int comma = value.IndexOf((byte)',');
- if (comma >= 0)
- value = TrimOws(value[..comma]);
-
if (value.IsEmpty) return -1;
const long Limit = long.MaxValue / 10; // any digit may follow a smaller value
diff --git a/src/Glyph11/Validation/ContentLengthFields.cs b/src/Glyph11/Validation/ContentLengthFields.cs
index 86a818f..6c48ac7 100644
--- a/src/Glyph11/Validation/ContentLengthFields.cs
+++ b/src/Glyph11/Validation/ContentLengthFields.cs
@@ -41,7 +41,7 @@ internal static void Fold(ref long length, ReadOnlySpan fieldValue)
if (!element.IsEmpty)
{
sawElement = true;
- Merge(ref length, BodyFramingDetector.ParseContentLengthDigits(element));
+ Merge(ref length, BodyFramingDetector.ParseDecimalDigits(element));
}
if (comma < 0)