summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Bielik <robert.bielik@dirac.com>2023-08-10 09:28:05 +0200
committerGarrett D'Amore <garrett@damore.org>2023-08-23 11:25:23 -0700
commitf5e3a103206988f7b1b012dd42af0238b0df5ce2 (patch)
tree73250e66aeab193f7e13c647a2d5462a198a5d82 /tests
parentdb358a8c473c9b6daccace3d89b787b544ef50b7 (diff)
downloadnng-f5e3a103206988f7b1b012dd42af0238b0df5ce2.tar.gz
nng-f5e3a103206988f7b1b012dd42af0238b0df5ce2.tar.bz2
nng-f5e3a103206988f7b1b012dd42af0238b0df5ce2.zip
Skip URI parameters when serving a directory (http_server)
Diffstat (limited to 'tests')
-rw-r--r--tests/httpserver.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/httpserver.c b/tests/httpserver.c
index c593fc81..9c798326 100644
--- a/tests/httpserver.c
+++ b/tests/httpserver.c
@@ -387,6 +387,24 @@ TestMain("HTTP Server", {
nng_free(data, size);
});
+ Convey("Named file with URI parameters works", {
+ char fullurl[256];
+ void * data;
+ size_t size;
+ uint16_t stat;
+ char * ctype;
+
+ snprintf(
+ fullurl, sizeof(fullurl), "%s/file.txt?param=123456", urlstr);
+ So(httpget(fullurl, &data, &size, &stat, &ctype) == 0);
+ So(stat == NNG_HTTP_STATUS_OK);
+ So(size == strlen(doc2));
+ So(memcmp(data, doc2, size) == 0);
+ So(strcmp(ctype, "text/plain") == 0);
+ nni_strfree(ctype);
+ nng_free(data, size);
+ });
+
Convey("Missing index gives 404", {
char fullurl[256];
void * data;
@@ -440,6 +458,7 @@ TestMain("HTTP Server", {
nng_url_free(curl);
nng_free(data, size);
});
+
Convey("Version 0.9 gives 505", {
char fullurl[256];
void * data;
@@ -462,6 +481,7 @@ TestMain("HTTP Server", {
nng_url_free(curl);
nng_free(data, size);
});
+
Convey("Missing Host gives 400", {
char fullurl[256];
void * data;
@@ -643,6 +663,7 @@ TestMain("HTTP Server", {
nng_url_free(curl);
nng_free(data, size);
});
+
Convey("Version 0.9 gives 505", {
char fullurl[256];
void * data;
@@ -665,6 +686,7 @@ TestMain("HTTP Server", {
nng_url_free(curl);
nng_free(data, size);
});
+
Convey("Missing Host gives 400", {
char fullurl[256];
void * data;