aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2024-05-10 16:20:40 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-05-14 22:36:31 +0000
commitb7a9ed75fbce1e5e69441916a14235b3a1403593 (patch)
treecae379207e9315484245f869332adc8d2bc60a82 /src
parent182d8b2ddba098f99029ed82e44960f3dfd18987 (diff)
http: fix server sending all status codes
Type: fix Change-Id: I4bc748e3091c2fbe0142d1b74d21a543a62c4ce0 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/hs_apps/http_cli.c7
-rw-r--r--src/plugins/http/http.c5
2 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/hs_apps/http_cli.c b/src/plugins/hs_apps/http_cli.c
index 5d4d49c0fba..f42f65342c3 100644
--- a/src/plugins/hs_apps/http_cli.c
+++ b/src/plugins/hs_apps/http_cli.c
@@ -323,6 +323,13 @@ hcs_ts_rx_callback (session_t *ts)
return 0;
}
+ if (msg.data.len == 0)
+ {
+ hs->tx_buf = 0;
+ start_send_data (hs, HTTP_STATUS_BAD_REQUEST);
+ return 0;
+ }
+
/* send the command to a new/recycled vlib process */
vec_validate (args.buf, msg.data.len - 1);
rv = svm_fifo_dequeue (ts->rx_fifo, msg.data.len, args.buf);
diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c
index 526e665903a..59cb094eabe 100644
--- a/src/plugins/http/http.c
+++ b/src/plugins/http/http.c
@@ -740,6 +740,10 @@ http_state_wait_app_reply (http_conn_t *hc, transport_send_params_t *sp)
switch (msg.code)
{
+ case HTTP_STATUS_NOT_FOUND:
+ case HTTP_STATUS_METHOD_NOT_ALLOWED:
+ case HTTP_STATUS_BAD_REQUEST:
+ case HTTP_STATUS_INTERNAL_ERROR:
case HTTP_STATUS_OK:
header =
format (0, http_response_template, http_status_code_str[msg.code],
@@ -760,6 +764,7 @@ http_state_wait_app_reply (http_conn_t *hc, transport_send_params_t *sp)
/* Location: http(s)://new-place already queued up as data */
break;
default:
+ clib_warning ("unsupported status code: %d", msg.code);
return HTTP_SM_ERROR;
}