]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: configurable prefix for openstack urls
authorYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 11 Mar 2011 23:34:57 +0000 (15:34 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 11 Mar 2011 23:34:57 +0000 (15:34 -0800)
src/rgw/rgw_rest.cc

index fae2f09b5ae70be0cbe43a68b4ab13551e41c65d..8a2238961a17f5b5de5af13865b0e7954ccb8df0 100644 (file)
@@ -349,9 +349,17 @@ void init_entities_from_header(struct req_state *s)
 
   pos = req.find('/');
   if (pos >= 0) {
+    const char *openstack_url_prefix = FCGX_GetParam("RGW_OPENSTACK_URL_PREFIX", s->fcgx->envp);
+    bool cut_url = (openstack_url_prefix != NULL);
+    if (!openstack_url_prefix)
+      openstack_url_prefix = "v1";
     first = req.substr(0, pos);
-    if (first.compare("v1") == 0) /* FIXME: replace v1 with other token */
+    if (first.compare(openstack_url_prefix) == 0) {
       s->prot_flags |= RGW_REST_OPENSTACK;
+      if (cut_url) {
+        next_tok(req, first, '/');
+      }
+    }
   } else {
     first = req;
   }