public HttpVersion ReadHttpVersion()
        {
            ByteSpan oldBuffer = Buffer;
            Utf8Span version   = ReadHttpVersionAsUtf8String();

            if (version.Equals(s_Http1_1))
            {
                return(HttpVersion.V1_1);
            }
            else if (version.Equals(s_Http2_0))
            {
                return(HttpVersion.V2_0);
            }
            else if (version.Equals(s_Http1_0))
            {
                return(HttpVersion.V1_0);
            }
            else
            {
                Buffer = oldBuffer;
                return(HttpVersion.Unknown);
            }
        }
Exemple #2
0
 public static bool TryParseRequestUri(ByteSpan buffer, out Utf8Span requestUri, out int parsedBytes)
 {
     var uriSpan = HttpRequestReader.SliceTo(buffer, HttpRequestReader.s_SP, out parsedBytes);
     requestUri = new Utf8Span(uriSpan);
     return parsedBytes != 0;
 }
Exemple #3
0
 public static bool TryParseHttpVersion(ByteSpan buffer, out Utf8Span httpVersion, out int parsedBytes)
 {
     var versionSpan = HttpRequestReader.SliceTo(buffer, HttpRequestReader.s_CR, HttpRequestReader.s_LF, out parsedBytes);
     httpVersion = new Utf8Span(versionSpan);
     return parsedBytes != 0;
 }