]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: call url_decode in more appropriate places
authorGreg Farnum <gregf@hq.newdream.net>
Fri, 2 Apr 2010 21:21:16 +0000 (14:21 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Fri, 2 Apr 2010 23:51:19 +0000 (16:51 -0700)
src/rgw/rgw_common.cc
src/rgw/rgw_rest.cc

index da9debcea178ff9114f4838fc82ce5cb1961f2eb..faee09141f64407cb7a89e1ec38000811bac7b6c 100644 (file)
@@ -115,6 +115,7 @@ static char hex_to_num(char c)
 
 bool url_decode(string& src_str, string& dest_str)
 {
+  cerr << "in url_decode with " << src_str << std::endl;
   const char *src = src_str.c_str();
   char dest[src_str.size()];
   int pos = 0;
index 3a609e4dfeaa94e24b81f94afe74cbecd600e926..83e8bddbf8da851e69f229fe63a3915ac6e7b1c5 100644 (file)
@@ -412,7 +412,8 @@ void init_entities_from_header(struct req_state *s)
   int pos = h.find("s3.");
 
   if (pos > 0) {
-    s->bucket_str = h.substr(0, pos-1);
+    string encoded_bucket = h.substr(0, pos-1);
+    url_decode(encoded_bucket, s->bucket_str);
     s->bucket = s->bucket_str.c_str();
     s->host_bucket = s->bucket;
   } else {
@@ -450,16 +451,17 @@ void init_entities_from_header(struct req_state *s)
   }
 
   if (!s->bucket) {
-    s->bucket_str = first;
+    url_decode(first, s->bucket_str);
     s->bucket = s->bucket_str.c_str();
   } else {
-    s->object_str = req;
+    url_decode(req, s->object_str);
     s->object = s->object_str.c_str();
     return;
   }
 
   if (pos >= 0) {
-    s->object_str = req.substr(pos+1);
+    string encoded_obj_str = req.substr(pos+1);
+    url_decode(encoded_obj_str, s->object_str);
 
     if (s->object_str.size() > 0) {
       s->object = s->object_str.c_str();