1
0
mirror of https://github.com/golang/go synced 2024-10-04 02:21:21 -06:00
Commit Graph

22 Commits

Author SHA1 Message Date
Brad Fitzpatrick
d32d1e098a mime/multipart: transparently decode quoted-printable transfer encoding
Fixes #4411

R=dsymonds
CC=gobot, golang-dev
https://golang.org/cl/6854067
2012-11-19 19:50:19 -08:00
Lucio De Re
7e414a5b01 net,mime: Minor corrections to documentation comments.
R=r
CC=dsymonds, gobot, golang-dev
https://golang.org/cl/6495085
2012-09-07 10:24:55 -07:00
Brad Fitzpatrick
e393a8292e 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
2012-05-14 18:16:47 -07:00
Brad Fitzpatrick
87eaa4cd0c 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
2012-04-23 22:26:48 -07:00
Brad Fitzpatrick
eb53d472ef doc: use consistent receiver names, when it makes sense.
Makes for prettier docs.

R=golang-dev, dsymonds, r, rsc
CC=golang-dev
https://golang.org/cl/5576056
2012-01-30 11:58:49 -08:00
Vincent Vanackere
eb1717e035 all: rename os.EOF to io.EOF in various non-code contexts
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5334050
2011-11-03 14:01:30 -07:00
Russ Cox
c2049d2dfe src/pkg/[a-m]*: gofix -r error -force=error
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5322051
2011-11-01 22:04:37 -04:00
David Symonds
39493be294 io: rename Copyn to CopyN.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5157045
2011-09-30 13:13:39 -07:00
Brad Fitzpatrick
a986d98053 mime: ParseMediaType returns os.Error now, not a nil map
ParseMediaType previously documented that it always returned
a non-nil map, but also documented that it returned a nil map
to signal an error.

That is confusing, contradictory and not Go-like.

Now it returns (mediatype string, params map, os.Error).

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4867054
2011-08-18 12:51:23 -07:00
Robert Griesemer
90564a9256 go/printer: changed max. number of newlines from 3 to 2
manual changes in src/pkg/go/printer, src/cmd/gofix/signal_test.go
(cd src/cmd/gofix/testdata; gofmt -w *.in *.out)
(cd src/pkg/go/printer; gotest -update)
gofmt -w misc src

runs all tests

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4715041
2011-07-14 14:39:40 -07:00
Evan Martin
e45b3213cd multipart: use textproto to handle multiline header
R=bradfitz
CC=golang-dev
https://golang.org/cl/4686044
2011-07-09 15:18:31 -07:00
Brad Fitzpatrick
6282292f8d mime/multipart: parse LF-delimited messages, not just CRLF
Against the spec, but appear in the wild.

Fixes #1966

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4662059
2011-06-27 21:59:51 -07:00
Brad Fitzpatrick
98f95b8048 mime/multipart: convert Reader from interface to struct
It was always a weird interface but I didn't know what I
was doing at the time.  rsc questioned me about it then
but didn't press on it during review.  Then adg bugged me
about it too recently.

So clean it up. It parallels the Writer struct too.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/4602063
2011-06-16 08:55:53 -07:00
Brad Fitzpatrick
ef94520380 multipart: add FileName accessor on Part
R=rsc, adg
CC=golang-dev
https://golang.org/cl/4426074
2011-05-02 08:14:31 -07:00
Brad Fitzpatrick
db16bca18f multipart: return an error on Reader EOF, not (nil, nil)
R=rsc, adg
CC=golang-dev
https://golang.org/cl/4430074
2011-05-01 18:23:39 -07:00
Brad Fitzpatrick
27d0a731a2 mime/multipart: fix regression from previous ReadSlice change
The previous change to make multipart use ReadSlice out of
paranoia broke multipart to not deal with large lines in
the bodies.

We should only be paranoid about long lines in the header
sections.

Fixes http://code.google.com/p/camlistore/issues/detail?id=4

R=adg
CC=golang-dev
https://golang.org/cl/4432083
2011-04-30 19:54:36 -07:00
Andrew Gerrand
33ca16d616 mime/multipart: add ReadForm and associated types
R=brad_danga_com, rsc, dfc, r, dchest, bradfitz
CC=golang-dev
https://golang.org/cl/4439075
2011-04-28 13:14:35 +10:00
Brad Fitzpatrick
9d12307a12 ioutil: add Discard, update tree.
This also removes an unnecessary allocation in
http/transfer.go

R=r, rsc1, r2, adg
CC=golang-dev
https://golang.org/cl/4426066
2011-04-27 15:47:04 -07:00
Brad Fitzpatrick
ee154f5df5 mime/multipart: limit line length to prevent abuse
Fixes #1528

R=rsc
CC=golang-dev
https://golang.org/cl/4425060
2011-04-21 10:45:49 -07:00
Brad Fitzpatrick
6193e0ba00 mime/multipart: switch from map to MIMEHeader
R=rsc
CC=golang-dev
https://golang.org/cl/4253058
2011-03-06 15:12:03 -08:00
Rob Pike
d31ee536e8 update the tree to use the new regexp methods
R=rsc
CC=golang-dev
https://golang.org/cl/1983043
2010-08-12 16:48:41 +10:00
Brad Fitzpatrick
9b64fef71a mime/multipart and HTTP multipart/form-data support
Somewhat of a work-in-progress (in that MIME is a large spec), but this is
functional and enough for discussion and/or code review.

In addition to the unit tests, I've tested with curl and Chrome with
a variety of test files, making sure the digests of files are unaltered
when read via a multipart Part.

R=rsc, adg, dsymonds1, agl1
CC=golang-dev
https://golang.org/cl/1681049
2010-07-14 17:26:14 -07:00