非法请求不再painc

This commit is contained in:
yangjiechina
2024-07-16 21:20:55 +08:00
parent c353600844
commit b677e4ff43

View File

@@ -102,7 +102,7 @@ func parseMessage(data []byte) (string, *url.URL, textproto.MIMEHeader, error) {
line, err := tp.ReadLine()
split := strings.Split(line, " ")
if len(split) < 3 {
panic(fmt.Errorf("wrong request line %s", line))
return "", nil, nil, fmt.Errorf("wrong request line %s", line)
}
method := strings.ToUpper(split[0])