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); }
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); }
public HttpRequestSingleSegment(HttpRequestLine requestLine, HttpHeadersSingleSegment headers, ReadOnlySpan <byte> bytes) { _requestLine = requestLine; _headers = headers; _body = bytes; }