]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/logging: verify http method exists
authorYuval Lifshitz <ylifshit@ibm.com>
Wed, 2 Jul 2025 14:28:27 +0000 (14:28 +0000)
committerN Balachandran <nithya.balachandran@ibm.com>
Wed, 15 Apr 2026 03:45:32 +0000 (09:15 +0530)
Signed-off-by: Yuval Lifshitz <ylifshit@ibm.com>
(cherry picked from commit 56c753742cb4b86bc8726e0dfeebd65e9d7fc982)

src/rgw/rgw_common.h
src/rgw/rgw_op.h

index 95fbf66ba28d66515b253917f29c1fdca73c8911..05ea592be94597eb1e113abace02262258e2ffff 100644 (file)
@@ -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;
index 61f9133d48cefb4588ffa7bac2236e8ef6f22fa4..f3068fe55512361bf789d10fd5733c5ff7d89c9a 100644 (file)
@@ -309,9 +309,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; }
 
@@ -2113,7 +2119,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; }
 };