WebSocket config: Fix `headers` (#4177)

Fixes https://github.com/XTLS/Xray-core/issues/4176
pull/4160/head
珐琅彩山水佩奇童车游春马蹄杯 2024-12-17 16:53:16 +08:00 committed by GitHub
parent 7d0a80b501
commit 5836afc41f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -165,11 +165,13 @@ func (c *WebSocketConfig) Build() (proto.Message, error) {
} }
// Priority (client): host > serverName > address // Priority (client): host > serverName > address
for k, v := range c.Headers { for k, v := range c.Headers {
errors.PrintDeprecatedFeatureWarning(`"host" in "headers"`, `independent "host"`) if strings.ToLower(k) == "host"{
if c.Host == "" { errors.PrintDeprecatedFeatureWarning(`"host" in "headers"`, `independent "host"`)
c.Host = v if c.Host == "" {
c.Host = v
}
delete(c.Headers, k)
} }
delete(c.Headers, k)
} }
config := &websocket.Config{ config := &websocket.Config{
Path: path, Path: path,