void AWSv4ComplMulti::modify_request_state(req_state* const s_rw)
{
+ const char* const decoded_length = \
+ s_rw->info.env->get("HTTP_X_AMZ_DECODED_CONTENT_LENGTH");
+
+ if (!decoded_length) {
+ throw -EINVAL;
+ } else {
+ s_rw->length = decoded_length;
+ s_rw->content_length = parse_content_length(decoded_length);
+
+ if (s_rw->content_length < 0) {
+ ldout(cct, 10) << "negative AWSv4's content length, aborting" << dendl;
+ throw -EINVAL;
+ }
+ }
+
/* Install the filter over rgw::io::RestfulClient. */
AWS_AUTHv4_IO(s_rw)->add_filter(
std::static_pointer_cast<io_base_t>(shared_from_this()));
}
}
-#if 0
- if (!chunked_upload &&
- ofs != s->content_length &&
- !s->aws4_auth_streaming_mode) {
+ if (!chunked_upload && ofs != s->content_length) {
op_ret = -ERR_REQUEST_TIMEOUT;
goto done;
}
-#endif
s->obj_size = ofs;
perfcounter->inc(l_rgw_put_b, s->obj_size);
delete default_mgr;
}
-static int64_t parse_content_length(const char *content_length)
+int64_t parse_content_length(const char *content_length)
{
int64_t len = -1;
}
extern void dump_content_length(struct req_state *s, uint64_t len);
+extern int64_t parse_content_length(const char *content_length);
extern void dump_etag(struct req_state *s,
const boost::string_ref& etag,
bool quoted = false);