Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed handling of multipart/mixed parts produced by Opera 11.01 with …

…HTML input "type=file multiple" according to rfc1341.
  • Loading branch information...
commit f4f54a554c1205c41460c2df92b43582e4baffe8 1 parent 762f129
@furagu authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/parse.js
View
11 lib/parse.js
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.