Skip to content

Commit c33bc1e

Browse files
committed
chore(ota): allow a longer timeout when downloading packages (jetkvm#332)
1 parent 94ac128 commit c33bc1e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ota.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,15 @@ func downloadFile(ctx context.Context, path string, url string, downloadProgress
126126
return fmt.Errorf("error creating request: %w", err)
127127
}
128128

129-
resp, err := http.DefaultClient.Do(req)
129+
client := http.Client{
130+
// allow a longer timeout for the download but keep the TLS handshake short
131+
Timeout: 10 * time.Minute,
132+
Transport: &http.Transport{
133+
TLSHandshakeTimeout: 1 * time.Minute,
134+
},
135+
}
136+
137+
resp, err := client.Do(req)
130138
if err != nil {
131139
return fmt.Errorf("error downloading file: %w", err)
132140
}

0 commit comments

Comments
 (0)