]> Cypherpunks repositories - gostls13.git/commit
mime/multipart: fix handling of empty parts without CRLF before next part
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 15 May 2012 01:16:47 +0000 (18:16 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 15 May 2012 01:16:47 +0000 (18:16 -0700)
commite393a8292ead03c78b570cf1f30ca1d54caf5445
treebc77bf3480a632f735928097da1900a82e3fe51e
parenta90cbd741a794b67a1c7b4932f40f7d40bd25702
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
https://golang.org/cl/6212046
src/pkg/mime/multipart/multipart.go
src/pkg/mime/multipart/multipart_test.go