Fix subnet login during registration not working (#3841)

Subnet doesn't return `ContentLength` in it's api response, and hence
using it as the limit with `LimitReader` doesn't work. Fixed by using a
sufficiently large (1 MiB) limit.
This commit is contained in:
Shireesh Anjal
2021-10-20 21:15:00 -07:00
committed by GitHub
parent b493f01699
commit b9bfcb50a3
+5 -2
View File
@@ -41,7 +41,10 @@ import (
"golang.org/x/crypto/ssh/terminal"
)
const minioSubscriptionURL = "https://min.io/subscription"
const (
subnetRespBodyLimit = 1 << 20 // 1 MiB
minioSubscriptionURL = "https://min.io/subscription"
)
var subnetCommonFlags = []cli.Flag{
cli.StringFlag{
@@ -158,7 +161,7 @@ func subnetExecReq(r *http.Request, headers map[string]string) (string, error) {
}
defer resp.Body.Close()
respBytes, e := ioutil.ReadAll(io.LimitReader(resp.Body, resp.ContentLength))
respBytes, e := ioutil.ReadAll(io.LimitReader(resp.Body, subnetRespBodyLimit))
if e != nil {
return "", e
}