} while ( len > 0);
drain_pending(pending);
- if ((uint64_t)ofs != s->content_length) {
+ if (!chunked_upload && (uint64_t)ofs != s->content_length) {
ret = -ERR_REQUEST_TIMEOUT;
goto done_err;
}
const char *supplied_md5_b64;
const char *supplied_etag;
string etag;
+ bool chunked_upload;
public:
RGWPutObj() {}
supplied_md5_b64 = NULL;
supplied_etag = NULL;
etag = "";
+ chunked_upload = false;
}
int verify_permission();
void execute();
switch (s->op) {
case OP_PUT:
if (s->object && !s->args.sub_resource_exists("acl")) {
- if (!s->length)
- ret = -ERR_LENGTH_REQUIRED;
- else if (*s->length == '\0')
+ if (s->length && *s->length == '\0')
ret = -EINVAL;
}
if (s->length)
end_header(s);
}
+int RGWPutObj_REST_S3::get_params()
+{
+ if (!s->length)
+ return -ERR_LENGTH_REQUIRED;
+
+ return RGWPutObj_REST::get_params();
+}
+
void RGWPutObj_REST_S3::send_response()
{
if (ret) {
dout(15) << "b64=" << b64 << dendl;
dout(15) << "auth_sign=" << auth_sign << dendl;
dout(15) << "compare=" << auth_sign.compare(b64) << dendl;
+
if (auth_sign.compare(b64) != 0)
return -EPERM;
RGWPutObj_REST_S3() {}
~RGWPutObj_REST_S3() {}
+ int get_params();
void send_response();
};
if (s->has_bad_meta)
return -EINVAL;
+ if (!s->length) {
+ const char *encoding = s->env->get("HTTP_TRANSFER_ENCODING");
+dout(0) << "encoding=" << (void *)encoding << dendl;
+ if (strcmp(encoding, "chunked") != 0)
+ return -ERR_LENGTH_REQUIRED;
+dout(0) << "encoding=" << encoding << dendl;
+
+ chunked_upload = true;
+ }
+
supplied_etag = s->env->get("HTTP_ETAG");
return RGWPutObj_REST::get_params();
}