]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWRESTStreamRWRequest::send_prepare(), url encode dest
authorlvshanchun <lvshanchun@gmail.com>
Thu, 23 Nov 2017 09:48:41 +0000 (17:48 +0800)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 12 Apr 2018 22:38:37 +0000 (15:38 -0700)
encode the resource in send_prepare(), as a result, all the callers
to do_send_prepare() have do url_encode before calling it.

Signed-off-by: lvshanchun <lvshanchun@gmail.com>
src/rgw/rgw_rest_client.cc
src/rgw/rgw_rest_client.h

index e1d0dfe5f1366b853d81a5c0e3b52da77d108706..995d211fb219adb38fa26686c3433ca4fd958a59 100644 (file)
@@ -591,10 +591,20 @@ int RGWRESTStreamRWRequest::send_prepare(RGWAccessKey& key, map<string, string>&
   string resource;
   send_prepare_convert(obj, &resource);
 
-  return send_prepare(&key, extra_headers, resource);
+  return do_send_prepare(&key, extra_headers, resource);
 }
 
 int RGWRESTStreamRWRequest::send_prepare(RGWAccessKey *key, map<string, string>& extra_headers, const string& resource,
+                                           bufferlist *send_data)
+{
+  string new_resource;
+  //do not encode slash
+  url_encode(resource, new_resource, false);
+
+  return do_send_prepare(key, extra_headers, new_resource, send_data);
+}
+
+int RGWRESTStreamRWRequest::do_send_prepare(RGWAccessKey *key, map<string, string>& extra_headers, const string& resource,
                                          bufferlist *send_data)
 {
   string new_url = url;
index 3fb4e88f8e9841903f9e05fee12d5d6f0e4301a2..28bf0d772fe9102bf24305da81a9a0f43b11e56e 100644 (file)
@@ -160,6 +160,9 @@ public:
   int complete_request(string& etag, real_time *mtime, uint64_t *psize, map<string, string>& attrs);
 
   void add_params(param_vec_t *params);
+
+private:
+  int do_send_prepare(RGWAccessKey *key, map<string, string>& extra_headers, const string& resource, bufferlist *send_data = nullptr /* optional input data */);
 };
 
 class RGWRESTStreamReadRequest : public RGWRESTStreamRWRequest {