summaryrefslogtreecommitdiffstats
path: root/src/plugins/http
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2024-05-02 11:17:15 +0200
committerMatus Fabian <matfabia@cisco.com>2024-05-03 08:17:16 +0200
commit616201abe273afb3712791f5b2b8799b5b01a58d (patch)
treebbed379a72a4bfc6d81603e43c8cb126c0196022 /src/plugins/http
parent7b3339efffb25eacea89d1fb7673bb3647e952f2 (diff)
http: fix http server in response
App name is used in HTTP response Server header. Type: fix Change-Id: Ie3b2d985dd7d554a0352f7e602891f878bebd031 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/http')
-rw-r--r--src/plugins/http/http.c11
-rw-r--r--src/plugins/http/http.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c
index 0fa113c8155..37a6de71bc7 100644
--- a/src/plugins/http/http.c
+++ b/src/plugins/http/http.c
@@ -140,6 +140,7 @@ http_listener_free (http_conn_t *lhc)
{
http_main_t *hm = &http_main;
+ vec_free (lhc->app_name);
if (CLIB_DEBUG)
memset (lhc, 0xfc, sizeof (*lhc));
pool_put (hm->listener_pool, lhc);
@@ -372,7 +373,7 @@ static const char *http_redirect_template = "HTTP/1.1 %s\r\n";
static const char *http_response_template = "HTTP/1.1 %s\r\n"
"Date: %U GMT\r\n"
"Expires: %U GMT\r\n"
- "Server: VPP Static\r\n"
+ "Server: %s\r\n"
"Content-Type: %s\r\n"
"Content-Length: %lu\r\n\r\n";
@@ -734,6 +735,7 @@ http_state_wait_app_reply (http_conn_t *hc, transport_send_params_t *sp)
* Add headers. For now:
* - current time
* - expiration time
+ * - server name
* - content type
* - data length
*/
@@ -748,6 +750,8 @@ http_state_wait_app_reply (http_conn_t *hc, transport_send_params_t *sp)
format_clib_timebase_time, now,
/* Expires */
format_clib_timebase_time, now + 600.0,
+ /* Server */
+ hc->app_name,
/* Content type */
http_content_type_str[msg.content_type],
/* Length */
@@ -1199,6 +1203,11 @@ http_start_listen (u32 app_listener_index, transport_endpoint_cfg_t *tep)
lhc->c_s_index = app_listener_index;
lhc->c_flags |= TRANSPORT_CONNECTION_F_NO_LOOKUP;
+ if (vec_len (app->name))
+ lhc->app_name = vec_dup (app->name);
+ else
+ lhc->app_name = format (0, "VPP server app");
+
return lhc_index;
}
diff --git a/src/plugins/http/http.h b/src/plugins/http/http.h
index dbae5ac4611..c9912dd6db8 100644
--- a/src/plugins/http/http.h
+++ b/src/plugins/http/http.h
@@ -227,6 +227,7 @@ typedef struct http_tc_
http_conn_state_t state;
u32 timer_handle;
+ u8 *app_name;
/*
* Current request