This patch introduces two new events to the multipart parser: 'onHeaderEnd' and 'onHeadersEnd'. These make it much easier to properly handle the output of the parser. Another nice addition is a system test that verifies a complete upload from start to finish.
This patch also improves the behavior for resume(). net.Stream currently does not guarantee 'data' to stop emitting after pausing a stream. This makes the current throttling function problematic and prone to race conditions. This patch will take of it for now, but a further patch for node itself will make things even smoother.
When we discard a started boundary at the end of a part's data block, we need to re-consider the current character as it could be the beginning of a new boundary sequence itself. See: http://github.com/felixge/node-formidable/issues#issue/2