mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-02 17:58:46 +00:00
XHTTP client: Avoid panic when host is invalid (#6316)
Fixes https://github.com/XTLS/Xray-core/issues/6315
This commit is contained in:
@@ -59,7 +59,11 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
|
|||||||
if body != nil {
|
if body != nil {
|
||||||
method = c.transportConfig.GetNormalizedUplinkHTTPMethod() // stream-up/one
|
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, "")
|
c.transportConfig.FillStreamRequest(req, sessionId, "")
|
||||||
|
|
||||||
wrc = &WaitReadCloser{Wait: make(chan struct{})}
|
wrc = &WaitReadCloser{Wait: make(chan struct{})}
|
||||||
|
|||||||
Reference in New Issue
Block a user