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:
+5
-2
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user