diff options
author | Andrew Clayton <a.clayton@nginx.com> | 2023-09-19 23:46:12 +0100 |
---|---|---|
committer | Andrew Clayton <a.clayton@nginx.com> | 2023-09-25 17:36:23 +0100 |
commit | 263541e24546ba0a75e26fef3c5442238d9fcac2 (patch) | |
tree | b924cd55c2b4493dee320bde75b2daa54790f39a /examples/rust/upload-reflector/src/lib.rs | |
parent | ee64ca584081b812d9254ec116e1a060483071ec (diff) | |
download | unit-wasm-263541e24546ba0a75e26fef3c5442238d9fcac2.tar.gz unit-wasm-263541e24546ba0a75e26fef3c5442238d9fcac2.tar.bz2 |
examples/rust: Amend upload-reflector for recent changes
The previous commit changed uwr_get_http_content_len() to return a u64
to allow for uploads larger than 4GiB, which now means this generates
compiler errors about type mismatches, expected usize got u64.
Cast the return value of uwr_get_http_content_len() to usize to match
that of TOTAL_RESPONSE_SENT.
(Making TOTAL_RESPONSE_SENT a u64 creates a larger trail of problems).
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'examples/rust/upload-reflector/src/lib.rs')
-rw-r--r-- | examples/rust/upload-reflector/src/lib.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/rust/upload-reflector/src/lib.rs b/examples/rust/upload-reflector/src/lib.rs index 753ea48..ac48b56 100644 --- a/examples/rust/upload-reflector/src/lib.rs +++ b/examples/rust/upload-reflector/src/lib.rs @@ -65,7 +65,8 @@ pub fn upload_reflector(ctx: *mut luw_ctx_t) -> i32 { uwr_http_send_response(ctx); - if unsafe { TOTAL_RESPONSE_SENT == uwr_get_http_content_len(ctx) } { + if unsafe { TOTAL_RESPONSE_SENT == uwr_get_http_content_len(ctx) as usize } + { // Tell Unit no more data to send uwr_http_response_end(); } |