You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ab03211
Browse filesBrowse the repository at this point in the historyBrowse files
UrlEncodedDecoder.decodeComponent rewrote its input buffer with setByte.
That input could be caller-visible memory: the key is a retained slice of
the buffer passed to add(), an unterminated value is handed out as the
added buffer itself, and the vintage HttpPostStandardRequestDecoder
retains the offered HttpContent buffer and stores it in the attribute
before decoding it. Percent or '+' decoding therefore changed the
caller's bytes (and writerIndex), and failed with ReadOnlyBufferException
for read-only input. The legacy implementation left offered buffers
unchanged.
decodeComponent now uses copy-on-write: it scans for '%' or '+' and
returns the input unchanged if there is none; otherwise it writes the
decoded bytes into a newly allocated buffer. It takes ownership of the
input and returns a buffer owned by the caller, so the
VintageAccess.UrlEncodedDecoder bridge method now returns the decoded
ByteBuf instead of void. The key, decodedContent() and vintage call sites
are updated for the new ownership contract.
Regression tests check that offered buffers (keys and values, with and
without endInput, single and multiple chunks) are unchanged after decoding
and that read-only input decodes, for both the core decoder and the
vintage HttpPostStandardRequestDecoder.
Fixes#38
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: multipart-vintage/src/test/java/io/netty/contrib/multipart/vintage/HttpPostStandardRequestDecoderTest.java
0 commit comments