Пример #1
0
 public static bool IsToken(this byte value)
 {
     if (ByteExtensions.IsChar(value) && !ByteExtensions.IsControl(value))
     {
         return(!ByteExtensions.IsSeparator(value));
     }
     return(false);
 }
Пример #2
0
        public HttpParser QuotedString(out Datagram quotedString)
        {
            quotedString = (Datagram)null;
            int offset = this._offset;

            if (!this.Bytes((byte)34).Success)
            {
                return(this);
            }
            while (this.IsNext())
            {
                byte num1 = this.Next();
                switch (num1)
                {
                case (byte)34:
                    ++this._offset;
                    quotedString = new Datagram(this._buffer, offset, this._offset - offset);
                    return(this);

                case (byte)92:
                    if (this.IsNextNext() && ByteExtensions.IsChar(this.NextNext()))
                    {
                        this._offset += 2;
                        continue;
                    }
                    break;
                }
                int num2 = this._offset;
                this.SkipLws();
                if (num2 == this._offset)
                {
                    if (ByteExtensions.IsControl(num1))
                    {
                        return(this.Fail());
                    }
                    ++this._offset;
                }
            }
            return(this.Fail());
        }