Repository navigation
Conversation
pjfanning
left a comment
There was a problem hiding this comment.
Nits: the input is built with the response renderer, which always emits CRLF, so ResponseParserLFSpec runs identical CRLF input and the LF variant adds nothing. A hand-written input with generalRawMultiParseTo like the neighbouring tests would exercise LF and drop the renderer imports. Also, on an incomplete trailer the parser re-parses the whole last chunk, so retention holds fairly trivially.
ffc6bf2 to
222403f
Compare
pjfanning
left a comment
There was a problem hiding this comment.
Thanks, the hand-written input is clearer. One thing left: the test is now wrapped in if (mode == "CRLF") and builds its input with crlf(...), so it does not run in ResponseParserLFSpec at all. Could it use prep/newLine like the neighbouring tests so that it runs in both modes? If it fails with LF line endings, that would be worth knowing about.
Motivation: A valid chunked response must preserve declared trailers when the final line arrives separately. Modification: Run the existing focused test in both header-line modes. Use the suite separator for the response head and keep standard CRLF for the chunked framing. Result: Both parser suites verify the final trailer and message completion. No runtime change. Tests: ResponseParserCRLFSpec and ResponseParserLFSpec, one focused case each on Scala 2.13.18 and 3.3.9 with JDK 17; scoped Scalafmt and git diff --check. References: Apache Pekko HTTP apache#1644; RFC 9112 sections 2.2 and 7.1.
222403f to
3fd9fb9
Compare
Motivation
Existing parser tests deliver the trailer section and its terminating
empty line together. The parser must also retain a declared trailer
when that final empty line arrives in a separate input element.
Modification
Feed a valid, handwritten chunked HTTP/1.1 200 response with one declared trailer and no data chunks into the response parser. Supply the final CRLF in a separate input element, then check the status, declaration, exact terminal chunk and message completion.
Result
Cover trailer retention and completion across a legitimate parser input
boundary. No runtime code or socket behavior changes.
Tests
On JDK 17, the focused CRLF case passed on Scala 2.13.18 and 3.3.9 (1/1 each).
Scoped formatting, repository license headers, and whitespace checks
passed. No full CI run.
References
https://www.rfc-editor.org/rfc/rfc9112.html#section-7.1
https://www.rfc-editor.org/rfc/rfc9112.html#section-7.1.2
https://www.rfc-editor.org/rfc/rfc9110.html#section-6.6.2
https://github.com/netty/netty/blob/fd00bc3a2a02a614fca8241d16570801a3a08314/codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java#L1338-L1365