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
|
@ -38,7 +38,7 @@ var upgrader = &websocket.Upgrader{
|
|||
}
|
||||
|
||||
func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
|
||||
if len(h.host) > 0 && !strings.Contains(strings.ToLower(request.Host), strings.ToLower(h.host)) {
|
||||
if len(h.host) > 0 && !internet.IsValidHTTPHost(request.Host, h.host) {
|
||||
errors.LogInfo(context.Background(), "failed to validate host, request:", request.Host, ", config:", h.host)
|
||||
writer.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue