diff options
author | Matus Fabian <matfabia@cisco.com> | 2024-08-01 16:36:44 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-08-01 22:13:46 +0000 |
commit | a67da25008299d825fc7d88a3c527b1708192a4c (patch) | |
tree | 880a28a72dcfe58e11fa3da77e37bb417aebdee9 /docs/usecases | |
parent | 119cbf2651c7bfdd1a1b4455784c83a487ee81d3 (diff) |
http_static: web app doc update
Type: docs
Change-Id: I0d3395c1de51c086b2ac68cd92c97efe36665b62
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'docs/usecases')
-rw-r--r-- | docs/usecases/webapp.rst | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/docs/usecases/webapp.rst b/docs/usecases/webapp.rst index f76fd5b6353..43e600467c5 100644 --- a/docs/usecases/webapp.rst +++ b/docs/usecases/webapp.rst @@ -19,8 +19,7 @@ why returning data in .json format tends to work out pretty well. :: static int - handle_get_status (http_builtin_method_type_t reqtype, - u8 * request, http_session_t * hs) + handle_get_status (hss_url_handler_args_t *args) { my_main_t *mm = &my_main; u8 *s = 0; @@ -34,11 +33,11 @@ why returning data in .json format tends to work out pretty well. s = format (s, "}}"); /* And tell the static server plugin how to send the results */ - hs->data = s; - hs->data_offset = 0; - hs->cache_pool_index = ~0; - hs->free_data = 1; /* free s when done with it, in the framework */ - return 0; + args->data = s; + args->data_len = vec_len (s); + args->ct = HTTP_CONTENT_APP_JSON; + args->free_vec_data = 1; /* free s when done with it, in the framework */ + return HSS_URL_HANDLER_OK; } Words to the Wise: Chrome has a very nice set of debugging tools. Select @@ -53,7 +52,7 @@ considerable amount of time debugging .json bugs. Step 2: Register URL handlers with the server --------------------------------------------- -Call http_static_server_register_builtin_handler() as shown. It’s likely +Call ``hss_register_url_handler`` as shown. It’s likely but not guaranteed that the static server plugin will be available. :: @@ -65,7 +64,7 @@ but not guaranteed that the static server plugin will be available. /* Look up the builtin URL registration handler */ fp = vlib_get_plugin_symbol ("http_static_plugin.so", - "http_static_server_register_builtin_handler"); + "hss_register_url_handler"); if (fp == 0) { @@ -259,7 +258,7 @@ above: :: - http static server www-root /myhugosite/public uri tcp://0.0.0.0/2345 cache-size 5m fifo-size 8192 + http static server url-handlers www-root /myhugosite/public uri tcp://0.0.0.0/2345 cache-size 5m fifo-size 8192 The www-root must be specified, and must correctly name the compiled hugo site root. If your Hugo site is located at /myhugosite, specify |