From: Yehuda Sadeh Date: Tue, 8 Nov 2011 21:42:32 +0000 (-0800) Subject: rgw: abort early on incorrect method X-Git-Tag: v0.39~138 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a04afd0957eec036508140f1c0c66f23bfb62867;p=ceph.git rgw: abort early on incorrect method --- diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index d53ffa84bc80..2e9503871e52 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -186,6 +186,13 @@ void RGWProcess::handle_request(FCGX_Request *fcgx) abort_early(s, init_error); goto done; } + + op = handler->get_op(); + if (!op) { + abort_early(s, -ERR_METHOD_NOT_ALLOWED); + goto done; + } + ret = handler->authorize(); if (ret < 0) { dout(10) << "failed to authorize request" << dendl; @@ -203,21 +210,16 @@ void RGWProcess::handle_request(FCGX_Request *fcgx) goto done; } - op = handler->get_op(); - if (op) { - ret = op->verify_permission(); - if (ret < 0) { - abort_early(s, ret); - goto done; - } + ret = op->verify_permission(); + if (ret < 0) { + abort_early(s, ret); + goto done; + } - if (s->expect_cont) - dump_continue(s); + if (s->expect_cont) + dump_continue(s); - op->execute(); - } else { - abort_early(s, -ERR_METHOD_NOT_ALLOWED); - } + op->execute(); done: rgw_log_op(s);