Permalink
Browse files
Remove parsing of optional CRLF epilogoue, change parser so it ignore…
…s everything after last boundary
- Loading branch information...
Showing
with
6 additions
and
16 deletions.
-
+5
−15
lib/formidable/multipart_parser.js
-
+1
−1
test/fixture/multipart.js
|
@@ -250,27 +250,15 @@ MultipartParser.prototype.write = function(buffer) { |
|
|
}
|
|
|
} else if (flags & F.LAST_BOUNDARY) {
|
|
|
if (c == HYPHEN) {
|
|
|
- index++;
|
|
|
+ callback('partEnd');
|
|
|
+ callback('end');
|
|
|
+ state = S.END;
|
|
|
} else {
|
|
|
index = 0;
|
|
|
}
|
|
|
} else {
|
|
|
index = 0;
|
|
|
}
|
|
|
- } else if (index - 2 == boundary.length) {
|
|
|
- if (c == CR) {
|
|
|
- index++;
|
|
|
- } else {
|
|
|
- index = 0;
|
|
|
- }
|
|
|
- } else if (index - boundary.length == 3) {
|
|
|
- index = 0;
|
|
|
- if (c == LF) {
|
|
|
- callback('partEnd');
|
|
|
- callback('end');
|
|
|
- state = S.END;
|
|
|
- break;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
if (index > 0) {
|
|
@@ -289,6 +277,8 @@ MultipartParser.prototype.write = function(buffer) { |
|
|
i--;
|
|
|
}
|
|
|
|
|
|
+ break;
|
|
|
+ case S.END:
|
|
|
break;
|
|
|
default:
|
|
|
return i;
|
|
|
|
@@ -10,7 +10,7 @@ exports['rfc1867'] = |
|
|
'Content-Type: text/plain\r\n'+
|
|
|
'\r\n'+
|
|
|
'... contents of file1.txt ...\r\r\n'+
|
|
|
- '--AaB03x--\r\n',
|
|
|
+ '--AaB03x--',
|
|
|
parts:
|
|
|
[ { headers: {
|
|
|
'content-disposition': 'form-data; name="field1"',
|
|
|
0 comments on commit
4800b7f