Skip to content

Commit 986c512

Browse files
authored
XHTTP client: Avoid panic when host is invalid (#6316)
Fixes #6315
1 parent 711aea4 commit 986c512

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

transport/internet/splithttp/client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, sessio
5959
if body != nil {
6060
method = c.transportConfig.GetNormalizedUplinkHTTPMethod() // stream-up/one
6161
}
62-
req, _ := http.NewRequestWithContext(context.WithoutCancel(ctx), method, url, body)
62+
req, err := http.NewRequestWithContext(context.WithoutCancel(ctx), method, url, body)
63+
if err != nil {
64+
errors.LogInfoInner(ctx, err, "failed to create HTTP request for "+url)
65+
return nil, nil, nil, err
66+
}
6367
c.transportConfig.FillStreamRequest(req, sessionId, "")
6468

6569
wrc = &WaitReadCloser{Wait: make(chan struct{})}

0 commit comments

Comments
 (0)