]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_log.cc
update sources to v12.2.5
[ceph.git] / ceph / src / rgw / rgw_log.cc
index 2930abb9af8127045532c7b6147ad7c90972c79c..5a28bbccb1fdbc54d2577314d256c1a3a13a8d44 100644 (file)
@@ -357,19 +357,29 @@ int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s,
   else
     set_param_str(s, "HTTP_REFERER", entry.referrer);
 
-  std::string uri(s->info.env->get("REQUEST_METHOD"));
-  uri.append(" ");
-
-  uri.append(s->info.env->get("REQUEST_URI"));
-  const char* qs = s->info.env->get("QUERY_STRING");
-  if(qs && (*qs != '\0')) {
-    uri.append("?");
-    uri.append(qs);
+  std::string uri;
+  if (s->info.env->exists("REQUEST_METHOD")) {
+    uri.append(s->info.env->get("REQUEST_METHOD"));
+    uri.append(" ");
   }
 
-  uri.append(" ");
-  uri.append("HTTP/");
-  uri.append(s->info.env->get("HTTP_VERSION"));
+  if (s->info.env->exists("REQUEST_URI")) {
+    uri.append(s->info.env->get("REQUEST_URI"));
+  }
+
+  if (s->info.env->exists("QUERY_STRING")) {
+    const char* qs = s->info.env->get("QUERY_STRING");
+    if(qs && (*qs != '\0')) {
+      uri.append("?");
+      uri.append(qs);
+    }
+  }
+
+  if (s->info.env->exists("HTTP_VERSION")) {
+    uri.append(" ");
+    uri.append("HTTP/");
+    uri.append(s->info.env->get("HTTP_VERSION"));
+  }
 
   entry.uri = std::move(uri);