Skip to content

Commit 56c7537

Browse files
committed
rgw/logging: verify http method exists
Signed-off-by: Yuval Lifshitz <[email protected]>
1 parent 326eef3 commit 56c7537

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/rgw/rgw_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ struct req_info {
12551255
meta_map_t crypt_attribute_map;
12561256

12571257
std::string host;
1258-
const char *method;
1258+
const char *method = nullptr;
12591259
std::string script_uri;
12601260
std::string request_uri;
12611261
std::string request_uri_aws4;

src/rgw/rgw_op.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,15 @@ class RGWOp : public DoutPrefixProvider {
308308
}
309309
virtual const char* name() const = 0;
310310
virtual RGWOpType get_type() { return RGW_OP_UNKNOWN; }
311-
virtual std::string canonical_name() const { return fmt::format("REST.{}.{}", s->info.method, name()); }
311+
virtual std::string canonical_name() const {
312+
return fmt::format("REST.{}.{}",
313+
s->info.method != nullptr ? s->info.method : "UNKNOWN",
314+
name());
315+
}
312316
// by default we log all bucket operations
313-
virtual bool always_do_bucket_logging() const { return s->bucket != nullptr; }
317+
virtual bool always_do_bucket_logging() const {
318+
return s->bucket != nullptr;
319+
}
314320

315321
virtual uint32_t op_mask() { return 0; }
316322

@@ -2107,7 +2113,7 @@ class RGWListBucketMultiparts : public RGWOp {
21072113
virtual int get_params(optional_yield y) = 0;
21082114
void send_response() override = 0;
21092115
const char* name() const override { return "list_bucket_multiparts"; }
2110-
virtual std::string canonical_name() const override { return fmt::format("REST.{}.UPLOADS", s->info.method); }
2116+
std::string canonical_name() const override { return fmt::format("REST.{}.UPLOADS", s->info.method); }
21112117
RGWOpType get_type() override { return RGW_OP_LIST_BUCKET_MULTIPARTS; }
21122118
uint32_t op_mask() override { return RGW_OP_TYPE_READ; }
21132119
};

0 commit comments

Comments
 (0)