| 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;
|
|
|
|
|