Skip to content

Commit b98da34

Browse files
committed
add a socket timeout
1 parent 8c2b465 commit b98da34

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Containers/Microsoft.NET.Build.Containers/Registry/DefaultRegistryAPI.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ internal DefaultRegistryAPI(string registryName, Uri baseUri, ILogger logger)
3030

3131
private static HttpClient CreateClient(string registryName, Uri baseUri, ILogger logger, bool isAmazonECRRegistry = false)
3232
{
33-
var innerHandler = new SocketsHttpHandler();
33+
var innerHandler = new SocketsHttpHandler()
34+
{
35+
UseCookies = false,
36+
// the rest of the HTTP stack has an infinite timeout (see below) but we should still have a reasonable timeout for the initial connection
37+
ConnectTimeout = TimeSpan.FromSeconds(30)
38+
};
3439

3540
// Ignore certificate for https localhost repository.
3641
if (baseUri.Host == "localhost" && baseUri.Scheme == "https")

0 commit comments

Comments
 (0)