]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/logging: verify http method exists
authorYuval Lifshitz <ylifshit@ibm.com>
Wed, 2 Jul 2025 14:28:27 +0000 (14:28 +0000)
committerThomas Serlin <tserlin@redhat.com>
Mon, 22 Sep 2025 19:18:18 +0000 (15:18 -0400)
Resolves: rhbz#2372311

Signed-off-by: Yuval Lifshitz <ylifshit@ibm.com>
(cherry picked from commit 56c753742cb4b86bc8726e0dfeebd65e9d7fc982)

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

index 41e69eeb4db5ec77dde79b56b63010ced6c7d762..0f7043a7bbe2bff8beb87f0b2d9ca4ad32b65dd4 100644 (file)
@@ -1269,7 +1269,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 d746ea66de2dc4a982bd13f098852a77c427af98..d6da428435883e0e76c1a2bd6ce853f35f8ee530 100644 (file)
@@ -312,9 +312,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; }
 
@@ -2116,7 +2122,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; }
 };