mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 20:20:25 +03:00
handlers: read ContentLength value directly from http.Request.
Do not look for Content-Length in headers and try to convert them into integer representations use ContentLength field from *http.Request*. If Content-Length is understood to be as '-1' then treat it as an error condition, since it could be a malformed body to crash the server. Fixes #1011
This commit is contained in:
@@ -18,7 +18,6 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -36,17 +35,13 @@ func isValidMD5(md5 string) bool {
|
||||
|
||||
/// http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadingObjects.html
|
||||
const (
|
||||
// maximum object size per PUT request is 5GB
|
||||
// maximum object size per PUT request is 5GiB
|
||||
maxObjectSize = 1024 * 1024 * 1024 * 5
|
||||
)
|
||||
|
||||
// isMaxObjectSize - verify if max object size
|
||||
func isMaxObjectSize(size string) bool {
|
||||
i, err := strconv.ParseInt(size, 10, 64)
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
if i > maxObjectSize {
|
||||
func isMaxObjectSize(size int64) bool {
|
||||
if size > maxObjectSize {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user