]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWEnv::set takes boost::string_ref
authorCasey Bodley <cbodley@redhat.com>
Sun, 19 Jun 2016 10:52:44 +0000 (06:52 -0400)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Fri, 21 Oct 2016 20:57:16 +0000 (22:57 +0200)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_civetweb.cc
src/rgw/rgw_common.h
src/rgw/rgw_env.cc

index d4a03e109d4b6675d1f0972a7fe1c385cee0460a..ebca981165d2e431b239181f02de2af45a6345de 100644 (file)
@@ -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];
index 96c03a4eb874a5cba5578924555b2f4bb8926901..75daeb49238b4660f81e5f6346d535f04fdd76cb 100644 (file)
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <string>
 #include <map>
+#include <boost/utility/string_ref.hpp>
 #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);
index ffa479be73f545ae02fad143a949eb8d02fe09d7..505156d7d2b1b2ea63b8a37a3879ddb815bfb46c 100644 (file)
@@ -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;
 }