fix: harden wasm w7 entrypoint paths

This commit is contained in:
udo
2026-06-13 22:08:52 +00:00
parent d6421cb8f3
commit af6500d134
6 changed files with 71 additions and 15 deletions
+11 -4
View File
@@ -860,7 +860,14 @@ int handle_cli_complete(FastCGIRequest& request)
// wasm worker (whose traps are signal-based) can run directly.
String cli_unit = compiler_normalize_unit_path(&request, script_filename);
if(wasm_backend_should_handle(request, cli_unit))
wasm_backend_serve(request, cli_unit, wasm_kind::CLI);
{
String wasm_error = wasm_backend_serve(request, cli_unit, wasm_kind::CLI);
if(wasm_error != "")
{
request.set_status(500, "Internal Server Error");
print("UCE CLI wasm error: ", wasm_error, "\n");
}
}
else
compiler_invoke_cli(&request, script_filename);
}
@@ -976,9 +983,9 @@ int handle_complete(FastCGIRequest& request) {
else if(request.params["UCE_SERVE_HTTP"] == "1")
// W7c pending: the custom-server dispatcher is forked from a worker
// that already holds a live Wasmtime engine, so re-creating an engine
// in that child is unsafe (engine must not cross fork). The fix is to
// have the broker forward to the worker pool rather than render in the
// fork; until then serve_http renders natively.
// in that child currently hangs under the in-process dispatcher path.
// The fix is to have the broker forward to the worker pool rather than
// render in the fork; until then serve_http renders natively.
compiler_invoke_serve_http(&request, request.params["SCRIPT_FILENAME"], request.params["UCE_SERVE_HTTP_FUNCTION"]);
else if(wasm_backend_should_handle(request, entry_unit))
serve_via_wasm(entry_unit, wasm_kind::RENDER);