From: Yuval Lifshitz Date: Wed, 2 Jul 2025 14:28:27 +0000 (+0000) Subject: rgw/logging: verify http method exists X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=56c753742cb4b86bc8726e0dfeebd65e9d7fc982;p=ceph.git rgw/logging: verify http method exists Signed-off-by: Yuval Lifshitz --- diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index fc8f7b8940bf0..998228cde4116 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -1255,7 +1255,7 @@ struct req_info { meta_map_t crypt_attribute_map; std::string host; - const char *method; + const char *method = nullptr; std::string script_uri; std::string request_uri; std::string request_uri_aws4; diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 95766a27065ca..cea6b06d011a5 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -308,9 +308,15 @@ public: } virtual const char* name() const = 0; virtual RGWOpType get_type() { return RGW_OP_UNKNOWN; } - virtual std::string canonical_name() const { return fmt::format("REST.{}.{}", s->info.method, name()); } + virtual std::string canonical_name() const { + return fmt::format("REST.{}.{}", + s->info.method != nullptr ? s->info.method : "UNKNOWN", + name()); + } // by default we log all bucket operations - virtual bool always_do_bucket_logging() const { return s->bucket != nullptr; } + virtual bool always_do_bucket_logging() const { + return s->bucket != nullptr; + } virtual uint32_t op_mask() { return 0; } @@ -2107,7 +2113,7 @@ public: virtual int get_params(optional_yield y) = 0; void send_response() override = 0; const char* name() const override { return "list_bucket_multiparts"; } - virtual std::string canonical_name() const override { return fmt::format("REST.{}.UPLOADS", s->info.method); } + std::string canonical_name() const override { return fmt::format("REST.{}.UPLOADS", s->info.method); } RGWOpType get_type() override { return RGW_OP_LIST_BUCKET_MULTIPARTS; } uint32_t op_mask() override { return RGW_OP_TYPE_READ; } };