]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/logging: verify http method exists 63909/head
authorYuval Lifshitz <ylifshit@ibm.com>
Wed, 2 Jul 2025 14:28:27 +0000 (14:28 +0000)
committerYuval Lifshitz <ylifshit@ibm.com>
Thu, 3 Jul 2025 09:29:39 +0000 (09:29 +0000)
Signed-off-by: Yuval Lifshitz <ylifshit@ibm.com>
src/rgw/rgw_common.h
src/rgw/rgw_op.h

index fc8f7b8940bf073b8573181c1acd4cbf899e9bef..998228cde41160f380a327a428fe2cbf6f518984 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 95766a27065ca088a7f200a6516980eac284218e..cea6b06d011a5de7af8dc745712ee7464d8645a3 100644 (file)
@@ -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; }
 };