From bf968c99ce109c63fded62ec573c4bc247dc9c0a Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Tue, 29 Aug 2023 01:33:23 +0100 Subject: Rust/rusty: Add uwr_get_http_content_str() 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 --- API-Rust.md | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'API-Rust.md') diff --git a/API-Rust.md b/API-Rust.md index 7520384..8e2b6a9 100644 --- a/API-Rust.md +++ b/API-Rust.md @@ -64,6 +64,7 @@ and there isn't a real need to create wrappers specifically for them. * [uwr_get_http_local_port](#uwr_get_http_local_port) * [uwr_get_http_server_name](#uwr_get_http_server_name) * [uwr_get_http_content](#uwr_get_http_content) + * [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_http_is_tls](#uwr_http_is_tls) @@ -592,6 +593,14 @@ pub fn uwr_get_http_content(ctx: *const luw_ctx_t) -> *const u8; This function returns a pointer to the start of the request body. +### uwr_get_http_content_str + +```Rsut +pub fn uwr_get_http_content_str(ctx: *const luw_ctx_t) -> &'static str; +``` + +Same as above but returns a Rust str. + ### uwr_get_http_content_len ```Rust -- cgit