]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: implement rgw::auth::s3::is_v4_payload_empty.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Fri, 21 Apr 2017 15:34:05 +0000 (17:34 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Wed, 7 Jun 2017 10:43:17 +0000 (12:43 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_auth_s3.h

index 95e1acecc543e7488ac219fd7241dc6c402b6970..14ae5ae2f38781b56802a184f025ab07e0dc48b9 100644 (file)
@@ -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;