mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-28 16:16:03 +03:00
b8c0768b16
Also fix H2 transport to not verify if host is not defined
19 lines
340 B
Go
19 lines
340 B
Go
package internet
|
|
|
|
import (
|
|
"net"
|
|
"strings"
|
|
)
|
|
|
|
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
|
|
|
|
func IsValidHTTPHost(request string, config string) bool {
|
|
r := strings.ToLower(request)
|
|
c := strings.ToLower(config)
|
|
if strings.Contains(r, ":") {
|
|
h, _, _ := net.SplitHostPort(r)
|
|
return h == c
|
|
}
|
|
return r == c
|
|
}
|