mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2025-01-03 04:50:11 +00:00
fix url parsing
This commit is contained in:
parent
72d5770d18
commit
f7d7f37986
17
util/util.go
17
util/util.go
@ -53,13 +53,6 @@ func IsValidMethod(name string) bool {
|
|||||||
|
|
||||||
func ExtractDomain(message *[]byte) string {
|
func ExtractDomain(message *[]byte) string {
|
||||||
i := 0
|
i := 0
|
||||||
for ; i < len(*message); i++ {
|
|
||||||
if (*message)[i] == '\n' {
|
|
||||||
i++
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for ; i < len(*message); i++ {
|
for ; i < len(*message); i++ {
|
||||||
if (*message)[i] == ' ' {
|
if (*message)[i] == ' ' {
|
||||||
i++
|
i++
|
||||||
@ -69,14 +62,18 @@ func ExtractDomain(message *[]byte) string {
|
|||||||
|
|
||||||
j := i
|
j := i
|
||||||
for ; j < len(*message); j++ {
|
for ; j < len(*message); j++ {
|
||||||
if (*message)[j] == '\n' {
|
if (*message)[j] == ' ' {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
domain := strings.Split(string((*message)[i:j]), ":")[0]
|
domain := string((*message)[i:j])
|
||||||
|
domain = strings.Replace(domain, "http://", "", 1)
|
||||||
|
domain = strings.Replace(domain, "https://", "", 1)
|
||||||
|
domain = strings.Split(domain, ":")[0]
|
||||||
|
domain = strings.Split(domain, "/")[0]
|
||||||
|
|
||||||
return strings.ToUpper(strings.TrimSpace(domain))
|
return strings.TrimSpace(domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExtractMethod(message *[]byte) string {
|
func ExtractMethod(message *[]byte) string {
|
||||||
|
Loading…
Reference in New Issue
Block a user