From 56c753742cb4b86bc8726e0dfeebd65e9d7fc982 Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Wed, 2 Jul 2025 14:28:27 +0000 Subject: [PATCH] rgw/logging: verify http method exists Signed-off-by: Yuval Lifshitz --- src/rgw/rgw_common.h | 2 +- src/rgw/rgw_op.h | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index fc8f7b8940b..998228cde41 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 95766a27065..cea6b06d011 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; } }; -- 2.39.5