✓
Passing This code compiles and runs correctly.
Code
// PINS: fmt.blk HTML returned as an orisha Response body, then freed
// after the bytes have been used. 350_022 prints inside the router arm
// and continuation_codegen frees there. Ward's GET / `return`s the slice
// (`body: f`); freeing in the arm is use-after-free, and not freeing is
// a leak. `body_allocated` rides the Response; `orisha:release-body`
// discharges it after `answer` (the same seam `serve` uses after reply).
~import orisha
~import std/fmt
~import std/io
const std = @import("std");
const raw = "GET / HTTP/1.1\r\n\r\n";
~tor info {} -> { processor_name: string, core_count: string }
~proc info|zig {
return .{ .processor_name = "M2", .core_count = "12 Cores" };
}
~orisha:handler = orisha:router(req)
! [GET /] |> info(): i |> std/fmt:fmt.blk {
<h1>{{ i.processor_name:s }}</h1>
<p>{{ i.core_count:s }}</p>
}: f -> { status: 200, body: f, content_type: "text/html" }
! [*] -> { status: 404, body: "miss", content_type: "text/plain" }
~orisha:answer(raw): a |> std/io:print.ln("{{ a.body:s }}") |> orisha:release-body(a.body, allocated: a.body_allocated)
Actual
<h1>M2</h1>
<p>12 Cores</p>
Expected output
<h1>M2</h1>
<p>12 Cores</p>
Flows
subflow ~handler click a branch to expand · @labels scroll to their anchor
router (req)
flow ~answer click a branch to expand · @labels scroll to their anchor
answer (raw)
Test Configuration
MUST_RUN