mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-01 01:44:15 +00:00
XHTTP client: Move x_padding
into Referer
header (#4298)
""Breaking"": Update the server side first, then client
This commit is contained in:
parent
30cb22afb1
commit
14a6636a41
6 changed files with 182 additions and 59 deletions
|
@ -53,8 +53,8 @@ var (
|
|||
func getHTTPClient(ctx context.Context, dest net.Destination, streamSettings *internet.MemoryStreamConfig) (DialerClient, *XmuxClient) {
|
||||
realityConfig := reality.ConfigFromStreamSettings(streamSettings)
|
||||
|
||||
if browser_dialer.HasBrowserDialer() && realityConfig != nil {
|
||||
return &BrowserDialerClient{}, nil
|
||||
if browser_dialer.HasBrowserDialer() && realityConfig == nil {
|
||||
return &BrowserDialerClient{transportConfig: streamSettings.ProtocolSettings.(*Config)}, nil
|
||||
}
|
||||
|
||||
globalDialerAccess.Lock()
|
||||
|
@ -367,15 +367,18 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
},
|
||||
}
|
||||
|
||||
var err error
|
||||
if mode == "stream-one" {
|
||||
requestURL.Path = transportConfiguration.GetNormalizedPath()
|
||||
if xmuxClient != nil {
|
||||
xmuxClient.LeftRequests.Add(-1)
|
||||
}
|
||||
conn.reader, conn.remoteAddr, conn.localAddr, _ = httpClient.OpenStream(ctx, requestURL.String(), reader, false)
|
||||
conn.reader, conn.remoteAddr, conn.localAddr, err = httpClient.OpenStream(ctx, requestURL.String(), reader, false)
|
||||
if err != nil { // browser dialer only
|
||||
return nil, err
|
||||
}
|
||||
return stat.Connection(&conn), nil
|
||||
} else { // stream-down
|
||||
var err error
|
||||
if xmuxClient2 != nil {
|
||||
xmuxClient2.LeftRequests.Add(-1)
|
||||
}
|
||||
|
@ -388,7 +391,10 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
if xmuxClient != nil {
|
||||
xmuxClient.LeftRequests.Add(-1)
|
||||
}
|
||||
httpClient.OpenStream(ctx, requestURL.String(), reader, true)
|
||||
_, _, _, err = httpClient.OpenStream(ctx, requestURL.String(), reader, true)
|
||||
if err != nil { // browser dialer only
|
||||
return nil, err
|
||||
}
|
||||
return stat.Connection(&conn), nil
|
||||
}
|
||||
|
||||
|
@ -428,8 +434,6 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
// can reassign Path (potentially concurrently)
|
||||
url := requestURL
|
||||
url.Path += "/" + strconv.FormatInt(seq, 10)
|
||||
// reassign query to get different padding
|
||||
url.RawQuery = transportConfiguration.GetNormalizedQuery()
|
||||
|
||||
seq += 1
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue