summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_cr_rest.h
diff options
context:
space:
mode:
authorAbhishek Lekshmanan <abhishek@suse.com>2017-03-27 15:06:23 +0200
committerYehuda Sadeh <yehuda@redhat.com>2018-04-10 17:03:10 +0200
commitb685e588b656172c111d72a72f705ce67493d7eb (patch)
tree122ebe26e41408ed9bfd4d633880219b37591f24 /src/rgw/rgw_cr_rest.h
parentrgw_aws_module: lets call put object and see what happens (diff)
downloadceph-b685e588b656172c111d72a72f705ce67493d7eb.tar.xz
ceph-b685e588b656172c111d72a72f705ce67493d7eb.zip
rgw_cr_rest: send content length on raw requests
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
Diffstat (limited to 'src/rgw/rgw_cr_rest.h')
-rw-r--r--src/rgw/rgw_cr_rest.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/rgw/rgw_cr_rest.h b/src/rgw/rgw_cr_rest.h
index 165b4fa85a6..812e3f08451 100644
--- a/src/rgw/rgw_cr_rest.h
+++ b/src/rgw/rgw_cr_rest.h
@@ -94,17 +94,17 @@ class RGWSendRawRESTResourceCR: public RGWSimpleCoroutine {
param_vec_t params;
T *result;
bufferlist input_bl;
-
+ bool send_content_length=false;
boost::intrusive_ptr<RGWRESTSendResource> http_op;
public:
RGWSendRawRESTResourceCR(CephContext *_cct, RGWRESTConn *_conn,
RGWHTTPManager *_http_manager,
const string& _method, const string& _path,
- rgw_http_param_pair *_params, bufferlist& _input, T *_result)
+ rgw_http_param_pair *_params, bufferlist& _input, T *_result, bool _send_content_length)
: RGWSimpleCoroutine(_cct), conn(_conn), http_manager(_http_manager),
method(_method), path(_path), params(make_param_list(_params)), result(_result),
- input_bl(_input)
+ input_bl(_input), send_content_length(_send_content_length)
{}
RGWSendRawRESTResourceCR(CephContext *_cct, RGWRESTConn *_conn,
@@ -126,8 +126,15 @@ class RGWSendRawRESTResourceCR: public RGWSimpleCoroutine {
}
int send_request() override {
+ param_vec_t p;
+ if (send_content_length){
+ lsubdout(cct, rgw, 0) << "abhi: sending content length of " << input_bl.length() << dendl;
+ string content_length = to_string(input_bl.length());
+ p.push_back(param_pair_t("CONTENT_LENGTH",content_length));
+ }
+
auto op = boost::intrusive_ptr<RGWRESTSendResource>(
- new RGWRESTSendResource(conn, method, path, params, NULL, http_manager));
+ new RGWRESTSendResource(conn, method, path, params, &p, http_manager));
op->set_user_info((void *)stack);
@@ -209,7 +216,7 @@ class RGWPutRawRESTResourceCR: public RGWSendRawRESTResourceCR <T> {
RGWHTTPManager *_http_manager,
const string& _path,
rgw_http_param_pair *_params, bufferlist& _input, T *_result)
- : RGWSendRawRESTResourceCR<T>(_cct, _conn, _http_manager, "PUT", _path, _params, _input, _result){}
+ : RGWSendRawRESTResourceCR<T>(_cct, _conn, _http_manager, "PUT", _path, _params, _input, _result, true){}
};
@@ -222,8 +229,8 @@ public:
const string& _path,
rgw_http_param_pair *_params, S& _input, T *_result)
: RGWSendRESTResourceCR<S, T>(_cct, _conn, _http_manager,
- "PUT", _path,
- _params, _input, _result) {}
+ "PUT", _path,
+ _params, _input, _result) {}
};
class RGWDeleteRESTResourceCR : public RGWSimpleCoroutine {