Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1296)

Unified Diff: pkg/mime/lib/src/bound_multipart_stream.dart

Issue 739533002: Handle multipart MIME parsing with no parts (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/mime/CHANGELOG.md ('k') | pkg/mime/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/mime/lib/src/bound_multipart_stream.dart
diff --git a/pkg/mime/lib/src/bound_multipart_stream.dart b/pkg/mime/lib/src/bound_multipart_stream.dart
index d470034f1ae8d29b80d92a3fe0ab24c15535ff7e..a049b1d11e9859f7d45ff3dc6a6112b6838b74ab 100644
--- a/pkg/mime/lib/src/bound_multipart_stream.dart
+++ b/pkg/mime/lib/src/bound_multipart_stream.dart
@@ -54,8 +54,6 @@ class _MimeMultipart extends MimeMultipart {
class BoundMultipartStream {
static const int _START = 0;
- static const int _FIRST_BOUNDARY_ENDING = 111;
- static const int _FIRST_BOUNDARY_END = 112;
static const int _BOUNDARY_ENDING = 1;
static const int _BOUNDARY_END = 2;
static const int _HEADER_START = 3;
@@ -187,7 +185,7 @@ class BoundMultipartStream {
if (byte == _boundary[_boundaryIndex]) {
_boundaryIndex++;
if (_boundaryIndex == _boundary.length) {
- _state = _FIRST_BOUNDARY_ENDING;
+ _state = _BOUNDARY_ENDING;
_boundaryIndex = 0;
}
} else {
@@ -197,19 +195,6 @@ class BoundMultipartStream {
}
break;
- case _FIRST_BOUNDARY_ENDING:
- if (byte == CharCode.CR) {
- _state = _FIRST_BOUNDARY_END;
- } else {
- _expectWhitespace(byte);
- }
- break;
-
- case _FIRST_BOUNDARY_END:
- _expectByteValue(byte, CharCode.LF);
- _state = _HEADER_START;
- break;
-
case _BOUNDARY_ENDING:
if (byte == CharCode.CR) {
_state = _BOUNDARY_END;
@@ -222,8 +207,10 @@ class BoundMultipartStream {
case _BOUNDARY_END:
_expectByteValue(byte, CharCode.LF);
- _multipartController.close();
- _multipartController = null;
+ if (_multipartController != null) {
+ _multipartController.close();
+ _multipartController = null;
+ }
_state = _HEADER_START;
break;
@@ -345,8 +332,10 @@ class BoundMultipartStream {
case _LAST_BOUNDARY_END:
_expectByteValue(byte, CharCode.LF);
- _multipartController.close();
- _multipartController = null;
+ if (_multipartController != null) {
+ _multipartController.close();
+ _multipartController = null;
+ }
_state = _DONE;
break;
« no previous file with comments | « pkg/mime/CHANGELOG.md ('k') | pkg/mime/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698