slurmrestd - Add con and name to on_http_request_args_t

Each HTTP request state will always have a resolved peer or local file
descriptor name and a reference to the conmgr connection. Skip having to
resolve either from the connection context state instance.

Issue: 50189
diff --git a/src/slurmrestd/http.c b/src/slurmrestd/http.c
index 0a43966..a3804c7 100644
--- a/src/slurmrestd/http.c
+++ b/src/slurmrestd/http.c
@@ -50,6 +50,8 @@
 #include "src/common/xmalloc.h"
 #include "src/common/xstring.h"
 
+#include "src/conmgr/conmgr.h"
+
 #include "src/interfaces/http_parser.h"
 
 #include "src/slurmrestd/http.h"
@@ -635,11 +637,17 @@
 	xassert(context->magic == MAGIC);
 	xassert(request->magic == MAGIC_REQUEST_T);
 
-	if ((rc = context->on_http_request(&args)))
+	if (!(args.con = conmgr_con_link(context->ref)) ||
+	    !(args.name = conmgr_con_get_name(args.con))) {
+		rc = SLURM_COMMUNICATIONS_MISSING_SOCKET_ERROR;
+		log_flag(NET, "%s: connection missing: %s",
+			 __func__, slurm_strerror(rc));
+	} else if ((rc = context->on_http_request(&args)))
 		log_flag(NET, "%s: [%s] on_http_request rejected: %s",
 			 __func__, conmgr_con_get_name(context->ref),
 			 slurm_strerror(rc));
 
+	conmgr_fd_free_ref(&args.con);
 	return rc;
 }
 
diff --git a/src/slurmrestd/http.h b/src/slurmrestd/http.h
index daf9b06..c99da56 100644
--- a/src/slurmrestd/http.h
+++ b/src/slurmrestd/http.h
@@ -80,6 +80,8 @@
 	const char *path; /* requested URL path (may be NULL) */
 	const char *query; /* requested URL query (may be NULL) */
 	http_context_t *context; /* calling context (do not xfree) */
+	conmgr_fd_ref_t *con; /* reference to connection */
+	const char *name; /* connection name */
 	uint16_t http_major; /* HTTP major version */
 	uint16_t http_minor; /* HTTP minor version */
 	const char *content_type; /* header content-type */