public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span <byte> startLine) { var requestType = RequestType.NotRecognized; if (versionAndMethod.Method == HttpMethod.Get) { #if !DATABASE var pathLength = targetPath.Offset; if (pathLength == 10 && startLine.SequenceEqual(Paths.Plaintext)) { requestType = RequestType.PlainText; } else if (pathLength == 5 && startLine.SequenceEqual(Paths.Json)) { requestType = RequestType.Json; } #else var pathLength = targetPath.Offset; if (Paths.SingleQuery.Length == pathLength && startLine.SequenceEqual(Paths.SingleQuery)) { requestType = RequestType.SingleQuery; } else if (Paths.Fortunes.Length == pathLength && startLine.SequenceEqual(Paths.Fortunes)) { requestType = RequestType.Fortunes; } else if (Paths.Caching.Length <= pathLength && startLine.StartsWith(Paths.Caching)) { _queries = ParseQueries(startLine, Paths.Caching.Length); requestType = RequestType.Caching; } else if (Paths.Updates.Length <= pathLength && startLine.StartsWith(Paths.Updates)) { _queries = ParseQueries(startLine, Paths.Updates.Length); requestType = RequestType.Updates; } else if (Paths.MultipleQueries.Length <= pathLength && startLine.StartsWith(Paths.MultipleQueries)) { _queries = ParseQueries(startLine, Paths.MultipleQueries.Length); requestType = RequestType.MultipleQueries; } #endif } _requestType = requestType; }
public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span <byte> startLine) { var requestType = RequestType.NotRecognized; if (versionAndMethod.Method == HttpMethod.Get) { #if !DATABASE var pathOffset = targetPath.Offset; if (targetPath.Length >= 2 && startLine[pathOffset] == '/') { pathOffset += 1; if (startLine[pathOffset] == 'j') { requestType = RequestType.Json; } else if (startLine[pathOffset] == 'p') { requestType = RequestType.PlainText; } } #else var path = startLine.Slice(targetPath.Offset); var pathLength = path.Length; if (Paths.SingleQuery.Length <= pathLength && path.StartsWith(Paths.SingleQuery)) { requestType = RequestType.SingleQuery; } else if (Paths.Fortunes.Length <= pathLength && path.StartsWith(Paths.Fortunes)) { requestType = RequestType.Fortunes; } else if (Paths.Updates.Length <= pathLength && path.StartsWith(Paths.Updates)) { _queries = ParseQueries(path, Paths.Updates.Length); requestType = RequestType.Updates; } else if (Paths.MultipleQueries.Length <= pathLength && path.StartsWith(Paths.MultipleQueries)) { _queries = ParseQueries(path, Paths.MultipleQueries.Length); requestType = RequestType.MultipleQueries; } #endif } _requestType = requestType; }
public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span <byte> startLine) { var requestType = RequestType.NotRecognized; if (versionAndMethod.Method == HttpMethod.Get) { var pathLength = targetPath.Offset; if (pathLength == 10 && startLine.SequenceEqual(Paths.Plaintext)) { requestType = RequestType.PlainText; } else if (pathLength == 5 && startLine.SequenceEqual(Paths.Json)) { requestType = RequestType.Json; } } _requestType = requestType; }
public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span <byte> startLine) { _requestType = versionAndMethod.Method == HttpMethod.Get ? GetRequestType(startLine.Slice(targetPath.Offset, targetPath.Length), ref _queries) : RequestType.NotRecognized; }
public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span <byte> startLine) => RequestHandler.Connection.OnStartLine(versionAndMethod, targetPath, startLine);
public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span <byte> startLine) { _requestType = versionAndMethod.Method == Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpMethod.Get ? GetRequestType(startLine.Slice(targetPath.Offset, targetPath.Length), ref _queries) : RequestType.NotRecognized; }
public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span <byte> startLine) { var targetStart = targetPath.Offset; // Slice out target var target = startLine[targetStart..];
public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span <byte> startLine) { }