From: Casey Bodley Date: Sun, 19 Jun 2016 10:52:44 +0000 (-0400) Subject: rgw: RGWEnv::set takes boost::string_ref X-Git-Tag: v11.1.0~454^2~71 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=52d511ef41bbfd0959a5b7b5b8f30d5125fc6e54;p=ceph.git rgw: RGWEnv::set takes boost::string_ref Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_civetweb.cc b/src/rgw/rgw_civetweb.cc index d4a03e109d4..ebca981165d 100644 --- a/src/rgw/rgw_civetweb.cc +++ b/src/rgw/rgw_civetweb.cc @@ -137,8 +137,12 @@ void RGWMongoose::init_env(CephContext *cct) env.set("REQUEST_METHOD", info->request_method); env.set("REQUEST_URI", info->uri); - env.set("QUERY_STRING", info->query_string); - env.set("REMOTE_USER", info->remote_user); + if (info->query_string) { + env.set("QUERY_STRING", info->query_string); + } + if (info->remote_user) { + env.set("REMOTE_USER", info->remote_user); + } env.set("SCRIPT_URI", info->uri); /* FIXME */ char port_buf[16]; diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 96c03a4eb87..75daeb49238 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "include/types.h" #include "include/utime.h" #include "rgw_acl.h" @@ -357,7 +358,7 @@ public: ~RGWEnv(); void init(CephContext *cct); void init(CephContext *cct, char **envp); - void set(const char *name, const char *val); + void set(const boost::string_ref& name, const boost::string_ref& val); const char *get(const char *name, const char *def_val = NULL); int get_int(const char *name, int def_val = 0); bool get_bool(const char *name, bool def_val = 0); diff --git a/src/rgw/rgw_env.cc b/src/rgw/rgw_env.cc index ffa479be73f..505156d7d2b 100644 --- a/src/rgw/rgw_env.cc +++ b/src/rgw/rgw_env.cc @@ -24,11 +24,9 @@ void RGWEnv::init(CephContext *cct) conf->init(cct, this); } -void RGWEnv::set(const char *name, const char *val) +void RGWEnv::set(const boost::string_ref& name, const boost::string_ref& val) { - if (!val) - val = ""; - env_map[name] = val; + env_map[std::string{name}] = std::string{val}; dout(20) << "RGWEnv::set(): " << name << ": " << val << dendl; }