mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-26 11:34:04 -08:00
fix(font): improve font download timeouts
This commit is contained in:
parent
41e90d66c8
commit
2452475d8c
|
@ -8,6 +8,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
@ -37,10 +38,16 @@ func isZipFile(data []byte) bool {
|
|||
}
|
||||
|
||||
func getRemoteFile(location string) (data []byte, err error) {
|
||||
client := &http.Client{}
|
||||
ctx, cancelF := context.WithTimeout(context.Background(), time.Second*time.Duration(60))
|
||||
defer cancelF()
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", location, nil)
|
||||
client := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 10 * time.Second,
|
||||
}).Dial,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ResponseHeaderTimeout: 10 * time.Second,
|
||||
},
|
||||
}
|
||||
req, err := http.NewRequestWithContext(context.Background(), "GET", location, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue