]> Cypherpunks repositories - gostls13.git/commit
mime/multipart: report io.EOF correctly on part ending without newlines
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 24 Apr 2012 05:26:48 +0000 (22:26 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 24 Apr 2012 05:26:48 +0000 (22:26 -0700)
commit87eaa4cd0c3e33c75bb53d9ea082030cef4da923
tree2fad19c848e1acb39339c7215697aa40db05ca6a
parent5fc2af1f777f0544c2813e67ba92a26b0c8be4f2
mime/multipart: report io.EOF correctly on part ending without newlines

If a part ends with "--boundary--", without a final "\r\n",
that's also a graceful EOF, and we should return io.EOF instead
of the fmt-wrapped io.EOF from bufio.Reader.ReadSlice.

I found this bug parsing an image attachment from gmail.
Minimal test case stripped down from the original
gmail-generated attachment included.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6118043
src/pkg/mime/multipart/multipart.go
src/pkg/mime/multipart/multipart_test.go
src/pkg/mime/multipart/testdata/nested-mime [new file with mode: 0755]