From: Radoslaw Zarzynski Date: Fri, 21 Apr 2017 15:34:05 +0000 (+0200) Subject: rgw: implement rgw::auth::s3::is_v4_payload_empty. X-Git-Tag: v12.1.0~155^2~33 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=47d014c1bdd2256569d9d7d441084941a64e896e;p=ceph.git rgw: implement rgw::auth::s3::is_v4_payload_empty. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_auth_s3.h b/src/rgw/rgw_auth_s3.h index 95e1acecc543..14ae5ae2f387 100644 --- a/src/rgw/rgw_auth_s3.h +++ b/src/rgw/rgw_auth_s3.h @@ -215,6 +215,17 @@ static inline bool is_v4_payload_unsigned(const char* const exp_payload_hash) return boost::string_ref("UNSIGNED-PAYLOAD").compare(exp_payload_hash) == 0; } +static inline bool is_v4_payload_empty(const req_state* const s) +{ + /* from rfc2616 - 4.3 Message Body + * + * "The presence of a message-body in a request is signaled by the inclusion + * of a Content-Length or Transfer-Encoding header field in the request's + * message-headers." */ + return s->content_length == 0 && + s->info.env->get("HTTP_TRANSFER_ENCODING") == nullptr; +} + static inline bool is_v4_payload_streamed(const char* const exp_payload_hash) { return boost::string_ref("STREAMING-AWS4-HMAC-SHA256-PAYLOAD").compare(exp_payload_hash) == 0;