本文整理汇总了C#中ByteReader.Next方法的典型用法代码示例。如果您正苦于以下问题:C# ByteReader.Next方法的具体用法?C# ByteReader.Next怎么用?C# ByteReader.Next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ByteReader
的用法示例。
在下文中一共展示了ByteReader.Next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public unsafe byte* Read(ByteReader r, HttpRawRequest request)
{
// field-value = *( field-content / obs-fold )
// field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
// field-vchar = VCHAR / obs-text
// obs-fold = CRLF 1*( SP / HTAB )
// obs-text = %x80-FF
byte* pValueEnd = r.Position;
while (r.Next().IsVcharOrObsTextOrSpaceOrTab())
if (!r.Current.IsSpaceOrHtab())
pValueEnd = r.Position;
byte c = r.Current;
if (c == '\r' && r.Next() == '\n')
return pValueEnd;
throw new BadRequestException();
}
示例2: Read
public byte* Read(ByteReader r, HttpRawRequest request)
{
// Transfer-Encoding = *( "," OWS ) transfer-coding *( OWS "," [ OWS transfer-coding ] )
// transfer-coding = "chunked" / "compress" / "deflate" / "gzip" / transfer-extension
// transfer-extension = token *( OWS ";" OWS transfer-parameter )
// transfer-parameter = token BWS "=" BWS ( token / quoted-string )
int hashCode = 0;
byte c = r.Current;
byte mappedC = c.MapTchar();
if (mappedC != 0 || c == ',')
{
while (true)
{
if (c == ',')
{
// skip '*( "," OWS )'
do
{
c = r.Next();
} while (c == ',' || c.IsSpaceOrHtab());
mappedC = c.MapTchar();
}
if (mappedC != c)
{
if (c == '\r')
{
if (r.Next() == '\n')
{
// TODO: return correct pointers
throw new NotImplementedException();
}
throw new BadRequestException();
}
if (mappedC == 0)
throw new BadRequestException();
r.ReplaceCurrent(mappedC);
}
// read 'token'
var tc = new TransferCoding();
tc.Name.Value.Start = r.Position;
do
{
hashCode = NativeByteArray.MixHash(hashCode, c = r.Next());
} while (c.IsTchar());
tc.Name.HashCode = hashCode;
tc.Name.Value.End = r.Position;
while (c.IsSpaceOrHtab())
c = r.Next();
if (c == '\r')
{
if (r.Next() == '\n')
{
// TODO: return correct pointers
throw new NotImplementedException();
}
throw new BadRequestException();
}
if (c == ';')
{
do
{
c = r.Next();
} while (c.IsSpaceOrHtab());
do
{
// TODO: read token
if (c.IsSpaceOrHtab())
{
do
{
c = r.Next();
} while (c.IsSpaceOrHtab());
}
if (c != '=')
throw new BadRequestException();
do
{
c = r.Next();
} while (c.IsSpaceOrHtab());
// TODO: read token or quoted-string
if (c.IsSpaceOrHtab())
{
// TODO: save off pPos before whitespace
do
{
c = r.Next();
} while (c.IsSpaceOrHtab());
}
} while (c == ';');
}
//.........这里部分代码省略.........