From: Radoslaw Zarzynski Date: Tue, 11 Oct 2016 14:07:21 +0000 (+0200) Subject: rgw: add support for dispatching requests with respect to frontend prefix. X-Git-Tag: v11.1.0~454^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=abccedc3bf6c13d671c3e0e6aa4f8b3959be8aba;p=ceph.git rgw: add support for dispatching requests with respect to frontend prefix. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index 0b8f436585c2..b785e7b07b7a 100644 --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@ -99,7 +99,8 @@ class AsioConnection : public std::enable_shared_from_this { rgw::io::add_conlen_controlling( &real_client)))); RGWRestfulIO client(&real_client_io); - process_request(env.store, env.rest, &req, &client, env.olog); + process_request(env.store, env.rest, &req, env.uri_prefix, &client, + env.olog); } void write_bad_request() { diff --git a/src/rgw/rgw_civetweb_frontend.cc b/src/rgw/rgw_civetweb_frontend.cc index cda10f027fbe..e0adeb8040f6 100644 --- a/src/rgw/rgw_civetweb_frontend.cc +++ b/src/rgw/rgw_civetweb_frontend.cc @@ -30,7 +30,8 @@ int RGWCivetWebFrontend::process(struct mg_connection* const conn) RGWCivetWeb(conn, env.port))))); RGWRestfulIO client_io(&real_client_io); - int ret = process_request(env.store, env.rest, &req, &client_io, env.olog); + int ret = process_request(env.store, env.rest, &req, env.uri_prefix, + &client_io, env.olog); if (ret < 0) { /* We don't really care about return code. */ dout(20) << "process_request() returned " << ret << dendl; diff --git a/src/rgw/rgw_fcgi_process.cc b/src/rgw/rgw_fcgi_process.cc index 20bb3e2b0b0f..5dffbfb0f8c2 100644 --- a/src/rgw/rgw_fcgi_process.cc +++ b/src/rgw/rgw_fcgi_process.cc @@ -123,7 +123,7 @@ void RGWFCGXProcess::handle_request(RGWRequest* r) RGWRestfulIO client_io(&real_client_io); - int ret = process_request(store, rest, req, &client_io, olog); + int ret = process_request(store, rest, req, uri_prefix, &client_io, olog); if (ret < 0) { /* we don't really care about return code */ dout(20) << "process_request() returned " << ret << dendl; diff --git a/src/rgw/rgw_loadgen_process.cc b/src/rgw/rgw_loadgen_process.cc index d857d6c540e7..62a4ebd52bcb 100644 --- a/src/rgw/rgw_loadgen_process.cc +++ b/src/rgw/rgw_loadgen_process.cc @@ -131,7 +131,7 @@ void RGWLoadGenProcess::handle_request(RGWRequest* r) RGWLoadGenIO real_client_io(&env); RGWRestfulIO client_io(&real_client_io); - int ret = process_request(store, rest, req, &client_io, olog); + int ret = process_request(store, rest, req, uri_prefix, &client_io, olog); if (ret < 0) { /* we don't really care about return code */ dout(20) << "process_request() returned " << ret << dendl; diff --git a/src/rgw/rgw_process.cc b/src/rgw/rgw_process.cc index 08c8ce01e153..55c390aae58f 100644 --- a/src/rgw/rgw_process.cc +++ b/src/rgw/rgw_process.cc @@ -109,8 +109,12 @@ int rgw_process_authenticated(RGWHandler_REST * const handler, return 0; } -int process_request(RGWRados* store, RGWREST* rest, RGWRequest* req, - RGWRestfulIO* client_io, OpsLogSocket* olog) +int process_request(RGWRados* const store, + RGWREST* const rest, + RGWRequest* const req, + const std::string& frontend_prefix, + RGWRestfulIO* const client_io, + OpsLogSocket* const olog) { int ret = 0; @@ -142,8 +146,8 @@ int process_request(RGWRados* store, RGWREST* rest, RGWRequest* req, int init_error = 0; bool should_log = false; RGWRESTMgr *mgr; - RGWHandler_REST *handler = rest->get_handler(store, s, client_io, &mgr, - &init_error); + RGWHandler_REST *handler = rest->get_handler(store, s, frontend_prefix, + client_io, &mgr, &init_error); if (init_error != 0) { abort_early(s, NULL, init_error, NULL); goto done; diff --git a/src/rgw/rgw_process.h b/src/rgw/rgw_process.h index 8e3c71af4420..eed49b805516 100644 --- a/src/rgw/rgw_process.h +++ b/src/rgw/rgw_process.h @@ -45,6 +45,7 @@ protected: RGWREST* rest; RGWFrontendConfig* conf; int sock_fd; + std::string uri_prefix; struct RGWWQ : public ThreadPool::WorkQueue { RGWProcess* process; @@ -96,16 +97,24 @@ protected: } req_wq; public: - RGWProcess(CephContext* cct, RGWProcessEnv* pe, int num_threads, - RGWFrontendConfig* _conf) - : cct(cct), store(pe->store), olog(pe->olog), + RGWProcess(CephContext* const cct, + RGWProcessEnv* const pe, + const int num_threads, + RGWFrontendConfig* const conf) + : cct(cct), + store(pe->store), + olog(pe->olog), m_tp(cct, "RGWProcess::m_tp", "tp_rgw_process", num_threads), req_throttle(cct, "rgw_ops", num_threads * 2), - rest(pe->rest), conf(_conf), sock_fd(-1), + rest(pe->rest), + conf(conf), + sock_fd(-1), + uri_prefix(pe->uri_prefix), req_wq(this, g_conf->rgw_op_thread_timeout, - g_conf->rgw_op_thread_suicide_timeout, &m_tp) {} + g_conf->rgw_op_thread_suicide_timeout, &m_tp) { + } - virtual ~RGWProcess() {} + virtual ~RGWProcess() = default; virtual void run() = 0; virtual void handle_request(RGWRequest *req) = 0; @@ -129,7 +138,6 @@ public: class RGWFCGXProcess : public RGWProcess { int max_connections; - std::string uri_prefix; public: /* have a bit more connections than threads so that requests are @@ -137,12 +145,10 @@ public: RGWFCGXProcess(CephContext* const cct, RGWProcessEnv* const pe, const int num_threads, - RGWFrontendConfig* const _conf) - : RGWProcess(cct, pe, num_threads, _conf), - max_connections(num_threads + (num_threads >> 3)), - /* We shouldn't mess with our parents by std::moving here. */ - uri_prefix(pe->uri_prefix) - {} + RGWFrontendConfig* const conf) + : RGWProcess(cct, pe, num_threads, conf), + max_connections(num_threads + (num_threads >> 3)) { + } void run(); void handle_request(RGWRequest* req); @@ -178,7 +184,8 @@ public: extern int process_request(RGWRados* store, RGWREST* rest, RGWRequest* req, - RGWRestfulIO* client_io, + const std::string& frontend_prefix, + RGWRestfulIO* client_io, OpsLogSocket* olog); extern int rgw_process_authenticated(RGWHandler_REST* handler, diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index d22ee87c4f88..23ac325566bd 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -1748,7 +1748,9 @@ void RGWRESTMgr::register_default_mgr(RGWRESTMgr *mgr) default_mgr = mgr; } -RGWRESTMgr *RGWRESTMgr::get_resource_mgr(struct req_state *s, const string& uri, string *out_uri) +RGWRESTMgr* RGWRESTMgr::get_resource_mgr(struct req_state* const s, + const std::string& uri, + std::string* const out_uri) { *out_uri = uri; @@ -1759,7 +1761,7 @@ RGWRESTMgr *RGWRESTMgr::get_resource_mgr(struct req_state *s, const string& uri, if (uri.compare(0, iter->first, resource) == 0 && (uri.size() == iter->first || uri[iter->first] == '/')) { - string suffix = uri.substr(iter->first); + std::string suffix = uri.substr(iter->first); return resource_mgrs[resource]->get_resource_mgr(s, suffix, out_uri); } } @@ -2042,34 +2044,38 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) return 0; } -RGWHandler_REST* RGWREST::get_handler(RGWRados *store, struct req_state *s, - RGWRestfulIO *rio, RGWRESTMgr **pmgr, - int *init_error) +RGWHandler_REST* RGWREST::get_handler(RGWRados * const store, + struct req_state* const s, + const std::string& frontend_prefix, + RGWRestfulIO* const rio, + RGWRESTMgr** const pmgr, + int* const init_error) { - RGWHandler_REST* handler; - *init_error = preprocess(s, rio); - if (*init_error < 0) - return NULL; + if (*init_error < 0) { + return nullptr; + } - RGWRESTMgr *m = mgr.get_resource_mgr(s, s->decoded_uri, &s->relative_uri); - if (!m) { + RGWRESTMgr *m = mgr.get_manager(s, frontend_prefix, s->decoded_uri, + &s->relative_uri); + if (! m) { *init_error = -ERR_METHOD_NOT_ALLOWED; - return NULL; + return nullptr; } - if (pmgr) + if (pmgr) { *pmgr = m; + } - handler = m->get_handler(s); - if (!handler) { + RGWHandler_REST* handler = m->get_handler(s, frontend_prefix); + if (! handler) { *init_error = -ERR_METHOD_NOT_ALLOWED; return NULL; } *init_error = handler->init(store, s, rio); if (*init_error < 0) { m->put_handler(handler); - return NULL; + return nullptr; } return handler; diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index 32c7fdbee408..ec178d246d87 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -444,6 +444,16 @@ protected: std::multimap resources_by_size; RGWRESTMgr* default_mgr; + virtual RGWRESTMgr* get_resource_mgr(struct req_state* s, + const std::string& uri, + std::string* out_uri); + + virtual RGWRESTMgr* get_resource_mgr_as_default(struct req_state* const s, + const std::string& uri, + std::string* our_uri) { + return this; + } + public: RGWRESTMgr() : should_log(false), @@ -451,24 +461,34 @@ public: } virtual ~RGWRESTMgr(); - void register_resource(string resource, RGWRESTMgr *mgr); - void register_default_mgr(RGWRESTMgr *mgr); + void register_resource(std::string resource, RGWRESTMgr* mgr); + void register_default_mgr(RGWRESTMgr* mgr); - virtual RGWRESTMgr* get_resource_mgr(struct req_state *s, - const std::string& uri, - std::string* out_uri); + virtual RGWRESTMgr* get_manager(struct req_state* const s, + /* Prefix to be concatenated with @uri + * during the lookup. */ + const std::string& frontend_prefix, + const std::string& uri, + std::string* out_uri) final { + return get_resource_mgr(s, frontend_prefix + uri, out_uri); + } - virtual RGWRESTMgr* get_resource_mgr_as_default(struct req_state* s, - const std::string& uri, - std::string* our_uri) { - return this; + virtual RGWHandler_REST* get_handler(struct req_state* const s, + const std::string& frontend_prefix) { + return nullptr; } - virtual RGWHandler_REST *get_handler(struct req_state *s) { return NULL; } - virtual void put_handler(RGWHandler_REST *handler) { delete handler; } + virtual void put_handler(RGWHandler_REST* const handler) { + delete handler; + } + + void set_logging(bool _should_log) { + should_log = _should_log; + } - void set_logging(bool _should_log) { should_log = _should_log; } - bool get_logging() { return should_log; } + bool get_logging() const { + return should_log; + } }; class RGWLibIO; @@ -482,6 +502,7 @@ public: RGWREST() {} RGWHandler_REST *get_handler(RGWRados *store, struct req_state *s, + const std::string& frontend_prefix, RGWRestfulIO *rio, RGWRESTMgr **pmgr, int *init_error); diff --git a/src/rgw/rgw_rest_bucket.h b/src/rgw/rgw_rest_bucket.h index 227ef914d3af..547bc9e7a9b3 100644 --- a/src/rgw/rgw_rest_bucket.h +++ b/src/rgw/rgw_rest_bucket.h @@ -25,10 +25,11 @@ public: class RGWRESTMgr_Bucket : public RGWRESTMgr { public: - RGWRESTMgr_Bucket() {} - virtual ~RGWRESTMgr_Bucket() {} + RGWRESTMgr_Bucket() = default; + virtual ~RGWRESTMgr_Bucket() = default; - RGWHandler_REST* get_handler(struct req_state *s) { + RGWHandler_REST* get_handler(struct req_state*, + const std::string&) override { return new RGWHandler_Bucket; } }; diff --git a/src/rgw/rgw_rest_config.h b/src/rgw/rgw_rest_config.h index fe7f0272b0c2..e9fcfd79ca6c 100644 --- a/src/rgw/rgw_rest_config.h +++ b/src/rgw/rgw_rest_config.h @@ -51,10 +51,11 @@ public: class RGWRESTMgr_Config : public RGWRESTMgr { public: - RGWRESTMgr_Config() {} - virtual ~RGWRESTMgr_Config() {} + RGWRESTMgr_Config() = default; + virtual ~RGWRESTMgr_Config() = default; - virtual RGWHandler_REST* get_handler(struct req_state *s){ + RGWHandler_REST* get_handler(struct req_state*, + const std::string&) override { return new RGWHandler_Config; } }; diff --git a/src/rgw/rgw_rest_log.h b/src/rgw/rgw_rest_log.h index c5e94f6232ea..cf972a02d4d6 100644 --- a/src/rgw/rgw_rest_log.h +++ b/src/rgw/rgw_rest_log.h @@ -321,10 +321,11 @@ public: class RGWRESTMgr_Log : public RGWRESTMgr { public: - RGWRESTMgr_Log() {} - virtual ~RGWRESTMgr_Log() {} + RGWRESTMgr_Log() = default; + virtual ~RGWRESTMgr_Log() = default; - virtual RGWHandler_REST* get_handler(struct req_state *s){ + RGWHandler_REST* get_handler(struct req_state* const, + const std::string& frontend_prefixs) override { return new RGWHandler_Log; } }; diff --git a/src/rgw/rgw_rest_metadata.h b/src/rgw/rgw_rest_metadata.h index 2511b9bfa620..d0272f4b2b74 100644 --- a/src/rgw/rgw_rest_metadata.h +++ b/src/rgw/rgw_rest_metadata.h @@ -113,10 +113,11 @@ public: class RGWRESTMgr_Metadata : public RGWRESTMgr { public: - RGWRESTMgr_Metadata() {} - virtual ~RGWRESTMgr_Metadata() {} + RGWRESTMgr_Metadata() = default; + virtual ~RGWRESTMgr_Metadata() = default; - virtual RGWHandler_REST* get_handler(struct req_state *s){ + RGWHandler_REST* get_handler(struct req_state* const s, + const std::string& frontend_prefix) override { return new RGWHandler_Metadata; } }; diff --git a/src/rgw/rgw_rest_opstate.h b/src/rgw/rgw_rest_opstate.h index 1a8076c68762..632ef26c2e1b 100644 --- a/src/rgw/rgw_rest_opstate.h +++ b/src/rgw/rgw_rest_opstate.h @@ -98,10 +98,11 @@ public: class RGWRESTMgr_Opstate : public RGWRESTMgr { public: - RGWRESTMgr_Opstate() {} - virtual ~RGWRESTMgr_Opstate() {} + RGWRESTMgr_Opstate() = default; + virtual ~RGWRESTMgr_Opstate() = default; - virtual RGWHandler_REST* get_handler(struct req_state *s){ + RGWHandler_REST* get_handler(struct req_state*, + const std::string&) override { return new RGWHandler_Opstate; } }; diff --git a/src/rgw/rgw_rest_realm.cc b/src/rgw/rgw_rest_realm.cc index 008ab10d633b..99fd60b1d06f 100644 --- a/src/rgw/rgw_rest_realm.cc +++ b/src/rgw/rgw_rest_realm.cc @@ -228,7 +228,8 @@ class RGWHandler_Period : public RGWHandler_Auth_S3 { class RGWRESTMgr_Period : public RGWRESTMgr { public: - RGWHandler_REST* get_handler(struct req_state*) override { + RGWHandler_REST* get_handler(struct req_state*, + const std::string&) override { return new RGWHandler_Period; } }; @@ -285,7 +286,8 @@ RGWRESTMgr_Realm::RGWRESTMgr_Realm() register_resource("period", new RGWRESTMgr_Period); } -RGWHandler_REST* RGWRESTMgr_Realm::get_handler(struct req_state*) +RGWHandler_REST* RGWRESTMgr_Realm::get_handler(struct req_state*, + const std::string&) { return new RGWHandler_Realm; } diff --git a/src/rgw/rgw_rest_realm.h b/src/rgw/rgw_rest_realm.h index cb61594595d8..6d554949556d 100644 --- a/src/rgw/rgw_rest_realm.h +++ b/src/rgw/rgw_rest_realm.h @@ -10,7 +10,8 @@ class RGWRESTMgr_Realm : public RGWRESTMgr { public: RGWRESTMgr_Realm(); - RGWHandler_REST* get_handler(struct req_state*) override; + RGWHandler_REST* get_handler(struct req_state*, + const std::string&) override; }; #endif diff --git a/src/rgw/rgw_rest_replica_log.h b/src/rgw/rgw_rest_replica_log.h index 76ccc3fcb7ca..a264cb7986e9 100644 --- a/src/rgw/rgw_rest_replica_log.h +++ b/src/rgw/rgw_rest_replica_log.h @@ -144,10 +144,11 @@ public: class RGWRESTMgr_ReplicaLog : public RGWRESTMgr { public: - RGWRESTMgr_ReplicaLog() {} - virtual ~RGWRESTMgr_ReplicaLog() {} + RGWRESTMgr_ReplicaLog() = default; + virtual ~RGWRESTMgr_ReplicaLog() = default; - virtual RGWHandler_REST* get_handler(struct req_state *s){ + RGWHandler_REST* get_handler(struct req_state*, + const std::string&) override { return new RGWHandler_ReplicaLog; } }; diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 7f4f3c22d2cf..00ed83b3582f 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -4145,7 +4145,8 @@ int RGWHandler_Auth_S3::init(RGWRados *store, struct req_state *state, return RGWHandler_REST::init(store, state, cio); } -RGWHandler_REST* RGWRESTMgr_S3::get_handler(struct req_state *s) +RGWHandler_REST* RGWRESTMgr_S3::get_handler(struct req_state* const s, + const std::string& frontend_prefix) { bool is_s3website = enable_s3website && (s->prot_flags & RGW_REST_WEBSITE); int ret = diff --git a/src/rgw/rgw_rest_s3.h b/src/rgw/rgw_rest_s3.h index 6793f5fdaf7d..60218792c42d 100644 --- a/src/rgw/rgw_rest_s3.h +++ b/src/rgw/rgw_rest_s3.h @@ -566,13 +566,14 @@ class RGWRESTMgr_S3 : public RGWRESTMgr { private: bool enable_s3website; public: - explicit RGWRESTMgr_S3(bool _enable_s3website = false) - : enable_s3website(_enable_s3website) - {} + explicit RGWRESTMgr_S3(bool enable_s3website = false) + : enable_s3website(enable_s3website) { + } - virtual ~RGWRESTMgr_S3() {} + virtual ~RGWRESTMgr_S3() = default; - virtual RGWHandler_REST *get_handler(struct req_state *s); + RGWHandler_REST *get_handler(struct req_state* s, + const std::string& frontend_prefix) override; }; class RGWHandler_REST_Obj_S3Website; diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index 64995b1fcc3f..d19ff7e01ede 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -2224,14 +2224,18 @@ static void next_tok(string& str, string& tok, char delim) } } -int RGWHandler_REST_SWIFT::init_from_header(struct req_state *s) +int RGWHandler_REST_SWIFT::init_from_header(struct req_state* const s, + const std::string& frontend_prefix) { string req; string first; s->prot_flags |= RGW_REST_SWIFT; - const char *req_name = s->decoded_uri.c_str(); + char reqbuf[frontend_prefix.length() + s->decoded_uri.length() + 1]; + sprintf(reqbuf, "%s%s", frontend_prefix.c_str(), s->decoded_uri.c_str()); + const char *req_name = reqbuf; + const char *p; if (*req_name == '?') { @@ -2290,8 +2294,7 @@ int RGWHandler_REST_SWIFT::init_from_header(struct req_state *s) g_conf->rgw_swift_url_prefix.c_str(), tenant_path.c_str()); } - if (s->decoded_uri[0] != '/' || - s->decoded_uri.compare(0, blen, buf) != 0) { + if (strncmp(reqbuf, buf, blen) != 0) { return -ENOENT; } @@ -2387,14 +2390,18 @@ int RGWHandler_REST_SWIFT::init(RGWRados* store, struct req_state* s, return RGWHandler_REST::init(store, s, cio); } -RGWHandler_REST* RGWRESTMgr_SWIFT::get_handler(struct req_state *s) +RGWHandler_REST* RGWRESTMgr_SWIFT::get_handler(struct req_state* const s, + const std::string& frontend_prefix) { - int ret = RGWHandler_REST_SWIFT::init_from_header(s); - if (ret < 0) - return NULL; + int ret = RGWHandler_REST_SWIFT::init_from_header(s, frontend_prefix); + if (ret < 0) { + ldout(s->cct, 10) << "init_from_header returned err=" << ret << dendl; + return nullptr; + } - if (s->init_state.url_bucket.empty()) + if (s->init_state.url_bucket.empty()) { return new RGWHandler_REST_Service_SWIFT; + } if (s->object.empty()) { return new RGWHandler_REST_Bucket_SWIFT; @@ -2403,7 +2410,9 @@ RGWHandler_REST* RGWRESTMgr_SWIFT::get_handler(struct req_state *s) return new RGWHandler_REST_Obj_SWIFT; } -RGWHandler_REST* RGWRESTMgr_SWIFT_Info::get_handler(struct req_state *s) +RGWHandler_REST* RGWRESTMgr_SWIFT_Info::get_handler( + struct req_state* const s, + const std::string& frontend_prefix) { s->prot_flags |= RGW_REST_SWIFT; return new RGWHandler_REST_SWIFT_Info; diff --git a/src/rgw/rgw_rest_swift.h b/src/rgw/rgw_rest_swift.h index 4cc68ef6a07f..a6ad103905a0 100644 --- a/src/rgw/rgw_rest_swift.h +++ b/src/rgw/rgw_rest_swift.h @@ -259,7 +259,8 @@ protected: return false; } - static int init_from_header(struct req_state *s); + static int init_from_header(struct req_state* s, + const std::string& frontend_prefix); public: RGWHandler_REST_SWIFT() {} virtual ~RGWHandler_REST_SWIFT() {} @@ -360,17 +361,19 @@ public: }; class RGWRESTMgr_SWIFT : public RGWRESTMgr { -public: - RGWRESTMgr_SWIFT() {} - virtual ~RGWRESTMgr_SWIFT() {} - - RGWHandler_REST *get_handler(struct req_state *s) override; - - RGWRESTMgr* get_resource_mgr_as_default(struct req_state* s, +protected: + RGWRESTMgr* get_resource_mgr_as_default(struct req_state* const s, const std::string& uri, - std::string* out_uri) override { + std::string* const out_uri) override { return this->get_resource_mgr(s, uri, out_uri); } + +public: + RGWRESTMgr_SWIFT() = default; + virtual ~RGWRESTMgr_SWIFT() = default; + + RGWHandler_REST *get_handler(struct req_state *s, + const std::string& frontend_prefix) override; }; @@ -428,17 +431,19 @@ public: }; class RGWRESTMgr_SWIFT_CrossDomain : public RGWRESTMgr { -public: - RGWRESTMgr_SWIFT_CrossDomain() = default; - ~RGWRESTMgr_SWIFT_CrossDomain() = default; - +protected: RGWRESTMgr *get_resource_mgr(struct req_state* const s, const std::string& uri, std::string* const out_uri) override { return this; } - RGWHandler_REST* get_handler(struct req_state* const s) override { +public: + RGWRESTMgr_SWIFT_CrossDomain() = default; + ~RGWRESTMgr_SWIFT_CrossDomain() = default; + + RGWHandler_REST* get_handler(struct req_state* const s, + const std::string&) override { s->prot_flags |= RGW_REST_SWIFT; return new RGWHandler_SWIFT_CrossDomain; } @@ -481,17 +486,19 @@ public: }; class RGWRESTMgr_SWIFT_HealthCheck : public RGWRESTMgr { -public: - RGWRESTMgr_SWIFT_HealthCheck() = default; - ~RGWRESTMgr_SWIFT_HealthCheck() = default; - +protected: RGWRESTMgr *get_resource_mgr(struct req_state* const s, const std::string& uri, std::string* const out_uri) override { return this; } - RGWHandler_REST* get_handler(struct req_state* const s) override { +public: + RGWRESTMgr_SWIFT_HealthCheck() = default; + ~RGWRESTMgr_SWIFT_HealthCheck() = default; + + RGWHandler_REST* get_handler(struct req_state* const s, + const std::string&) override { s->prot_flags |= RGW_REST_SWIFT; return new RGWHandler_SWIFT_HealthCheck; } @@ -534,7 +541,9 @@ class RGWRESTMgr_SWIFT_Info : public RGWRESTMgr { public: RGWRESTMgr_SWIFT_Info() = default; virtual ~RGWRESTMgr_SWIFT_Info() = default; - virtual RGWHandler_REST *get_handler(struct req_state *s) override; + + RGWHandler_REST *get_handler(struct req_state* s, + const std::string& frontend_prefix) override; }; #endif diff --git a/src/rgw/rgw_rest_usage.h b/src/rgw/rgw_rest_usage.h index e0963803f07f..bc9d532db35b 100644 --- a/src/rgw/rgw_rest_usage.h +++ b/src/rgw/rgw_rest_usage.h @@ -23,10 +23,11 @@ public: class RGWRESTMgr_Usage : public RGWRESTMgr { public: - RGWRESTMgr_Usage() {} - virtual ~RGWRESTMgr_Usage() {} + RGWRESTMgr_Usage() = default; + virtual ~RGWRESTMgr_Usage() = default; - RGWHandler_REST* get_handler(struct req_state *s) { + RGWHandler_REST* get_handler(struct req_state*, + const std::string&) override { return new RGWHandler_Usage; } }; diff --git a/src/rgw/rgw_rest_user.h b/src/rgw/rgw_rest_user.h index d3c399bb97a6..4074ae600714 100644 --- a/src/rgw/rgw_rest_user.h +++ b/src/rgw/rgw_rest_user.h @@ -25,10 +25,11 @@ public: class RGWRESTMgr_User : public RGWRESTMgr { public: - RGWRESTMgr_User() {} - virtual ~RGWRESTMgr_User() {} + RGWRESTMgr_User() = default; + virtual ~RGWRESTMgr_User() = default; - RGWHandler_REST *get_handler(struct req_state *s) { + RGWHandler_REST *get_handler(struct req_state*, + const std::string&) override { return new RGWHandler_User; } }; diff --git a/src/rgw/rgw_swift_auth.h b/src/rgw/rgw_swift_auth.h index c4c7d0a076ee..4b1fa17b22bf 100644 --- a/src/rgw/rgw_swift_auth.h +++ b/src/rgw/rgw_swift_auth.h @@ -151,13 +151,17 @@ public: class RGWRESTMgr_SWIFT_Auth : public RGWRESTMgr { public: - RGWRESTMgr_SWIFT_Auth() {} - virtual ~RGWRESTMgr_SWIFT_Auth() {} + RGWRESTMgr_SWIFT_Auth() = default; + virtual ~RGWRESTMgr_SWIFT_Auth() = default; - virtual RGWRESTMgr *get_resource_mgr(struct req_state *s, const string& uri, string *out_uri) { + virtual RGWRESTMgr *get_resource_mgr(struct req_state* const s, + const std::string& uri, + std::string* const out_uri) override { return this; } - virtual RGWHandler_REST* get_handler(struct req_state *s) { + + virtual RGWHandler_REST* get_handler(struct req_state*, + const std::string&) override { return new RGWHandler_SWIFT_Auth; } };