MCPcopy Index your code
hub / github.com/cubefs/cubefs / VerifyContentLength

Function VerifyContentLength

objectnode/api_handler_object.go:2284–2300  ·  view source on GitHub ↗
(r *http.Request, bodyLimit int64)

Source from the content-addressed store, hash-verified

2282}
2283
2284func VerifyContentLength(r *http.Request, bodyLimit int64) (int64, *ErrorCode) {
2285 dcl := r.Header.Get(HeaderNameXAmzDecodedContentLength)
2286 length := r.ContentLength
2287 if dcl != "" {
2288 l, err := strconv.ParseInt(dcl, 10, 64)
2289 if err == nil {
2290 length = l
2291 }
2292 }
2293 if length > bodyLimit {
2294 return 0, EntityTooLarge
2295 }
2296 if length < 0 {
2297 return 0, MissingContentLength
2298 }
2299 return length, nil
2300}

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected