diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index fec4ad7857d..11b16f16872 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -704,6 +704,23 @@ void RGWHTTPArgs::get_bool(const char *name, bool *val, bool def_val) } } +string RGWHTTPArgs::sys_get(const string& name, bool * const exists) +{ + const auto iter = sys_val_map.find(name); + const bool e = (iter != val_map.end()); + + if (exists) { + *exists = e; + } + + return e ? iter->second : string(); +} + +string RGWHTTPArgs::sys_get(const char * const name, bool * const exists) +{ + return sys_get(string(name), exists); +} + bool verify_requester_payer_permission(struct req_state *s) { if (!s->bucket_info.requester_pays) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 6c7ddd1d51e..e22ed281a07 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -297,6 +297,10 @@ class RGWHTTPArgs int get_bool(const char *name, bool *val, bool *exists); void get_bool(const char *name, bool *val, bool def_val); + /** Get the value for specific system argument parameter */ + string sys_get(const string& name, bool *exists = nullptr); + string sys_get(const char *name, bool *exists = nullptr); + /** see if a parameter is contained in this RGWHTTPArgs */ bool exists(const char *name) { map::iterator iter = val_map.find(name);