summaryrefslogtreecommitdiffhomepage
path: root/API-Rust.md (follow)
AgeCommit message (Collapse)AuthorFilesLines
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>