XHTTP client: Add gRPC header to "stream-up" mode by default (#4042)

""Breaking"": Client uses "stream-up" mode by default when using **TLS H2** or REALITY
This commit is contained in:
RPRX 2024-11-21 05:45:49 +00:00 committed by GitHub
parent 0a252ac15d
commit 817fa72874
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 62 additions and 41 deletions

View file

@ -312,9 +312,13 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
}
mode := transportConfiguration.Mode
if mode == "auto" && realityConfig != nil {
mode = "stream-up"
if mode == "auto" {
mode = "packet-up"
if (tlsConfig != nil && len(tlsConfig.NextProtocol) != 1) || realityConfig != nil {
mode = "stream-up"
}
}
errors.LogInfo(ctx, "XHTTP is using mode: "+mode)
if mode == "stream-up" {
conn.writer = httpClient.OpenUpload(ctx, requestURL.String())
return stat.Connection(&conn), nil