Exemplo n.º 1
0
        internal static int TryParseHeaders(ReadOnlySpan <byte> bytes, out HttpHeadersSingleSegment headers)
        {
            var index = bytes.IndexOf(HttpRequestReader.Eoh);

            if (index == -1)
            {
                headers = default;
                return(0);
            }

            headers = new HttpHeadersSingleSegment(bytes.Slice(0, index + HttpRequestReader.Eol.Length));
            return(index + HttpRequestReader.Eoh.Length);
        }
Exemplo n.º 2
0
        internal static bool TryParseHeaders(ReadOnlySpan <byte> bytes, out HttpHeadersSingleSegment headers, out int parsed)
        {
            var index = bytes.IndexOf(HttpRequestReader.Eoh);

            if (index == -1)
            {
                headers = default(HttpHeadersSingleSegment);
                parsed  = 0;
                return(false);
            }

            headers = new HttpHeadersSingleSegment(bytes.Slice(0, index + HttpRequestReader.Eol.Length));
            parsed  = index + HttpRequestReader.Eoh.Length;
            return(true);
        }
Exemplo n.º 3
0
 public HttpRequestSingleSegment(HttpRequestLine requestLine, HttpHeadersSingleSegment headers, ReadOnlySpan <byte> bytes)
 {
     _requestLine = requestLine;
     _headers     = headers;
     _body        = bytes;
 }