]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/civetweb: handle old clients with transfer-encoding: chunked. 50235/head
authorMarcus Watts <mwatts@redhat.com>
Fri, 8 May 2020 05:41:35 +0000 (01:41 -0400)
committerMark Kogan <mkogan@redhat.com>
Thu, 23 Feb 2023 14:47:55 +0000 (14:47 +0000)
s3 clients *should* provide an x-amz-decoded-content-length field
when they use transport-encoding: chunked.  Some clients do not.
With swift we already allow chunked uploads that do not specify the
content length in advance.   This commit adds similar support
for s3.  Known client affected by this: boto2.

Fixes: https://tracker.ceph.com/issues/45789
Resolves: rhbz#2152801

Signed-off-by: Marcus Watts <mwatts@redhat.com>
src/rgw/rgw_rest_s3.cc

index ccb8a397aec258ca2f87b4e1389de659a3b26fd6..cee0c8d45f146160e3718ac5d5921e4dc2dd9ece 100644 (file)
@@ -2516,8 +2516,15 @@ static inline void map_qs_metadata(req_state* s, bool crypto_too)
 
 int RGWPutObj_ObjStore_S3::get_params(optional_yield y)
 {
-  if (!s->length)
-    return -ERR_LENGTH_REQUIRED;
+  if (!s->length) {
+    const char *encoding = s->info.env->get("HTTP_TRANSFER_ENCODING");
+    if (!encoding || strcmp(encoding, "chunked") != 0) {
+      ldout(s->cct, 20) << "neither length nor chunked encoding" << dendl;
+      return -ERR_LENGTH_REQUIRED;
+    }
+
+    chunked_upload = true;
+  }
 
   int ret;