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

Issue 10441021: Implement a MIME multipart parser (Closed)

Created:
8 years, 7 months ago by Søren Gjesse
Modified:
8 years, 7 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Implement a MIME multipart parser Added a MIME multipart parser with tests. The parser is currently not used but will be used to handle form posts with content type multipart/form-data. R=ager@google.com, ajohnsen@google.com BUG=dart:2488 TEST=tests/standalone/io/mime_multipart_parser_test.dart Committed: https://code.google.com/p/dart/source/detail?r=7990

Patch Set 1 #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+604 lines, -0 lines) Patch
M runtime/bin/http_parser.dart View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/bin/io_sources.gypi View 1 chunk +1 line, -0 lines 0 comments Download
A runtime/bin/mime_multipart_parser.dart View 1 chunk +299 lines, -0 lines 4 comments Download
A tests/standalone/io/mime_multipart_parser_test.dart View 1 chunk +303 lines, -0 lines 6 comments Download

Messages

Total messages: 4 (0 generated)
Søren Gjesse
8 years, 7 months ago (2012-05-24 16:35:43 UTC) #1
Mads Ager (google)
LGTM https://chromiumcodereview.appspot.com/10441021/diff/1/runtime/bin/mime_multipart_parser.dart File runtime/bin/mime_multipart_parser.dart (right): https://chromiumcodereview.appspot.com/10441021/diff/1/runtime/bin/mime_multipart_parser.dart#newcode52 runtime/bin/mime_multipart_parser.dart:52: void reportData() { Having this local function defined ...
8 years, 7 months ago (2012-05-25 08:11:58 UTC) #2
Anders Johnsen
LGTM I think we should add a few comments in the code stating what it's ...
8 years, 7 months ago (2012-05-25 08:46:59 UTC) #3
Søren Gjesse
8 years, 7 months ago (2012-05-25 11:57:06 UTC) #4
https://chromiumcodereview.appspot.com/10441021/diff/1/runtime/bin/mime_multi...
File runtime/bin/mime_multipart_parser.dart (right):

https://chromiumcodereview.appspot.com/10441021/diff/1/runtime/bin/mime_multi...
runtime/bin/mime_multipart_parser.dart:52: void reportData() {
On 2012/05/25 08:11:58, Mads Ager wrote:
> Having this local function defined here breaks the reading flow a bit. Can we
> move this to the top of update so the code is not interrupted by a function
> definition? Maybe add a short comment to update and reportData would make it
> easier to read as well.

Moved the function to the top. I still have to declare index and other state
variables before the function as it uses these.

https://chromiumcodereview.appspot.com/10441021/diff/1/runtime/bin/mime_multi...
runtime/bin/mime_multipart_parser.dart:67: contentLength -= _contentStartIndex;
On 2012/05/25 08:11:58, Mads Ager wrote:
> So contentLength is the full length of contents seen so far and
> contentStartIndex indicates how much you have already sent to the
> partDataReceived callback. Comments on reportData would be good. :)

Re-arranged the state variables. Most are now local variables to the update
function instead of member variables. Added comments to these state variables.

https://chromiumcodereview.appspot.com/10441021/diff/1/tests/standalone/io/mi...
File tests/standalone/io/mime_multipart_parser_test.dart (right):

https://chromiumcodereview.appspot.com/10441021/diff/1/tests/standalone/io/mi...
tests/standalone/io/mime_multipart_parser_test.dart:27: (String name, String
value) =>
On 2012/05/25 08:11:58, Mads Ager wrote:
> I would use the braces for this multi-line closure. Either that or indent line
> 28 with four spaces.

Used {}s.

https://chromiumcodereview.appspot.com/10441021/diff/1/tests/standalone/io/mi...
tests/standalone/io/mime_multipart_parser_test.dart:77: //testWrite(data);
On 2012/05/25 08:11:58, Mads Ager wrote:
> Code in comment.

Un-commented.

https://chromiumcodereview.appspot.com/10441021/diff/1/tests/standalone/io/mi...
tests/standalone/io/mime_multipart_parser_test.dart:298: void testParseInvalid()
{
On 2012/05/25 08:11:58, Mads Ager wrote:
> You should add some tests here? :-)

Done.

Powered by Google App Engine
This is Rietveld 408576698