summaryrefslogtreecommitdiffhomepage
path: root/examples/rust/upload-reflector/src
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-08-28 16:11:15 +0100
committerAndrew Clayton <a.clayton@nginx.com>2023-08-28 16:20:26 +0100
commitda5d9dc03b14b4d0f1ce0ce3ff093f387e148706 (patch)
treee78c14545bd275aec15768d410f9b2be0a21d4d1 /examples/rust/upload-reflector/src
parent5bf0dfc92eb57f43dcf2eb29d9647c096b984774 (diff)
downloadunit-wasm-da5d9dc03b14b4d0f1ce0ce3ff093f387e148706.tar.gz
unit-wasm-da5d9dc03b14b4d0f1ce0ce3ff093f387e148706.tar.bz2
libunit-wasm: Remove the idx argument from luw_http_add_header()
This was used to specify the index of the response header being added, starting at 0 and incrementing by one for each header. Instead of having the programmer specify this, track it internally. We add an extra check in luw_http_add_header() to make sure we aren't trying to add more headers than we said with luw_http_init_headers(), if we are, simply return. This updates the API-C.md and the various examples and 'rusty' API wrapper. Suggested-by: Liam Crilly <liam@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '')
-rw-r--r--examples/rust/upload-reflector/src/lib.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/rust/upload-reflector/src/lib.rs b/examples/rust/upload-reflector/src/lib.rs
index 01138b0..43bd1c6 100644
--- a/examples/rust/upload-reflector/src/lib.rs
+++ b/examples/rust/upload-reflector/src/lib.rs
@@ -49,10 +49,9 @@ pub fn upload_reflector(ctx: *mut luw_ctx_t) -> i32 {
}
uwr_http_init_headers(ctx, 2, 0);
- uwr_http_add_header(ctx, 0, "Content-Type", ct);
+ uwr_http_add_header(ctx, "Content-Type", ct);
uwr_http_add_header(
ctx,
- 1,
"Content-Length",
&format!("{}", uwr_get_http_content_len(ctx)),
);