From fdb5a5a0e4aad887add68985191be114dcc99e38 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 28 Jan 2022 15:26:39 -0800 Subject: http_static: incorporate builtinurl plugin External handlers can still be registered via hss_register_url_handler but url handlers must be enabled when server is created. builtinurl plugin to be removed in a future patch Type: refactor Signed-off-by: Florin Coras Change-Id: I94e103d908b9e118c7927b997a21ce3f67809889 --- src/plugins/http_static/http_static.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/plugins/http_static/http_static.c') diff --git a/src/plugins/http_static/http_static.c b/src/plugins/http_static/http_static.c index 077371cac52..b8d6931b4c6 100644 --- a/src/plugins/http_static/http_static.c +++ b/src/plugins/http_static/http_static.c @@ -32,19 +32,17 @@ #define REPLY_MSG_ID_BASE hsm->msg_id_base #include -/** \brief Register a builtin GET or POST handler - */ __clib_export void -http_static_server_register_builtin_handler (void *fp, char *url, - http_req_method_t request_type) +hss_register_url_handler (hss_url_handler_t fp, const char *url, + http_req_method_t request_type) { hss_main_t *hsm = &hss_main; - uword *p, *builtin_table; + uword *p, *url_table; - builtin_table = (request_type == HTTP_REQ_GET) ? hsm->get_url_handlers : - hsm->post_url_handlers; + url_table = (request_type == HTTP_REQ_GET) ? hsm->get_url_handlers : + hsm->post_url_handlers; - p = hash_get_mem (builtin_table, url); + p = hash_get_mem (url_table, url); if (p) { @@ -53,16 +51,16 @@ http_static_server_register_builtin_handler (void *fp, char *url, return; } - hash_set_mem (builtin_table, url, (uword) fp); + hash_set_mem (url_table, url, (uword) fp); /* * Need to update the hash table pointer in http_static_server_main * in case we just expanded it... */ if (request_type == HTTP_REQ_GET) - hsm->get_url_handlers = builtin_table; + hsm->get_url_handlers = url_table; else - hsm->post_url_handlers = builtin_table; + hsm->post_url_handlers = url_table; } /** \brief API helper function for vl_api_http_static_enable_t messages -- cgit 1.2.3-korg