private static int FindNonSPLenient(byte[] sb, int offset, int length) { for (int result = offset; result < length; ++result) { var c = sb[result]; // See https://tools.ietf.org/html/rfc7230#section-3.5 if (IsSPLenient(c)) { continue; } if (IsWhiteSpace(c)) { // Any other whitespace delimiter is invalid ThrowHelper.ThrowArgumentException_Invalid_separator(); } return(result); } return(length); }