From 391775b78e5c5e6ab6262a0ac0765160189c246b Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 10 Oct 2012 13:29:14 -0700 Subject: [PATCH] rgw: handle missing content length in POST Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_rest.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index d0bb4e405dc26..2b68a79b78aba 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -555,11 +555,12 @@ int RGWPostObj_ObjStore::verify_params() /* check that we have enough memory to store the object note that this test isn't exact and may fail unintentionally for large requests is */ - if (s->length) { - off_t len = atoll(s->length); - if (len > (off_t)RGW_MAX_PUT_SIZE) { - return -ERR_TOO_LARGE; - } + if (!s->length) { + return -ERR_LENGTH_REQUIRED; + } + off_t len = atoll(s->length); + if (len > (off_t)RGW_MAX_PUT_SIZE) { + return -ERR_TOO_LARGE; } return 0; -- 2.39.5