Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed handling of multipart/mixed parts produced by Opera 11.01 with …
…HTML input "type=file multiple" according to rfc1341.
  • Loading branch information
furagu committed Jun 6, 2011
1 parent 762f129 commit f4f54a5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/parse.js
Expand Up @@ -181,11 +181,20 @@ Parser.prototype.write = function (chunk) {
// message end.
// parent ends, look for a new part in the grandparent.
parser.part = parser.part.parent;
var ended_part = parser.part;
if (parser.part !== parser)
emit(parser, "onPartEnd", parser.part);
parser.part = parser.part.parent;
parser.state = S.NEW_PART;
parser.buffer = parser.buffer.substr(boundary.length + 4);
if (ended_part.isMultiPart) {
// skip the multipart epilogue
var epilogue_end = parser.buffer.indexOf(parser.part.boundary);
if (epilogue_end !== false) {
parser.buffer = parser.buffer.substr(epilogue_end);
}
} else {
parser.buffer = parser.buffer.substr(boundary.length + 4);
}
} else {
// another part coming for the parent message.
parser.part = parser.part.parent;
Expand Down

0 comments on commit f4f54a5

Please sign in to comment.