]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw: fix content-length checks
authorSage Weil <sage@newdream.net>
Tue, 27 Sep 2011 04:46:39 +0000 (21:46 -0700)
committerSage Weil <sage@newdream.net>
Tue, 27 Sep 2011 04:48:54 +0000 (21:48 -0700)
Ignore content-length check if the REQUEST_URI has a trailing ?acl.

(The object_str.find() check was wrong because object_str has the ?whatever
stripped off, and because it returns std::string::npos on failure.)

Signed-off-by: Sage Weil <sage@newdream.net>
src/rgw/rgw_rest.cc

index 63bd6ddb19009f74c5b81709d045045091c929ce..a776c0eb2230b13c08fc0e6e980d561f73ab36df 100644 (file)
@@ -694,8 +694,11 @@ int RGWHandler_REST::preprocess(struct req_state *s, FCGX_Request *fcgx)
   s->path_name = s->env->get("SCRIPT_NAME");
   s->path_name_url = s->env->get("REQUEST_URI");
   int pos = s->path_name_url.find('?');
-  if (pos >= 0)
+  string path_arg;
+  if (pos >= 0) {
+    path_arg = s->path_name_url.substr(pos+1);
     s->path_name_url = s->path_name_url.substr(0, pos);
+  }
   s->method = s->env->get("REQUEST_METHOD");
   s->host = s->env->get("HTTP_HOST");
   s->query = s->env->get("QUERY_STRING");
@@ -721,7 +724,7 @@ int RGWHandler_REST::preprocess(struct req_state *s, FCGX_Request *fcgx)
   init_entities_from_header(s);
   switch (s->op) {
   case OP_PUT:
-    if (s->object && !s->object_str.find("?acl")) {
+    if (s->object && path_arg != "acl") {
       if (!s->length)
         ret = -ERR_LENGTH_REQUIRED;
       else if (*s->length == '\0')