Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(299)

Issue 6212046: code review 6212046: mime/multipart: fix handling of empty parts without CRL... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 10 months ago by bradfitz
Modified:
12 years, 10 months ago
Reviewers:
CC:
golang-dev, adg
Visibility:
Public.

Description

mime/multipart: fix handling of empty parts without CRLF before next part Empty parts can be either of the form: a) "--separator\r\n", header (w/ trailing 2xCRLF), \r\n "--separator"... or b) "--separator\r\n", header (w/ trailing 2xCRLF), "--separator"... We never handled case b). In fact the RFC seems kinda vague about it, but browsers seem to do a), and App Engine's synthetic POST bodies after blob uploads is of form b). So handle them both, and add a bunch of tests. (I can't promise these are the last fixes to multipart, especially considering its history, but I'm growing increasingly confident at least, and I've never submitted a multipart CL with known bugs outstanding, including this time.)

Patch Set 1 #

Patch Set 2 : diff -r c93b5846e97b https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r c93b5846e97b https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r c93b5846e97b https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 5 : diff -r 55fd2dba69aa https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+292 lines, -68 lines) Patch
M src/pkg/mime/multipart/multipart.go View 1 2 3 9 chunks +79 lines, -36 lines 0 comments Download
M src/pkg/mime/multipart/multipart_test.go View 1 2 3 3 chunks +213 lines, -32 lines 0 comments Download

Messages

Total messages: 7
bradfitz
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 10 months ago (2012-05-14 19:11:12 UTC) #1
bradfitz
Hold on reviewing. Reading the RFC, we don't handle optional LWSP after boundaries before CRLF. ...
12 years, 10 months ago (2012-05-14 19:36:25 UTC) #2
bradfitz
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 10 months ago (2012-05-14 23:25:36 UTC) #3
bradfitz
This is ready for review now. I think it's simpler than it was before now, ...
12 years, 10 months ago (2012-05-14 23:27:05 UTC) #4
bradfitz
FYI http://codereview.appspot.com/6212046/diff/6001/src/pkg/mime/multipart/multipart_test.go File src/pkg/mime/multipart/multipart_test.go (left): http://codereview.appspot.com/6212046/diff/6001/src/pkg/mime/multipart/multipart_test.go#oldcode18 src/pkg/mime/multipart/multipart_test.go:18: func TestHorizontalWhitespace(t *testing.T) { and this function is ...
12 years, 10 months ago (2012-05-14 23:36:04 UTC) #5
adg
LGTM Wow.
12 years, 10 months ago (2012-05-15 00:56:22 UTC) #6
bradfitz
12 years, 10 months ago (2012-05-15 01:16:57 UTC) #7
*** Submitted as http://code.google.com/p/go/source/detail?r=32a8b0e41031 ***

mime/multipart: fix handling of empty parts without CRLF before next part

Empty parts can be either of the form:

a) "--separator\r\n", header (w/ trailing 2xCRLF), \r\n "--separator"...
or
b) "--separator\r\n", header (w/ trailing 2xCRLF), "--separator"...

We never handled case b).  In fact the RFC seems kinda vague about
it, but browsers seem to do a), and App Engine's synthetic POST
bodies after blob uploads is of form b).

So handle them both, and add a bunch of tests.

(I can't promise these are the last fixes to multipart, especially
considering its history, but I'm growing increasingly confident at
least, and I've never submitted a multipart CL with known bugs
outstanding, including this time.)

R=golang-dev, adg
CC=golang-dev
http://codereview.appspot.com/6212046
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b