mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-10 20:22:31 +02:00
Fix dowloading timeout configuration
This commit is contained in:
@@ -188,4 +188,5 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initVips()
|
initVips()
|
||||||
|
initDownloading()
|
||||||
}
|
}
|
||||||
|
10
download.go
10
download.go
@@ -18,9 +18,7 @@ import (
|
|||||||
_ "golang.org/x/image/webp"
|
_ "golang.org/x/image/webp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var downloadClient = http.Client{
|
var downloadClient *http.Client
|
||||||
Timeout: time.Duration(conf.DownloadTimeout) * time.Second,
|
|
||||||
}
|
|
||||||
|
|
||||||
type netReader struct {
|
type netReader struct {
|
||||||
reader *bufio.Reader
|
reader *bufio.Reader
|
||||||
@@ -57,6 +55,12 @@ func (r *netReader) GrowBuf(s int) {
|
|||||||
r.buf.Grow(s)
|
r.buf.Grow(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func initDownloading() {
|
||||||
|
downloadClient = &http.Client{
|
||||||
|
Timeout: time.Duration(conf.DownloadTimeout) * time.Second,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func checkTypeAndDimensions(r io.Reader) (imageType, error) {
|
func checkTypeAndDimensions(r io.Reader) (imageType, error) {
|
||||||
imgconf, imgtypeStr, err := image.DecodeConfig(r)
|
imgconf, imgtypeStr, err := image.DecodeConfig(r)
|
||||||
imgtype, imgtypeOk := imageTypes[imgtypeStr]
|
imgtype, imgtypeOk := imageTypes[imgtypeStr]
|
||||||
|
Reference in New Issue
Block a user