public void ValidateName(ICharSequence name) { if (name is null || 0u >= (uint)name.Count) { ThrowHelper.ThrowConnectionError_EmptyHeadersAreNotAllowed(name); } if (name is AsciiString asciiString) { int index = 0; try { index = asciiString.ForEachByte(Http2NameValidatorProcessor.Instance); } catch (Http2Exception) { throw; } catch (Exception t) { ThrowHelper.ThrowConnectionError_InvalidHeaderName(name, t); } if (index != -1) { ThrowHelper.ThrowConnectionError_InvalidHeaderName(name); } } else { for (int i = 0; i < name.Count; ++i) { if (AsciiString.IsUpperCase(name[i])) { ThrowHelper.ThrowConnectionError_InvalidHeaderName(name); } } } }
public bool Process(byte value) => !AsciiString.IsUpperCase(value);