mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-03 02:08:45 +00:00
XHTTP transport: Fix "auto" mode with REALITY (#5638)
Fixes https://github.com/XTLS/Xray-core/issues/5635 BTW, fixes https://github.com/XTLS/Xray-core/issues/5631
This commit is contained in:
@@ -314,6 +314,7 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
|
|||||||
switch c.UplinkDataPlacement {
|
switch c.UplinkDataPlacement {
|
||||||
case "":
|
case "":
|
||||||
c.UplinkDataPlacement = "body"
|
c.UplinkDataPlacement = "body"
|
||||||
|
case "body":
|
||||||
case "cookie", "header":
|
case "cookie", "header":
|
||||||
if c.Mode != "packet-up" {
|
if c.Mode != "packet-up" {
|
||||||
return nil, errors.New("UplinkDataPlacement can be " + c.UplinkDataPlacement + " only in packet-up mode")
|
return nil, errors.New("UplinkDataPlacement can be " + c.UplinkDataPlacement + " only in packet-up mode")
|
||||||
@@ -334,7 +335,7 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
|
|||||||
switch c.SessionPlacement {
|
switch c.SessionPlacement {
|
||||||
case "":
|
case "":
|
||||||
c.SessionPlacement = "path"
|
c.SessionPlacement = "path"
|
||||||
case "cookie", "header", "query":
|
case "path", "cookie", "header", "query":
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unsupported session placement: " + c.SessionPlacement)
|
return nil, errors.New("unsupported session placement: " + c.SessionPlacement)
|
||||||
}
|
}
|
||||||
@@ -342,7 +343,7 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
|
|||||||
switch c.SeqPlacement {
|
switch c.SeqPlacement {
|
||||||
case "":
|
case "":
|
||||||
c.SeqPlacement = "path"
|
c.SeqPlacement = "path"
|
||||||
case "cookie", "header", "query":
|
case "path", "cookie", "header", "query":
|
||||||
if c.SessionPlacement == "path" {
|
if c.SessionPlacement == "path" {
|
||||||
return nil, errors.New("SeqPlacement must be path when SessionPlacement is path")
|
return nil, errors.New("SeqPlacement must be path when SessionPlacement is path")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,11 +272,6 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||||||
requestURL.Host = dest.Address.String()
|
requestURL.Host = dest.Address.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionId := ""
|
|
||||||
if transportConfiguration.Mode != "stream-one" {
|
|
||||||
sessionIdUuid := uuid.New()
|
|
||||||
sessionId = sessionIdUuid.String()
|
|
||||||
}
|
|
||||||
requestURL.Path = transportConfiguration.GetNormalizedPath()
|
requestURL.Path = transportConfiguration.GetNormalizedPath()
|
||||||
requestURL.RawQuery = transportConfiguration.GetNormalizedQuery()
|
requestURL.RawQuery = transportConfiguration.GetNormalizedQuery()
|
||||||
|
|
||||||
@@ -293,6 +288,12 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sessionId := ""
|
||||||
|
if mode != "stream-one" {
|
||||||
|
sessionIdUuid := uuid.New()
|
||||||
|
sessionId = sessionIdUuid.String()
|
||||||
|
}
|
||||||
|
|
||||||
errors.LogInfo(ctx, fmt.Sprintf("XHTTP is dialing to %s, mode %s, HTTP version %s, host %s", dest, mode, httpVersion, requestURL.Host))
|
errors.LogInfo(ctx, fmt.Sprintf("XHTTP is dialing to %s, mode %s, HTTP version %s, host %s", dest, mode, httpVersion, requestURL.Host))
|
||||||
|
|
||||||
requestURL2 := requestURL
|
requestURL2 := requestURL
|
||||||
|
|||||||
Reference in New Issue
Block a user