diff --git a/frameworks/genhttp-ioxide/Dockerfile b/frameworks/genhttp-ioxide/Dockerfile index c45f372877..4f15e0e31a 100644 --- a/frameworks/genhttp-ioxide/Dockerfile +++ b/frameworks/genhttp-ioxide/Dockerfile @@ -1,4 +1,13 @@ FROM mcr.microsoft.com/dotnet/sdk:11.0 AS build + +# GenHTTP built from source: the branch of Kaliumhexacyanoferrat/GenHTTP#953 +# (update-ioxide-0.20.396) rather than the 11.3.0 release. Pinned to one commit, +# because a build on cached layers would otherwise keep whichever it cloned first. +ARG GENHTTP_COMMIT=28b0cd107bb36321408a3a1f892f3bb45225e9d7 +RUN git init -q /genhttp \ + && git -C /genhttp fetch -q --depth 1 https://github.com/Kaliumhexacyanoferrat/GenHTTP.git "$GENHTTP_COMMIT" \ + && git -C /genhttp checkout -q FETCH_HEAD + WORKDIR /src/app COPY genhttp.csproj ./ diff --git a/frameworks/genhttp-ioxide/Project.cs b/frameworks/genhttp-ioxide/Project.cs index ddafffa1c0..c0d4719a82 100644 --- a/frameworks/genhttp-ioxide/Project.cs +++ b/frameworks/genhttp-ioxide/Project.cs @@ -60,8 +60,10 @@ private static LayoutBuilder AddStaticFiles(this LayoutBuilder app) private static LayoutBuilder AddWebsocket(this LayoutBuilder app) { + // Frames of up to 64 KiB, rather than the 16 KiB default var websocket = Websocket.Imperative() .DoNotAllocateFrameData() + .MaxFrameSize(64 * 1024) .Handler(new EchoHandler()); return app.Add("ws", websocket); diff --git a/frameworks/genhttp-ioxide/Tests/EchoHandler.cs b/frameworks/genhttp-ioxide/Tests/EchoHandler.cs index 586bb3d254..6760fa88dd 100644 --- a/frameworks/genhttp-ioxide/Tests/EchoHandler.cs +++ b/frameworks/genhttp-ioxide/Tests/EchoHandler.cs @@ -46,9 +46,9 @@ private static async ValueTask HandleAsync(IWebsocketFrame frame, IImperat return false; case FrameType.Error: - if (frame.IsError(out var error) && error.ErrorType is not (FrameErrorType.Canceled or FrameErrorType.IncompleteForever)) + if (frame.IsError(out var error) && error.CloseStatus is { } status) { - await TryCloseAsync(connection, error.ErrorType == FrameErrorType.PayloadTooLarge ? (ushort)1009 : (ushort)1002); + await TryCloseAsync(connection, status); } return false; diff --git a/frameworks/genhttp-ioxide/genhttp.csproj b/frameworks/genhttp-ioxide/genhttp.csproj index 5fede8b6ff..fba764d372 100644 --- a/frameworks/genhttp-ioxide/genhttp.csproj +++ b/frameworks/genhttp-ioxide/genhttp.csproj @@ -15,22 +15,27 @@ 0 - + + + /genhttp + + - - - - - - - + + + + + + + - + - +