/*
GoCheese -- Python private package repository and caching proxy
-Copyright (C) 2019-2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2019-2022 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
"errors"
"hash"
"io"
- "io/ioutil"
"log"
"net/http"
"net/url"
http.Error(w, "PyPI has non 200 status code", http.StatusBadGateway)
return false
}
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
if err != nil {
resp.Body.Close()
log.Println("error", r.RemoteAddr, "refresh-json", pkgName, err)
return false
}
path := filepath.Join(dirPath, MDFile)
- existing, err := ioutil.ReadFile(path)
+ existing, err := os.ReadFile(path)
if err != nil || bytes.Compare(existing, buf.Bytes()) != 0 {
if err = WriteFileSync(dirPath, path, buf.Bytes(), now); err != nil {
log.Println("error", r.RemoteAddr, "refresh-json", path, err)
http.Error(w, "PyPI has non 200 status code", http.StatusBadGateway)
return false
}
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
log.Println("error", r.RemoteAddr, "refresh", pkgName, err)
http.Error(w, "digest mismatch", http.StatusBadGateway)
return false
}
- if digestStored, err := ioutil.ReadFile(path + "." + hashAlgo); err == nil &&
+ if digestStored, err := os.ReadFile(path + "." + hashAlgo); err == nil &&
bytes.Compare(digest, digestStored) != 0 {
err = errors.New("stored digest mismatch")
log.Println("error", r.RemoteAddr, "pypi", filename, err)
resp.Body.Close()
goto GPGSigSkip
}
- sig, err := ioutil.ReadAll(resp.Body)
+ sig, err := io.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
goto GPGSigSkip