summaryrefslogtreecommitdiffhomepage
path: root/API-C.md (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-09-25API-C.md: Update for libunit-wasm updatesAndrew Clayton1-6/+98
The types of some of the member of the luw_req structure increased to 64bits to allow for uploads larger than 4GiB. Two new functions were added luw_req_buf_copy() Like luw_req_buf_append() but just copies the data over what's already there. luw_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-12libunit-wasm: Allow to set the HTTP response statusAndrew Clayton1-2/+108
This adds a new luw_http_set_response_status() function that takes one of the luw_http_status_t response status codes. This function should be called before any calls to luw_http_send_headers() or luw_http_send_response(). This function calls into Unit via a new function import, nxt_wasm_set_resp_status(). Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-30API-{C,Rust}.md: Note which version new functions were addedAndrew Clayton1-0/+2
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-29libunit-wasm: Add a luw_get_http_total_content_sent() functionAndrew Clayton1-0/+11
This function returns the total amount of content that the Wasm module has received so far. This will be used in the rusty API's uwr_get_http_content_str() function which returns the body content as a string. Due to the body content not being null-terminated we need to know how much data to use for the string, for which we are currently using uwr_get_http_content_len(), which could in some cases return too much if a request is being split over multiple calls the module. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-28API-C.md: Fix a broken fragment linkAndrew Clayton1-1/+1
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-28libunit-wasm: Pass ctx into luw_http_hdr_get_value() as constAndrew Clayton1-1/+1
Technically the context pointer can be passed in const even though we then un-const it passing it to the luw_foreach_http_hdr() macro. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-28libunit-wasm: Remove the idx argument from luw_http_add_header()Andrew Clayton1-6/+6
This was used to specify the index of the response header being added, starting at 0 and incrementing by one for each header. Instead of having the programmer specify this, track it internally. We add an extra check in luw_http_add_header() to make sure we aren't trying to add more headers than we said with luw_http_init_headers(), if we are, simply return. This updates the API-C.md and the various examples and 'rusty' API wrapper. Suggested-by: Liam Crilly <liam@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-26libunit-wasm: Fix rust buildAndrew Clayton1-1/+1
The rust build failed when trying to publish new crates, although for some reason it didn't fail before that, due to the luw_srb_flags_t enums generated by bindgen being 32 bit unsigned integers and the flags argument to luw_set_req_buf() being an unsigned long (which is 64 bits on my system) and thus producing a type mismatch error. Rather than fight with rust just make the flags argument an unsigned int, 32 bits is more than enough for this anyway. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-24libunit-wasm: Put LUW_SRB_FLAGS_ALL in the enumAndrew Clayton1-2/+3
No reason why this needed to be a separate #define. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-23The 'master' branch was renamed 'main'Andrew Clayton1-3/+3
Requested-by: Liam Crilly <liam@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-08-21Initial commitv0.1.0Andrew Clayton1-0/+962
libunit-wasm and example C and Rust WebAssembly modules for NGINX Unit. Co-developed-by: Timo Stark <t.stark@nginx.com> Co-developed-by: Liam Crilly <liam@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>