From 5dc0cf051059ac83899b55f4a55df363faea4419 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Tue, 29 Aug 2023 23:30:21 +0100 Subject: Rust/rusty: Add a wrapper for luw_get_http_total_content_sent() This returns the total amount of content that the Wasm module has received so far. Signed-off-by: Andrew Clayton --- API-Rust.md | 11 +++++++++++ src/rust/unit-wasm-sys/rusty.rs | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/API-Rust.md b/API-Rust.md index 8a98fe6..434b082 100644 --- a/API-Rust.md +++ b/API-Rust.md @@ -67,6 +67,7 @@ and there isn't a real need to create wrappers specifically for them. * [uwr_get_http_content_str](#uwr_get_http_content_str) * [uwr_get_http_content_len](#uwr_get_http_content_len) * [uwr_get_http_content_sent](#uwr_get_http_content_sent) + * [uwr_get_http_total_content_sent](#uwr_get_http_total_content_sent) * [uwr_http_is_tls](#uwr_http_is_tls) * [uwr_http_hdr_iter](#uwr_http_hdr_iter) * [uwr_http_hdr_get_value](#uwr_http_hdr_get_value) @@ -622,6 +623,16 @@ This function returns the length of the content that was sent to the WebAssembly module in _this_ request. Remember, a single HTTP request may be split over several calls to luw_request_handler(). +### uwr_get_http_total_content_sent + +```Rust +pub fn uwr_get_http_total_content_sent(ctx: *const luw_ctx_t) -> usize; +``` + +This function returns the total length of the content that was sent to the +WebAssembly module so far. Remember, a single HTTP request may be split over +several calls to luw_request_handler(). + ### uwr_http_is_tls ```Rust diff --git a/src/rust/unit-wasm-sys/rusty.rs b/src/rust/unit-wasm-sys/rusty.rs index be7a5e1..81b3e5b 100644 --- a/src/rust/unit-wasm-sys/rusty.rs +++ b/src/rust/unit-wasm-sys/rusty.rs @@ -103,6 +103,10 @@ pub fn uwr_get_http_content_sent(ctx: *const luw_ctx_t) -> usize { unsafe { luw_get_http_content_sent(ctx) } } +pub fn uwr_get_http_total_content_sent(ctx: *const luw_ctx_t) -> usize { + unsafe { luw_get_http_total_content_sent(ctx) } +} + pub fn uwr_get_http_content(ctx: *const luw_ctx_t) -> *const u8 { unsafe { luw_get_http_content(ctx) } } -- cgit