aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-01-01 15:25:30 -0800
committerGarrett D'Amore <garrett@damore.org>2025-01-01 15:25:33 -0800
commit7be90706a18c84a63d5f13c7b1379215534c4da6 (patch)
tree2af412d6ea5708d917ed3c1b22b56c5aec52315b
parente70376044ba403ea936cb3d4b2d42d1fd1cde125 (diff)
downloadnng-7be90706a18c84a63d5f13c7b1379215534c4da6.tar.gz
nng-7be90706a18c84a63d5f13c7b1379215534c4da6.tar.bz2
nng-7be90706a18c84a63d5f13c7b1379215534c4da6.zip
http: fix zero status code by default
This is a recent regression that affects any server that does not explicitly set an HTTP status code.
-rw-r--r--src/supplemental/http/http_msg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/supplemental/http/http_msg.c b/src/supplemental/http/http_msg.c
index 1a288bee..44981354 100644
--- a/src/supplemental/http/http_msg.c
+++ b/src/supplemental/http/http_msg.c
@@ -540,6 +540,9 @@ static int
http_res_prepare(nni_http_res *res)
{
int rv;
+ if (res->code == 0) {
+ res->code = NNG_HTTP_STATUS_OK;
+ }
rv = http_asprintf(&res->buf, &res->bufsz, &res->hdrs, "%s %d %s\r\n",
res->vers, nni_http_res_get_status(res),
nni_http_res_get_reason(res));