XHTTP XMUX: Abandon client if client.Do(req) failed (#4253)

51769fdde1
This commit is contained in:
RPRX 2025-01-06 14:06:11 +00:00 committed by GitHub
parent aeb12d9e3b
commit ce6c0dc690
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 14 deletions

View file

@ -7,6 +7,7 @@ import (
"strings"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/transport/internet"
)
@ -36,10 +37,11 @@ func (c *Config) GetNormalizedQuery() string {
if query != "" {
query += "&"
}
query += "x_version=" + core.Version()
paddingLen := c.GetNormalizedXPaddingBytes().rand()
if paddingLen > 0 {
query += "x_padding=" + strings.Repeat("0", int(paddingLen))
query += "&x_padding=" + strings.Repeat("0", int(paddingLen))
}
return query
@ -58,6 +60,7 @@ func (c *Config) WriteResponseHeader(writer http.ResponseWriter) {
// CORS headers for the browser dialer
writer.Header().Set("Access-Control-Allow-Origin", "*")
writer.Header().Set("Access-Control-Allow-Methods", "GET, POST")
writer.Header().Set("X-Version", core.Version())
paddingLen := c.GetNormalizedXPaddingBytes().rand()
if paddingLen > 0 {
writer.Header().Set("X-Padding", strings.Repeat("0", int(paddingLen)))