]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix for empty query string in beast frontend 20338/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 25 Jan 2018 17:09:20 +0000 (12:09 -0500)
committerCasey Bodley <cbodley@redhat.com>
Tue, 6 Feb 2018 17:01:52 +0000 (12:01 -0500)
when the target does not contain a ?, the QUERY_STRING was being set to
the same value as REQUEST_URI. this QUERY_STRING is included in the
signature, and caused SignatureDoesNotMatch failures

Fixes: http://tracker.ceph.com/issues/22797
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit ab9e79684ac7ae33b78522df6732b99271d10016)

src/rgw/rgw_asio_client.cc

index 13476b6e14b89171ccf5ee73daf6024c927615e4..fd36719e477685093de29f91f080bb2c96885c18 100644 (file)
@@ -65,11 +65,12 @@ void ClientIO::init_env(CephContext *cct)
   // split uri from query
   auto url = request.target();
   auto pos = url.find('?');
-  auto query = url.substr(pos + 1);
-  url = url.substr(0, pos);
-
+  if (pos != url.npos) {
+    auto query = url.substr(pos + 1);
+    env.set("QUERY_STRING", query.to_string());
+    url = url.substr(0, pos);
+  }
   env.set("REQUEST_URI", url.to_string());
-  env.set("QUERY_STRING", query.to_string());
   env.set("SCRIPT_URI", url.to_string()); /* FIXME */
 
   char port_buf[16];