コード例 #1
0
            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);
                        }
                    }
                }
            }
コード例 #2
0
 public bool Process(byte value) => !AsciiString.IsUpperCase(value);