Repository navigation
fix: name who answered an HTTP 413 in the upload limit message - #199
Merged
Merged
Conversation
The PFA-10 message dropped the 413 page, so a client could not tell which layer refused the request. It now adds one sentence from the start of that page (StatusError.Body): ReARM own error page, recognised by its decoded contact address, is named as the ReARM web server (nginx) whose limit is the Helm value; any other page is quoted with its tags removed and named as something in front of ReARM with a limit of its own, for example a Traefik buffering middleware or a cloud gateway. A JSON answer (the ReARM backend) or an empty page adds nothing. ReARM-Agentic-Session: cli-413-answered-by-1795026403 ReARM-Agent: 62df357e-a3a4-4df5-82d4-049e629d1c6b Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er upload limit tests ReARM-Agentic-Session: cli-413-r2-1795026644 ReARM-Agent: 62df357e-a3a4-4df5-82d4-049e629d1c6b Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ge and quotes no markup Review of the who-answered sentence. The servlet container page (HTTP Status 413, Apache Tomcat), which the backend sends when a filter reads the parts before the upload handler, is now named as the ReARM backend with the same Helm value instead of a proxy in front of ReARM. Style and script blocks are removed with their content, a tag the 200-byte cut left unclosed is removed, a character the cut split is dropped, and the quote is cut on a character boundary. New tests cut realistic pages at 200 bytes and assert each fixture has the property its case is about; they fail against the previous code. ReARM-Agentic-Session: cli-413-r3-1795028364 ReARM-Agent: 62df357e-a3a4-4df5-82d4-049e629d1c6b Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The PFA-10 upload-limit message replaces the raw 413 error and drops the page that came with it. That page is the only sign of which layer refused the request. ReARM's own nginx, the ReARM backend, and a proxy in front of ReARM (for example a Traefik
bufferingmiddleware withmaxRequestBodyBytes, or a cloud gateway) all answer 413. Without it, an administrator can't tell which limit to raise.What
uploadLimitMessageadds one sentence, before the batch hint, built from the start of the 413 page. rearm-client-go keeps it inStatusError.Body: the first 200 bytes of an answer that wasn't JSON.Request Entity Too Large; a cloud gateway usually names itself, for exampleMicrosoft-Azure-Application-Gateway/v2.HTTP Status 413,Apache Tomcat): the backend sends this instead of JSON when a filter reads the parts before the upload handler, and ReARM's nginx passes it through. The sentence reads: "It was answered by the ReARM backend, whose limit is that Helm value."The quote never prints markup. Style and script blocks are removed with their content; a tag the 200-byte cut left unclosed is removed; a character the cut split is dropped. The 120-character cut falls on a character boundary.
The helper is
limitAnsweredBy, becauseansweredByalready exists in the board wait code. No client-go change is needed.Tests
TestUploadLimitMessageNamesWhoAnsweredFromCutPagescuts realistic pages at 200 bytes, as rearm-client-go does. It covers the Tomcat page cut inside its style block, a gateway page cut mid-tag, style and script blocks, and a split last character, plus a rune-boundary check on a long accented answer. Each case asserts its fixture has the property under test, and every case fails against the earlier code.TestUploadLimitMessageNamesWhoAnsweredcovers ReARM's page (entities decoded), Traefik plain text, another nginx, a cloud gateway, truncation, no page and markup only. It also checks that no markup is printed and the batch hint stays last.go vet ./cmd/andgo test ./...pass.🤖 Generated with Claude Code