diff options
author | Matus Fabian <matfabia@cisco.com> | 2024-10-28 10:12:31 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-10-28 16:18:51 +0000 |
commit | dcc6cd4333431aebcba3e17544681c120958cd59 (patch) | |
tree | 3eef2cb40bbedccdd594b5bb5c36487f49b4698e | |
parent | cdb3136fad5817a28bb07dc9ad64db8f6ae62abb (diff) |
http: timeout docs
Type: docs
Change-Id: I3dd9a726b862e72458a8f83c62354411d2c89d07
Signed-off-by: Matus Fabian <matfabia@cisco.com>
-rw-r--r-- | src/plugins/http/http_plugin.rst | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/http/http_plugin.rst b/src/plugins/http/http_plugin.rst index 56da3a810b9..2771d491636 100644 --- a/src/plugins/http/http_plugin.rst +++ b/src/plugins/http/http_plugin.rst @@ -505,3 +505,32 @@ Now we can start reading body content, following block of code could be executed /* close the session if you don't want to send another request */ /* and update state machine... */ } + +HTTP timeout +^^^^^^^^^^^^ + +HTTP plugin sets session inactivity timeout by default to 60 seconds. +Client and server applications can pass custom timeout value (in seconds) using extended configuration when doing connect or start listening respectively. +You just need to add extended configuration to session endpoint configuration which is part of ``vnet_connect_args_t`` and ``vnet_listen_args_t``. +HTTP plugin use ``opaque`` member of ``transport_endpt_ext_cfg_t``, unsigned 32bit integer seems to be sufficient (allowing the timeout to be set up to 136 years). + +The example below sets HTTP session timeout to 30 seconds (server application): + +.. code-block:: C + + vnet_listen_args_t _a, *a = &_a; + session_endpoint_cfg_t sep = SESSION_ENDPOINT_CFG_NULL; + transport_endpt_ext_cfg_t *ext_cfg; + int rv; + clib_memset (a, 0, sizeof (*a)); + clib_memcpy (&a->sep_ext, &sep, sizeof (sep)); + /* add new extended config entry */ + ext_cfg = session_endpoint_add_ext_cfg ( + &a->sep_ext, TRANSPORT_ENDPT_EXT_CFG_HTTP, sizeof (ext_cfg->opaque)); + /* your custom timeout value in seconds */ + ext_cfg->opaque = 30; + /* rest of the settings omitted for brevity */ + rv = vnet_listen (a); + /* don't forget to free extended config */ + session_endpoint_free_ext_cfgs (&a->sep_ext); + /* ... */ |