(r *http.Request, bodyLimit int64)
| 2282 | } |
| 2283 | |
| 2284 | func 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 | } |
no test coverage detected