From 7be90706a18c84a63d5f13c7b1379215534c4da6 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 1 Jan 2025 15:25:30 -0800 Subject: 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. --- src/supplemental/http/http_msg.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') 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)); -- cgit v1.2.3-70-g09d2