aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http/http_server.c
diff options
context:
space:
mode:
authorRobert Bielik <robert.bielik@dirac.com>2020-01-19 03:29:52 +0100
committerGarrett D'Amore <garrett@damore.org>2020-01-18 18:29:52 -0800
commit10133ca9b5439e67b287703739e23e7d82fb76c4 (patch)
tree19d9b46c3dc3d646c866bd4b397263016c43beff /src/supplemental/http/http_server.c
parent132acf7ceb59aa9567a7d254686dd612a3a79dfb (diff)
downloadnng-10133ca9b5439e67b287703739e23e7d82fb76c4.tar.gz
nng-10133ca9b5439e67b287703739e23e7d82fb76c4.tar.bz2
nng-10133ca9b5439e67b287703739e23e7d82fb76c4.zip
Fix HTTP server root URI handling (#1140)
- Fixes #751
Diffstat (limited to 'src/supplemental/http/http_server.c')
-rw-r--r--src/supplemental/http/http_server.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/supplemental/http/http_server.c b/src/supplemental/http/http_server.c
index 9a4ff2af..da12c20d 100644
--- a/src/supplemental/http/http_server.c
+++ b/src/supplemental/http/http_server.c
@@ -676,7 +676,7 @@ http_sconn_cbdone(void *arg)
// Get the handler. It may be set regardless of success or
// failure. Clear it, and drop our reference, since we're
// done with the handler for now.
- h = nni_aio_get_data(aio, 1);
+ h = nni_aio_get_data(aio, 1);
nni_aio_set_data(aio, 1, NULL);
if (h != NULL) {
@@ -1402,8 +1402,9 @@ http_handle_dir(nni_aio *aio)
char * pn;
len = strlen(base);
- if ((strncmp(uri, base, len) != 0) ||
- ((uri[len] != 0) && (uri[len] != '/'))) {
+ if (base[1] != '\0' && // Allows "/" as base
+ ((strncmp(uri, base, len) != 0) ||
+ ((uri[len] != 0) && (uri[len] != '/')))) {
// This should never happen!
nni_aio_finish_error(aio, NNG_EINVAL);
return;