Fix WS reading X-Forwarded-For & Add tests (#3546)

Fixes https://github.com/XTLS/Xray-core/issues/3545

---------

Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
This commit is contained in:
风扇滑翔翼 2024-07-17 18:40:25 +08:00 committed by GitHub
parent 9e6d7a3cb0
commit a7e198e1e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 11 deletions

View file

@ -151,7 +151,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
return
}
_, err = c.Write([]byte("Response"))
_, err = c.Write([]byte(c.RemoteAddr().String()))
common.Must(err)
}(conn)
})
@ -169,7 +169,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
var b [1024]byte
n, err := conn.Read(b[:])
common.Must(err)
if string(b[:n]) != "Response" {
if string(b[:n]) != "1.1.1.1:0" {
t.Error("response: ", string(b[:n]))
}