From b564db891e2bcacbc0da41481358e6c7bbe15721 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 27 Aug 2013 19:38:18 -0700 Subject: [PATCH] rgw: don't handle CORS if rule not found (is NULL) Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_op.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index e5a6c8f3bb662..97f62874ffb6e 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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; } -- 2.39.5