summaryrefslogtreecommitdiffhomepage
path: root/API-Rust.md (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2023-09-25API-Rust.md: Update for libunit-wasm updatesAndrew Clayton1-3/+70
uwr_get_http_content_len() & uwr_get_http_total_content_sent() now return a u64. Two new functions were added uwr_req_buf_copy() Like uwr_req_buf_append() but just copies the data over what's already there. uwr_mem_splice_file() This write(2)'s the request data directly from the shared memory to a given file. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-09-12rust/rusty: Add a wrapper for the new luw_http_set_response_status()Andrew Clayton1-2/+107
The new uwr_http_set_response_status() function allows to set the HTTP response status in Rust WebAssembly modules. It takes one of the luw_http_status_t response status values. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-09-07API-Rust.md: Fix section numberingAndrew Clayton1-3/+3
Must of got out of whack when editing it from the C version. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-30API-{C,Rust}.md: Note which version new functions were addedAndrew Clayton1-0/+8
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-29Rust/rusty: Add a wrapper for luw_get_http_total_content_sent()Andrew Clayton1-0/+11
This returns the total amount of content that the Wasm module has received so far. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-29Rust/rusty: Add a couple of convenience functionsAndrew Clayton1-0/+33
This adds the following convenience functions for adding HTTP response headers, Content-Type & Content-length uwr_http_add_header_content_type(ctx: *mut luw_ctx_t, ctype: &str); uwr_http_add_header_content_len(ctx: *mut luw_ctx_t); These are perhaps the two most common headers so it makes sense to reduce the effort to adding them. E.g before uwr_http_add_header(&ctx, "Content-Type", "text/plain"); uwr_http_add_header( ctx, "Content-Length", &format!("{}", uwr_get_response_data_size(ctx)), ); after uwr_http_add_header_content_type(ctx, "text/plain"); uwr_http_add_header_content_len(ctx); Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-29Rust/rusty: Add uwr_get_http_content_str()Andrew Clayton1-0/+9
This function is like uwr_get_http_content() except that it returns a Rust str. This is more convenient if you want to operate on the body content within Rust. It's worth noting that uwr_get_http_content() returns a non null terminated buffer which makes it tricky to work with in Rust. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-29API-Rust.md: Add a note about luw_ vs uwr_ namingAndrew Clayton1-0/+16
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-29API-Rust.md: Tweak the uwr_http_add_header() exampleAndrew Clayton1-1/+1
Use uwr_get_response_data_size() instead of uwr_get_http_content_len() for the Content-Length, this is more appropriate as this will give the length of the response data rather than the request data. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-28API-Rust.md: Add a Rust 'rusty' API documentAndrew Clayton1-0/+885
This was done by 'cp API-C.md API-Rust.md' and then adjusted as necessary. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>