summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-09-07README: Add some info for getting started with wasi-httpAndrew Clayton1-0/+115
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-07w-h/0.2.0/shared.mk: Use a variable for the WIT files directoryAndrew Clayton1-2/+4
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-07w-h/0.2.0/shared.mk: Remove some hard coded pathsAndrew Clayton1-2/+2
Don't hard code the WIT_BINDGEN & WASM_TOOLS paths, instead take them from the shell as either shell variables or passed directly to make. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-07w-h/0.2.0/shared.mk: No need to export WASI_SYSROOTAndrew Clayton1-2/+0
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06w-h/0.2.0/shared.mk: Use variables for the various toolsAndrew Clayton1-3/+6
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06w-h/0.2.0/shared.mk: Use the right adaptorAndrew Clayton2-1/+5
Now that the wasi-http 0.2.0 components are using a shared Makefile, make the echo-request component use the proxy adaptor while the rest use the reactor adaptor. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06w-h/0.2.0: Use a shared MakefileAndrew Clayton5-116/+33
All the examples under c/wasi-http/0.2.0/ use the *same* Makefile. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06README: Fix typoAndrew Clayton1-1/+1
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06README: Update about the current purpose of thisAndrew Clayton1-0/+13
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06w-h/0.2.0: Update examples to use included WIT filesAndrew Clayton3-6/+6
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06w-h/0.2.0: Add a new example program env-varAndrew Clayton3-0/+136
This shows how to get access to the environment variables and echos them back to the client. We need to include wasi:cli/environment@0.2.0 in the proxy world. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06w-h: Include the wasi-http 0.2.0 WIT filesAndrew Clayton36-0/+2855
To make life a little easier for *others* include the wasi-http 0.2.0 WIT files. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06w-h/0.2.0/large-upload: Add some primitive error checkingAndrew Clayton1-0/+33
Check the status of the open(2) call and return an appropriate HTTP response code on error. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-06w-h/0.2.0/large-upload: Update for wasmtime v24.0.0Andrew Clayton3-3/+6
Same issue as commit 92ffa9a ("w-h/0.2.0/echo-request: Update for wasmtime v24.0.0") Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-05w-h/0.2.0: Add an example of a file downloadAndrew Clayton2-0/+167
This also shows an example of (at least the best I could figure out) how to send an error 4xx/5xx response back. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-05w-h/0.2.0: Add a file denoting what version of wasi-http to useAndrew Clayton1-0/+1
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-05w-h/0.2.0/echo-request: Update for wasmtime v24.0.0Andrew Clayton3-1/+2
It seems at some point between wasmtime v17 and v24 the setting of wasi_http_types_result_own_outgoing_response_error_code_t's val.ok member became mandatory. I was seeing an error like error: hyper::Error(User(Service), guest never invoked `response-outparam::set` method: error while executing at wasm backtrace: 0: 0x313b5 - wit-component:shim!indirect-wasi:http/types@0.2.0-[static]response-outparam.set 1: 0x4f9a - module.wasm!wasi_http_types_static_response_outparam_set 2: 0x6253 - module.wasm!exports_wasi_http_incoming_handler_handle 3: 0x54e4 - module.wasm!__wasm_export_exports_wasi_http_incoming_handler_handle Caused by: unknown handle index 0) Thanks to <https://github.com/cdmurph32> who it seems somehow found this code and had updated it accordingly. Link: <https://github.com/cdmurph32/pdf-text-example/blob/main/hello_world.c#L173> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-09-05Add the wasmtime v24.0.0 adaptorsAndrew Clayton3-0/+0
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-02-23wasi-http/echo-request: No longer need to run sed over the APIAndrew Clayton1-2/+0
Remove the sed commands from the Makefile as the version is no longer encoded in the function and type names. They're still way too long of course... Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-02-13wasi-http/echo-request: Remove itAndrew Clayton3-198/+0
This is superseded by the wasi-http 0.2.0 version. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-02-13Add a wasi-http 0.2.0 large-upload component in CAndrew Clayton3-0/+119
This makes use of the 'reactor' adaptor for filesystem access via the preopens method. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-02-12wasi-http/echo-request: Build using wasm-tools from gitAndrew Clayton1-1/+1
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-02-06Add a wasi-http 0.2.0 echo-request component in CAndrew Clayton3-0/+198
This adds a WASI 0.2.0 version of c/wasi-http/echo-request, although there is no change in component.c, you do now need to link against the 'proxy' adaptor (which is included). This is for running under wasmtime 17. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-12-11wasi-http/echo-request: Update for latest wit-bindgen changesAndrew Clayton1-4/+4
Some of the u8 list types were changed/amalgamated. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-12-01wasi-http/echo-request: Simplify a littleAndrew Clayton1-15/+9
Use the 'blocking' versions of the stream read/write functions. Things seemed to work fine previously. However with a version of this that works under the enw Unit wasm module, it didn't and I needed to use the _input_stream_blocking_read() & _output_stream_blocking_write_and_flush() functions. The latter does also allow for a little less code. Let's also use those functions here... Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-11-28Add a wasi-http echo-request component in CAndrew Clayton4-0/+208
This adds a wasi-http version of luw-echo-request.c[0] This works under the wasmtime v15 CLI serve command. e.g $ ~/src/c/wasm/wasmtime-v15.0.0-x86_64-linux/wasmtime serve c/wasi-http/echo-request/component.wasm Serving HTTP on http://0.0.0.0:8080/ $ curl localhost:8080/hello *** Welcome to WebAssembly with wasi-http / C *** [Request Info] REQUEST_PATH = /hello METHOD = GET QUERY = [Request Headers] host = localhost:8080 user-agent = curl/8.2.1 accept = */* [0]: <https://github.com/nginx/unit-wasm/blob/main/examples/c/luw-echo-request.c> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-10-26Move wasmtime-wasi-http to its own directoryAndrew Clayton3-1/+1
Moved to c/wasmtime-wasi-http Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-10-26Add a basic C based wasmtime runtimeAndrew Clayton4-0/+173
This can be used for creating an equivalent rust based runtime with C bindings. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-10-25Add a component model exampleAndrew Clayton8-0/+157
This adds the 'Hello World' example from here[0]. The runtime is in Rust and the component is in C. This requires some new tools - https://github.com/bytecodealliance/wit-bindgen - https://github.com/bytecodealliance/wasm-tools You can use the pre-built packages, once downloaded and untar'd, edit rust/hello_world/component/Makefile and adjust the paths for the above tools. To build the component with make you may need to specify where the WASI sysroot is $ make WASI_SYSROOT=/path/to/wasi-sysroot [0]: <https://docs.rs/wasmtime/latest/wasmtime/component/macro.bindgen.html> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-10-18wasmtime-wasi-http.c: Fix indentationAndrew Clayton1-18/+18
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-10-17wasmtime-wasi-http.c: Spell 'Initializing' properlyAndrew Clayton1-1/+1
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-10-17Makefile: Don't do CFLAGS twice!Andrew Clayton1-1/+1
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-10-17Initial commitAndrew Clayton6-0/+611
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>