]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't handle CORS if rule not found (is NULL)
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 28 Aug 2013 02:38:18 +0000 (19:38 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 4 Sep 2013 23:11:20 +0000 (16:11 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_op.cc

index e5a6c8f3bb6626d0e685d1ab8ace6ddb6e71853d..97f62874ffb6ee8e750afaa430be7b866ec3306f 100644 (file)
@@ -503,6 +503,11 @@ bool RGWOp::generate_cors_headers(string& origin, string& method, string& header
     dout(2) << "No CORS configuration set yet for this bucket" << dendl;
     return false;
   }
+
+  RGWCORSRule *rule = bucket_cors.host_name_rule(orig);
+  if (!rule)
+    return false;
+
   const char *req_meth = s->info.env->get("HTTP_ACCESS_CONTROL_REQUEST_METHOD");
   if (!req_meth) {
     req_meth = s->info.method;
@@ -511,7 +516,6 @@ bool RGWOp::generate_cors_headers(string& origin, string& method, string& header
   if (req_meth)
     method = req_meth;
 
-  RGWCORSRule *rule = bucket_cors.host_name_rule(orig);
   if (!validate_cors_rule_method(rule, req_meth)) {
     return false;
   }