summaryrefslogtreecommitdiffhomepage
path: root/src/c/libunit-wasm.c
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-09-09 01:57:09 +0100
committerAndrew Clayton <a.clayton@nginx.com>2023-09-12 17:21:11 +0100
commit1beab00acdebc1263f83d393742271d31031bde3 (patch)
treead57f8fd45f1814290d4e9ea0fc26c629ac18276 /src/c/libunit-wasm.c
parent44442b8c85399e4baa49c28a436ce0c3aeb5deb1 (diff)
downloadunit-wasm-1beab00acdebc1263f83d393742271d31031bde3.tar.gz
unit-wasm-1beab00acdebc1263f83d393742271d31031bde3.tar.bz2
libunit-wasm: Allow to set the HTTP response status
This adds a new luw_http_set_response_status() function that takes one of the luw_http_status_t response status codes. This function should be called before any calls to luw_http_send_headers() or luw_http_send_response(). This function calls into Unit via a new function import, nxt_wasm_set_resp_status(). Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '')
-rw-r--r--src/c/libunit-wasm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/c/libunit-wasm.c b/src/c/libunit-wasm.c
index 69fe4c0..165dcd7 100644
--- a/src/c/libunit-wasm.c
+++ b/src/c/libunit-wasm.c
@@ -336,6 +336,11 @@ void luw_mem_reset(luw_ctx_t *ctx)
ctx->resp_hdr_idx = -1;
}
+void luw_http_set_response_status(luw_http_status_t status)
+{
+ nxt_wasm_set_resp_status(status);
+}
+
void luw_http_send_response(const luw_ctx_t *ctx)
{
nxt_wasm_send_response(ctx->resp_offset);