GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — fix(dicer): accept transport padding after a boundary delimiter by yxshee · Pull Request #238 · fastify/busboy ConversationProblemA boundary delimiter line that carries whitespace between the boundary and its CRLF makes the parser lose the part that follows it: const Busboy = require('@fastify/busboy') const bb = new Busboy({ headers: { 'content-type': 'multipart/form-data; boundary=b' } }) bb.on('field', (name, value) => console.log('field', name, JSON.stringify(value))) bb.on('finish', () => console.log('finish')) bb.end(Buffer.from( '--b \r\n' + // <- space after the boundary 'Content-Disposition: form-data; name="a"\r\n\r\n1\r\n' + '--b\r\n' + 'Content-Disposition: form-data; name="c"\r\n\r\n2\r\n' + '--b--\r\n')) // field c "2" // finish <- "a" is gone, silently A tab behaves the same. RFC 2046 §5.1.1 allows this explicitly ( The reason is in FixSkip spaces and tabs between the boundary and the CRLF once the dash check has run. The padding may be split across writes, so when a chunk ends inside it the parser stays in the "just matched" state and continues on the next chunk. Padding after the closing delimiter ( Found by comparing busboy, @fastify/busboy and Go's mime/multipart over generated multipart bodies; this was one of two divergences; the other (a part with headers but no body makes Busboy hang) is fixed in a separate PR. Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsRFC 2046 section 5.1.1 allows linear whitespace between a boundary and
the CRLF that ends its line ("dash-boundary transport-padding CRLF") and
requires receivers to handle it. Dicer handed those bytes to the header
parser as the first line of the next part's header block, where a line
of only a space or a tab counts as a continuation of a header that does
not exist, so the part that followed a padded boundary line was dropped
without any error.
Skip spaces and tabs after the dash check. The padding may be split
across writes, so when a chunk ends inside it stay in the just-matched
state and continue with the next chunk.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |