]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: make gateway dns name configurable
authorYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 6 Aug 2010 21:13:21 +0000 (14:13 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Sat, 18 Sep 2010 01:27:56 +0000 (18:27 -0700)
src/rgw/rgw_rest.cc

index dc5c9083be830fd826c424d6624f0f481f23d1e8..a3440a53182d4a70bf7485a87d97ddefae1f8640 100644 (file)
@@ -446,6 +446,14 @@ void RGWPutACLs_REST::send_response()
 
 void init_entities_from_header(struct req_state *s)
 {
+  const char *gateway_dns_name;
+
+  gateway_dns_name = FCGX_GetParam("RGW_DNS_NAME", s->fcgx->envp);
+  if (!gateway_dns_name)
+    gateway_dns_name = "s3.";
+
+  RGW_LOG(20) << "gateway_dns_name = " << gateway_dns_name << endl;
+
   s->bucket = NULL;
   s->bucket_str = "";
   s->object = NULL;
@@ -456,9 +464,9 @@ void init_entities_from_header(struct req_state *s)
     string h(s->host);
 
     RGW_LOG(10) << "host=" << s->host << endl;
-    pos = h.find("s3.");
-    
-    if (pos > 0) {
+    pos = h.find(gateway_dns_name);
+
+    if (pos > 0 && h[pos - 1] == '.') {
       string encoded_bucket = h.substr(0, pos-1);
       url_decode(encoded_bucket, s->bucket_str);
       s->bucket = s->bucket_str.c_str();