Skip to content

Commit

Permalink
finish support XTLS/Xray-core#375
Browse files Browse the repository at this point in the history
(be careful with golang's textproto.CanonicalMIMEHeaderKey)
  • Loading branch information
wwqgtxx committed Mar 15, 2021
1 parent ec73dab commit 2bef674
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ func (c *wsClientImpl) Dial(args ...interface{}) (io.Closer, error) {
header := c.header
if len(args) >= 1 {
if inHeader, ok := args[0].(http.Header); ok {
if secProtocol, ok := inHeader["Sec-WebSocket-Protocol"]; ok && len(secProtocol) > 0 {
if secProtocol := inHeader.Get("Sec-WebSocket-Protocol"); len(secProtocol) > 0 {
header = header.Clone()
header["Sec-WebSocket-Protocol"] = secProtocol
header.Set("Sec-WebSocket-Protocol", secProtocol)
}
}
}
log.Println("Dial to", c.Target(), "with", header)
ws, _, err := c.wsDialer.Dial(c.Target(), header)
return ws, err
}
Expand Down

0 comments on commit 2bef674

Please sign in to comment.