aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http/http_server.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-12-22 12:27:49 -0800
committerGarrett D'Amore <garrett@damore.org>2024-12-22 12:27:49 -0800
commit2662596f105fc98ae1d2aa3b6137261bb351a8df (patch)
tree0c23c11eab6229cd7481a6294e1b447a6f309de7 /src/supplemental/http/http_server.c
parent10f6fc5141a15e368dac813a38942cb66d5ddef4 (diff)
downloadnng-2662596f105fc98ae1d2aa3b6137261bb351a8df.tar.gz
nng-2662596f105fc98ae1d2aa3b6137261bb351a8df.tar.bz2
nng-2662596f105fc98ae1d2aa3b6137261bb351a8df.zip
HTTP: nng_http_handler_set_method no longer fails
Diffstat (limited to 'src/supplemental/http/http_server.c')
-rw-r--r--src/supplemental/http/http_server.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/supplemental/http/http_server.c b/src/supplemental/http/http_server.c
index e9c8bea3..6a594158 100644
--- a/src/supplemental/http/http_server.c
+++ b/src/supplemental/http/http_server.c
@@ -236,20 +236,14 @@ nni_http_handler_set_host(nni_http_handler *h, const char *host)
(void) snprintf(h->host, sizeof(h->host), "%s", host);
}
-int
+void
nni_http_handler_set_method(nni_http_handler *h, const char *method)
{
- if (nni_atomic_get_bool(&h->busy) != 0) {
- return (NNG_EBUSY);
- }
+ NNI_ASSERT(!nni_atomic_get_bool(&h->busy));
if (method == NULL) {
method = "";
}
- if (strlen(method) >= sizeof(h->method)) {
- return (NNG_EINVAL);
- }
(void) snprintf(h->method, sizeof(h->method), "%s", method);
- return (0);
}
static nni_list http_servers =
@@ -1757,9 +1751,9 @@ nni_http_handler_init_redirect(nni_http_handler **hpp, const char *uri,
return (rv);
}
- if (((rv = nni_http_handler_set_method(h, NULL)) != 0) ||
- ((rv = nni_http_handler_set_data(h, hr, http_redirect_free)) !=
- 0)) {
+ nni_http_handler_set_method(h, NULL);
+
+ if ((rv = nni_http_handler_set_data(h, hr, http_redirect_free)) != 0) {
http_redirect_free(hr);
nni_http_handler_fini(h);
return (rv);