mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2025-01-08 17:54:05 +00:00
add handling unexpected reequest format
This commit is contained in:
parent
7563f2b895
commit
1f74c89e77
@ -1,6 +1,7 @@
|
|||||||
package packet
|
package packet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -139,6 +140,10 @@ func parse(raw []byte) (string, string, string, string, string, error) {
|
|||||||
|
|
||||||
tokens := strings.Split(firstLine, " ")
|
tokens := strings.Split(firstLine, " ")
|
||||||
|
|
||||||
|
if (len(tokens) < 3) {
|
||||||
|
return "", "", "", "", "", errors.New("Unexpected request format")
|
||||||
|
}
|
||||||
|
|
||||||
method := tokens[0]
|
method := tokens[0]
|
||||||
url := tokens[1]
|
url := tokens[1]
|
||||||
version := tokens[2]
|
version := tokens[2]
|
||||||
|
Loading…
Reference in New Issue
Block a user