]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: abort early on incorrect method
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 8 Nov 2011 21:42:32 +0000 (13:42 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 8 Nov 2011 22:17:30 +0000 (14:17 -0800)
src/rgw/rgw_main.cc

index d53ffa84bc80bfae2a3a6b4647eb7548ed57904e..2e9503871e529bd6a52ddb02f8b6c0c01846c7ac 100644 (file)
@@ -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);