XHTTP client: Avoid panic when host is invalid (#6316)

Fixes https://github.com/XTLS/Xray-core/issues/6315
This commit is contained in:
bytecategory
2026-06-19 06:55:18 +08:00
committed by GitHub
parent 711aea4e34
commit 986c512e0f
+5 -1
View File
@@ -59,7 +59,11 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
if body != nil {
method = c.transportConfig.GetNormalizedUplinkHTTPMethod() // stream-up/one
}
req, _ := http.NewRequestWithContext(context.WithoutCancel(ctx), method, url, body)
req, err := http.NewRequestWithContext(context.WithoutCancel(ctx), method, url, body)
if err != nil {
errors.LogInfoInner(ctx, err, "failed to create HTTP request for "+url)
return nil, nil, nil, err
}
c.transportConfig.FillStreamRequest(req, sessionId, "")
wrc = &WaitReadCloser{Wait: make(chan struct{})}