| 1234567891011121314151617181920 |
- package l7
- import (
- "bytes"
- )
- func ParseHttp(payload []byte) (string, string) {
- method, rest, ok := bytes.Cut(payload, space)
- if !ok {
- return "", ""
- }
- if !isHttpMethod(string(method)) {
- return "", ""
- }
- uri, _, ok := bytes.Cut(rest, space)
- if !ok {
- uri = append(uri, []byte("...")...)
- }
- return string(method), string(uri)
- }
|