From 13b3095c4a1c39dc450d8308c14cf2fdfbc90f93 Mon Sep 17 00:00:00 2001 From: Red Davies Date: Mon, 1 Jun 2026 15:32:27 -0400 Subject: [PATCH] docker/stallion: suppress body on HEAD response + bump to stallion 0.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ponylang/stallion#102 was resolved as "application responsibility": HEAD-body suppression isn't done by the stallion library, the application has to check the request method and not call add_chunk when it's HEAD. Apply that fix here in the docker test server: keep the same Content-Type / Content-Length headers a GET would produce (per RFC 9110 §9.3.2-04) but skip add_chunk for HEAD so the response body section is empty. Also bump stallion to 0.7.0 — the 0.6.1 + lori 0.14.1 combination no longer compiles with current ponyc (partial-FFI removal). 0.7.0 requires ponyc 0.64+ and uses lori 0.15.0 which is compatible. The rfc9110-9.3.2-01 conformance test now PASSes for stallion. --- docker/stallion/corral.json | 2 +- docker/stallion/main.pony | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docker/stallion/corral.json b/docker/stallion/corral.json index 6e3e0c3..72bd32e 100644 --- a/docker/stallion/corral.json +++ b/docker/stallion/corral.json @@ -2,7 +2,7 @@ "deps": [ { "locator": "github.com/ponylang/stallion.git", - "version": "0.6.1" + "version": "0.7.0" } ] } diff --git a/docker/stallion/main.pony b/docker/stallion/main.pony index 89acf77..084c2d1 100644 --- a/docker/stallion/main.pony +++ b/docker/stallion/main.pony @@ -59,11 +59,18 @@ actor OkServer is stallion.HTTPServerActor request': stallion.Request val, responder: stallion.Responder) => + // Per RFC 9110 §9.3.2 the application is responsible for not + // emitting a body when the request method is HEAD. The headers + // (including Content-Length) match what a GET would produce; only + // the body section is suppressed. let body: String val = "ok\n" - let response = stallion.ResponseBuilder(stallion.StatusOK) + let builder = stallion.ResponseBuilder(stallion.StatusOK) .add_header("Content-Type", "text/plain") .add_header("Content-Length", body.size().string()) .finish_headers() - .add_chunk(body) - .build() + let response = + match request'.method + | stallion.HEAD => builder.build() + else builder.add_chunk(body).build() + end responder.respond(response)