Reject unreadable UCE source units
This commit is contained in:
+11
-4
@@ -438,8 +438,9 @@ int handle_cli_complete(FastCGIRequest& request)
|
||||
// W7e: compile a cold/stale unit on demand; native execution has
|
||||
// been removed, so a unit that still cannot be served by wasm is a
|
||||
// request failure instead of a fallback path.
|
||||
SharedUnit* cli_compile_state = 0;
|
||||
if(!wasm_backend_should_handle(request, cli_unit))
|
||||
get_shared_unit(&request, cli_unit);
|
||||
cli_compile_state = get_shared_unit(&request, cli_unit);
|
||||
if(wasm_backend_should_handle(request, cli_unit))
|
||||
{
|
||||
String wasm_error = wasm_backend_serve(request, cli_unit, "cli");
|
||||
@@ -452,7 +453,11 @@ int handle_cli_complete(FastCGIRequest& request)
|
||||
else
|
||||
{
|
||||
request.set_status(500, "Internal Server Error");
|
||||
print("UCE CLI wasm unit unavailable after compile: ", script_filename, "\n");
|
||||
String compile_error = cli_compile_state ? first(cli_compile_state->compiler_messages, cli_compile_state->compile_error_status) : String("");
|
||||
print("UCE CLI wasm unit unavailable after compile: ", script_filename);
|
||||
if(compile_error != "")
|
||||
print(": ", compile_error);
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -575,14 +580,16 @@ int handle_complete(FastCGIRequest& request) {
|
||||
// unit on demand — get_shared_unit() builds the .wasm side-module — and
|
||||
// recheck. Native execution has been removed, so a unit that still cannot
|
||||
// be served by wasm becomes a clean 500 request failure.
|
||||
SharedUnit* entry_compile_state = 0;
|
||||
auto wasm_ready = [&](const String& unit) -> bool {
|
||||
if(!wasm_backend_should_handle(request, unit))
|
||||
get_shared_unit(&request, unit);
|
||||
entry_compile_state = get_shared_unit(&request, unit);
|
||||
return(wasm_backend_should_handle(request, unit));
|
||||
};
|
||||
auto fail_wasm_unavailable = [&](const String& handler) {
|
||||
failure_title = "wasm unit unavailable after compile";
|
||||
failure_details = handler + " handler could not be served by wasm";
|
||||
String compile_error = entry_compile_state ? first(entry_compile_state->compiler_messages, entry_compile_state->compile_error_status) : String("");
|
||||
failure_details = compile_error != "" ? compile_error : handler + " handler could not be served by wasm";
|
||||
failure_trace = "source: " + request.params["SCRIPT_FILENAME"];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user