summaryrefslogtreecommitdiffstats
path: root/src/plugins/http_static/http_static.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-01-28 15:26:39 -0800
committerDamjan Marion <dmarion@me.com>2022-01-30 14:44:40 +0000
commitfdb5a5a0e4aad887add68985191be114dcc99e38 (patch)
tree38c0284819e8967d2e1a3d173b2884faa5e9c2ab /src/plugins/http_static/http_static.c
parentffd7a9876e5038ad96af1d5dbbb0283c5fe6ab27 (diff)
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 <fcoras@cisco.com> Change-Id: I94e103d908b9e118c7927b997a21ce3f67809889
Diffstat (limited to 'src/plugins/http_static/http_static.c')
-rw-r--r--src/plugins/http_static/http_static.c20
1 files changed, 9 insertions, 11 deletions
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 <vlibapi/api_helper_macros.h>
-/** \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