diff options
author | Matus Fabian <matfabia@cisco.com> | 2024-05-13 11:50:46 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-05-13 15:06:26 +0000 |
commit | 2516b1ac73cd0dd13ceb10bb8e7824ebc683dc34 (patch) | |
tree | 32bda0ff902002e84106cd82bc1900e6f25e2554 /src/plugins | |
parent | 05c625f1f68eb6a2a3686caba3588ca4e2d5145e (diff) |
http: fix user agent in request
App name is used in HTTP request User-Agent header.
Type: fix
Change-Id: Ib761e8a8e793e04e8d77141cc8c0f8514ed0e547
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/http/http.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c index 368bd92c525..526e665903a 100644 --- a/src/plugins/http/http.c +++ b/src/plugins/http/http.c @@ -378,7 +378,7 @@ static const char *http_response_template = "HTTP/1.1 %s\r\n" "Content-Length: %lu\r\n\r\n"; static const char *http_request_template = "GET %s HTTP/1.1\r\n" - "User-Agent: VPP HTTP client\r\n" + "User-Agent: %s\r\n" "Accept: */*\r\n"; static u32 @@ -819,7 +819,7 @@ http_state_wait_app_method (http_conn_t *hc, transport_send_params_t *sp) rv = svm_fifo_dequeue (as->tx_fifo, msg.data.len, buf); ASSERT (rv == msg.data.len); - request = format (0, http_request_template, buf); + request = format (0, http_request_template, buf, hc->app_name); offset = http_send_data (hc, request, vec_len (request), 0); if (offset != vec_len (request)) { @@ -1157,6 +1157,11 @@ http_transport_connect (transport_endpoint_cfg_t *tep) hc->state = HTTP_CONN_STATE_CONNECTING; cargs->api_context = hc_index; + if (vec_len (app->name)) + hc->app_name = vec_dup (app->name); + else + hc->app_name = format (0, "VPP HTTP client"); + HTTP_DBG (1, "hc ho_index %x", hc_index); if ((error = vnet_connect (cargs))) |