mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
Properly parse HTTP host for verification
Also fix H2 transport to not verify if host is not defined
This commit is contained in:
parent
4c51636788
commit
b8c0768b16
5 changed files with 22 additions and 6 deletions
|
@ -1,3 +1,18 @@
|
|||
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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue