From cb38303047db083f574edfd2c597858c0774d408 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 23 Oct 2018 13:32:20 -0700 Subject: [PATCH] rgw: pubsub: send missing http headers in certain rest requests PUT and DELETE requests still need to make sure http status code is returned. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_op.cc | 8 ++++++++ src/rgw/rgw_op.h | 5 +++++ src/rgw/rgw_sync_module_pubsub_rest.cc | 15 +++++++-------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index eab7fe7559f..e93a671bc40 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -6950,6 +6950,14 @@ std::ostream& RGWOp::gen_prefix(std::ostream& out) const return s->gen_prefix(out) << s->dialect << ':' << name() << ' '; } +void RGWDefaultResponseOp::send_response() { + if (op_ret) { + set_req_state_err(s, op_ret); + } + dump_errno(s); + end_header(s); +} + void RGWPutBucketPolicy::send_response() { if (op_ret) { diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index f993c350d26..c7deba36517 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -199,6 +199,11 @@ public: unsigned get_subsys() const override { return ceph_subsys_rgw; } }; +class RGWDefaultResponseOp : public RGWOp { +public: + void send_response() override; +}; + class RGWGetObj_Filter : public RGWGetDataCB { protected: diff --git a/src/rgw/rgw_sync_module_pubsub_rest.cc b/src/rgw/rgw_sync_module_pubsub_rest.cc index 96b8f050929..d8106df69b5 100644 --- a/src/rgw/rgw_sync_module_pubsub_rest.cc +++ b/src/rgw/rgw_sync_module_pubsub_rest.cc @@ -8,8 +8,7 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_rgw - -class RGWPSCreateTopicOp : public RGWOp { +class RGWPSCreateTopicOp : public RGWDefaultResponseOp { protected: std::unique_ptr ups; string topic_name; @@ -172,7 +171,7 @@ public: } }; -class RGWPSDeleteTopicOp : public RGWOp { +class RGWPSDeleteTopicOp : public RGWDefaultResponseOp { protected: string topic_name; std::unique_ptr ups; @@ -257,7 +256,7 @@ public: }; -class RGWPSCreateSubOp : public RGWOp { +class RGWPSCreateSubOp : public RGWDefaultResponseOp { protected: string sub_name; string topic_name; @@ -389,7 +388,7 @@ public: } }; -class RGWPSDeleteSubOp : public RGWOp { +class RGWPSDeleteSubOp : public RGWDefaultResponseOp { protected: string sub_name; string topic_name; @@ -438,7 +437,7 @@ public: } }; -class RGWPSAckSubEventOp : public RGWOp { +class RGWPSAckSubEventOp : public RGWDefaultResponseOp { protected: string sub_name; string event_id; @@ -633,7 +632,7 @@ static int notif_bucket_path(const string& path, string *bucket_name) return 0; } -class RGWPSCreateNotifOp : public RGWOp { +class RGWPSCreateNotifOp : public RGWDefaultResponseOp { protected: std::unique_ptr ups; string topic_name; @@ -712,7 +711,7 @@ public: } }; -class RGWPSDeleteNotifOp : public RGWOp { +class RGWPSDeleteNotifOp : public RGWDefaultResponseOp { protected: std::unique_ptr ups; string topic_name; -- 2.39.5