mirror of https://github.com/v2ray/v2ray-core
fix sniff http ipv6 address
parent
867135d85a
commit
e52b387483
|
@ -3,6 +3,7 @@ package http
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"v2ray.com/core/common"
|
"v2ray.com/core/common"
|
||||||
|
@ -77,8 +78,12 @@ func SniffHTTP(b []byte) (*SniffHeader, error) {
|
||||||
key := strings.ToLower(string(parts[0]))
|
key := strings.ToLower(string(parts[0]))
|
||||||
value := strings.ToLower(string(bytes.Trim(parts[1], " ")))
|
value := strings.ToLower(string(bytes.Trim(parts[1], " ")))
|
||||||
if key == "host" {
|
if key == "host" {
|
||||||
domain := strings.Split(value, ":")
|
host, _, err := net.SplitHostPort(value)
|
||||||
sh.host = strings.TrimSpace(domain[0])
|
if err != nil {
|
||||||
|
sh.host = value
|
||||||
|
} else {
|
||||||
|
sh.host = host
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue