From: Radoslaw Zarzynski Date: Tue, 16 Feb 2016 10:35:34 +0000 (+0100) Subject: rgw: enable access to system arguments of RGWHTTPArgs. X-Git-Tag: v10.1.0~364^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cd357b6a49b622a1d178ccb02095751f91745571;p=ceph.git rgw: enable access to system arguments of RGWHTTPArgs. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index fec4ad7857d0..11b16f168725 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 6c7ddd1d51e6..e22ed281a076 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);