diff options
author | Matus Fabian <matfabia@cisco.com> | 2024-05-09 09:34:27 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-05-09 15:57:42 +0000 |
commit | 8761095e80fd21216a669797e1d4b45a7aa388a4 (patch) | |
tree | 6fda16d8daf2a7aa8b140d209e77b48bc600809c /src/plugins/http/http.c | |
parent | 2d1bc4c9fe9b914d8172cb7903e47de52ff83fae (diff) |
http: fix client parse error handling
Do not return HTTP errors to server on parse errors in client.
Type: fix
Change-Id: Id3e99d69626855848faa87af73002d559d948516
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/http/http.c')
-rw-r--r-- | src/plugins/http/http.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c index 855ab8deb3b..368bd92c525 100644 --- a/src/plugins/http/http.c +++ b/src/plugins/http/http.c @@ -521,17 +521,19 @@ http_state_wait_server_reply (http_conn_t *hc, transport_send_params_t *sp) http_msg_t msg = {}; app_worker_t *app_wrk; session_t *as; - http_status_code_t ec; rv = http_read_message (hc); /* Nothing yet, wait for data or timer expire */ if (rv) - return HTTP_SM_STOP; + { + HTTP_DBG (1, "no data to deq"); + return HTTP_SM_STOP; + } if (vec_len (hc->rx_buf) < 8) { - ec = HTTP_STATUS_BAD_REQUEST; + clib_warning ("response buffer too short"); goto error; } @@ -547,9 +549,7 @@ http_state_wait_server_reply (http_conn_t *hc, transport_send_params_t *sp) if (rv) { clib_warning ("failed to parse http reply"); - session_transport_closing_notify (&hc->connection); - http_disconnect_transport (hc); - return -1; + goto error; } msg.data.len = content_length; u32 dlen = vec_len (hc->rx_buf) - hc->rx_buf_offset; @@ -592,16 +592,14 @@ http_state_wait_server_reply (http_conn_t *hc, transport_send_params_t *sp) } else { - HTTP_DBG (0, "Unknown http method %v", hc->rx_buf); - ec = HTTP_STATUS_METHOD_NOT_ALLOWED; + clib_warning ("Unknown http method %v", hc->rx_buf); goto error; } error: - http_send_error (hc, ec); session_transport_closing_notify (&hc->connection); + session_transport_closed_notify (&hc->connection); http_disconnect_transport (hc); - return HTTP_SM_ERROR; } |