diff options
author | Florin Coras <fcoras@cisco.com> | 2022-02-04 19:40:26 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2022-02-05 21:20:29 +0000 |
commit | 6c33728a3521f9f0abb62f4cab5c8c6f61a72686 (patch) | |
tree | 74b13cc4a987d317d0221dd46f236bce862d50ba /src | |
parent | a3d710e2d7e509c8eff4bd9b7ea2019b5e4fcd12 (diff) |
http_static: handle empty requests
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ic002444c51b1ecbbf18a49863cf01888d28c4632
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/http_static/static_server.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c index bd231b44b47..48a33107926 100644 --- a/src/plugins/http_static/static_server.c +++ b/src/plugins/http_static/static_server.c @@ -379,6 +379,12 @@ handle_request (hss_session_t *hs, http_req_method_t rt, u8 *request) if (!try_url_handler (hsm, hs, rt, request)) return 0; + if (!hsm->www_root) + { + sc = HTTP_STATUS_NOT_FOUND; + goto done; + } + /* * Construct the file to open * Browsers are capable of sporadically including a leading '/' @@ -609,9 +615,12 @@ hss_ts_rx_callback (session_t *ts) } /* Read request */ - vec_validate (request, msg.data.len - 1); - rv = svm_fifo_dequeue (ts->rx_fifo, msg.data.len, request); - ASSERT (rv == msg.data.len); + if (msg.data.len) + { + vec_validate (request, msg.data.len - 1); + rv = svm_fifo_dequeue (ts->rx_fifo, msg.data.len, request); + ASSERT (rv == msg.data.len); + } /* Find and send data */ handle_request (hs, msg.method_type, request); |