From d340e8e742d119658206928ca50238841b147be5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 26 Sep 2011 21:46:39 -0700 Subject: [PATCH] radosgw: fix content-length checks 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 --- src/rgw/rgw_rest.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 63bd6ddb19009..a776c0eb2230b 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -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') -- 2.39.5