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