diff options
| author | Robert Bielik <robert.bielik@dirac.com> | 2023-08-10 09:28:05 +0200 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2023-08-23 11:25:23 -0700 |
| commit | f5e3a103206988f7b1b012dd42af0238b0df5ce2 (patch) | |
| tree | 73250e66aeab193f7e13c647a2d5462a198a5d82 /src/supplemental/http/http_server.c | |
| parent | db358a8c473c9b6daccace3d89b787b544ef50b7 (diff) | |
| download | nng-f5e3a103206988f7b1b012dd42af0238b0df5ce2.tar.gz nng-f5e3a103206988f7b1b012dd42af0238b0df5ce2.tar.bz2 nng-f5e3a103206988f7b1b012dd42af0238b0df5ce2.zip | |
Skip URI parameters when serving a directory (http_server)
Diffstat (limited to 'src/supplemental/http/http_server.c')
| -rw-r--r-- | src/supplemental/http/http_server.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/supplemental/http/http_server.c b/src/supplemental/http/http_server.c index 9a8fd285..6759b859 100644 --- a/src/supplemental/http/http_server.c +++ b/src/supplemental/http/http_server.c @@ -272,7 +272,7 @@ nni_http_handler_set_method(nni_http_handler *h, const char *method) static nni_list http_servers = NNI_LIST_INITIALIZER(http_servers, nni_http_server, node); -static nni_mtx http_servers_lk = NNI_MTX_INITIALIZER; +static nni_mtx http_servers_lk = NNI_MTX_INITIALIZER; static void http_sc_reap(void *arg) @@ -1156,7 +1156,7 @@ nni_http_server_res_error(nni_http_server *s, nni_http_res *res) http_error *epage; char * body = NULL; char * html = NULL; - size_t len = 0; + size_t len = 0; uint16_t code = nni_http_res_get_status(res); int rv; @@ -1550,7 +1550,10 @@ http_handle_dir(nni_aio *aio) } for (uri = uri + len; *uri != '\0'; uri++) { - if (*uri == '/') { + if (*uri == '?') { + // Skip URI parameters + break; + } else if (*uri == '/') { strcpy(dst, NNG_PLATFORM_DIR_SEP); dst += sizeof(NNG_PLATFORM_DIR_SEP) - 1; } else { |
