1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-25 21:36:13 -04:00

fix sniff http ipv6 address

This commit is contained in:
comwrg 2018-12-10 20:37:17 +08:00
parent 867135d85a
commit e52b387483
No known key found for this signature in database
GPG Key ID: 315F3A656223B79B

View File

@ -3,6 +3,7 @@ package http
import (
"bytes"
"errors"
"net"
"strings"
"v2ray.com/core/common"
@ -77,8 +78,12 @@ func SniffHTTP(b []byte) (*SniffHeader, error) {
key := strings.ToLower(string(parts[0]))
value := strings.ToLower(string(bytes.Trim(parts[1], " ")))
if key == "host" {
domain := strings.Split(value, ":")
sh.host = strings.TrimSpace(domain[0])
host, _, err := net.SplitHostPort(value)
if err != nil {
sh.host = value
} else {
sh.host = host
}
}
}