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

88 Commits

Author SHA1 Message Date
Brad Fitzpatrick
a18f4ab569 all: use {bytes,strings}.NewReader instead of bytes.Buffers
Use the smaller read-only bytes.NewReader/strings.NewReader instead
of a bytes.Buffer when possible.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/54660045
2014-01-27 11:05:01 -08:00
Aram Hăvărneanu
f952d45508 all: add solaris build tags
R=golang-codereviews, minux.ma, gobot, rsc, dave
CC=golang-codereviews
https://golang.org/cl/36040043
2014-01-07 23:53:30 -05:00
Joel Sing
4186e9d313 all: dragonfly support
Enable remaining packages (crypto, mime, path, time) to build on dragonfly.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13190043
2013-08-24 02:22:52 +10:00
Pieter Droogendijk
b990c40d5e mime: escape backslash in attribute values
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12689045
2013-08-09 13:10:53 -07:00
Brad Fitzpatrick
d8e27db395 undo CL 12486043 / ab644299d124
Uglier.

««« original CL description
all: use strings.IndexByte instead of Index where possible

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486043
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/12485044
2013-08-05 16:27:24 -07:00
Brad Fitzpatrick
4c772cda54 all: use strings.IndexByte instead of Index where possible
R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486043
2013-08-05 15:46:06 -07:00
Rob Pike
16c9d3616a various: deleted unused items
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12396043
2013-08-03 16:01:04 +10:00
Rob Pike
abe384f68a all: be more idiomatic when documenting boolean return values.
Phrases like "returns whether or not the image is opaque" could be
describing what the function does (it always returns, regardless of
the opacity) or what it returns (a boolean indicating the opacity).
Even when the "or not" is missing, the phrasing is bizarre.

Go with "reports whether", which is still clunky but at least makes
it clear we're talking about the return value.

These were edited by hand. A few were cleaned up in other ways.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11699043
2013-07-23 11:59:49 +10:00
Anthony Martin
5567592c07 mime: add support for Plan 9
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10028043
2013-06-04 17:30:45 -07:00
Brad Fitzpatrick
24555c7b8c mime/multipart: don't strip leading space/tab in quoted-printable decoding
Late bug fix, but this is arguably a regression from Go 1.0,
since we added this transparent decoding since then. Without
this fix, Go 1.0 users could decode this correctly, but Go 1.1
users would not be able to.

The newly added test is from the RFC itself.

The updated tests had the wrong "want" values before. They
were there to test \r\n vs \n equivalence (which is
unchanged), not leading whitespace.

The skipWhite decoder struct field was added in the battles of
Issue 4771 in revision b3bb265bfecf. It was just a wrong
strategy, from an earlier round of attempts in
https://golang.org/cl/7300092/

Update #4771
Fixes #5295

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8536045
2013-04-17 20:04:58 -07:00
Brad Fitzpatrick
32f2fd15df doc/go1.1.html, mime/multipart: document quoted-printable decoding
Fixes #5293

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8840043
2013-04-17 13:25:28 -07:00
Robert Griesemer
0ad265d48f src/pkg: fixed various typos
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7936043
2013-03-20 16:32:37 -07:00
Brad Fitzpatrick
e15c0ac693 all: remove now-unnecessary unreachable panics
Take advantage of the new terminating statement rule.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/7712044
2013-03-11 14:16:55 -07:00
Brad Fitzpatrick
9c7aa5fea9 mime/multipart: allow unescaped newlines through in quoted-printable
This makes Go's quoted-printable decoder more like other
popular ones, allowing through a bare \r or \n, and also
passes through \r\n which looked like a real bug before.

Fixes #4771

R=minux.ma
CC=golang-dev
https://golang.org/cl/7300092
2013-02-22 10:40:23 -08:00
Rob Pike
35367cc641 mime: use Scanner to read mime files during init
Also close the file when we're done.

R=bradfitz
CC=golang-dev
https://golang.org/cl/7363045
2013-02-20 14:34:03 -08:00
Alex Brainman
d844001601 mime: do not test for .wav on windows
Even builders don't have that mime type

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7314106
2013-02-15 16:55:51 +11:00
Alex Brainman
f9dbbdb1d3 mime: use .wav instead of .bmp during windows tests
Some systems do not have .bmp mime.

Update #4723.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7326047
2013-02-15 15:52:54 +11:00
Robin Eklind
a1231839b5 mime, strconv: Make testdata more consistent.
All packages place testdata in a specific directory with the name
"testdata". The mime and strconv packages have been updated to use
the same convention.

mime: Move "mime/test.types" to "mime/testdata/test.types". Update test
code accordingly.

strconv: Move "strconv/testfp.txt" to "strconv/testdata/testfp.txt".
Update test code accordingly.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7098072
2013-01-22 13:44:35 -08:00
Shenghou Ma
d46d0f15a7 all: remove exec bit on files
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7128048
2013-01-18 02:41:17 +08:00
Brad Fitzpatrick
575de93dd3 mime/multipart: allow setting the Writer boundary
Fixes #4490

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6924044
2012-12-10 16:30:42 -05:00
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
Alexey Borzenkov
a108369c83 syscall: return EINVAL when string arguments have NUL characters
Since NUL usually terminates strings in underlying syscalls, allowing
it when converting string arguments is a security risk, especially
when dealing with filenames. For example, a program might reason that
filename like "/root/..\x00/" is a subdirectory or "/root/" and allow
access to it, while underlying syscall will treat "\x00" as an end of
that string and the actual filename will be "/root/..", which might
be unexpected. Returning EINVAL when string arguments have NUL in
them makes sure this attack vector is unusable.

R=golang-dev, r, bradfitz, fullung, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6458050
2012-08-05 17:24:32 -04:00
David G. Andersen
e66d29cdcf pkg: Removing duplicated words ("of of", etc.), mostly from comments.
Ran 'double.pl' on the pkg tree to identify doubled words.
One change to an error string return in x509;  the rest are in comments.
Thanks to Matt Jibson for the idea.

R=golang-dev, bsiegert
CC=golang-dev
https://golang.org/cl/6344089
2012-07-09 09:16:10 +10: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
7f7a70f225 mime: make ParseMediaType return zero results on error
Fixes #3562

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/6119051
2012-04-25 12:01:01 -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
7127b6fddc bytes,strings: make *Reader implement io.ReaderAt
R=golang-dev, adg, bradfitz, r
CC=golang-dev
https://golang.org/cl/5675053
2012-02-15 12:58:00 +11:00
Brad Fitzpatrick
9df6fdcc1c mime: unexport some internal details
Fixes #2941

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/5663046
2012-02-14 12:48:28 +11:00
Russ Cox
2050a9e478 build: remove Make.pkg, Make.tool
Consequently, remove many package Makefiles,
and shorten the few that remain.

gomake becomes 'go tool make'.

Turn off test phases of run.bash that do not work,
flagged with $BROKEN.  Future CLs will restore these,
but this seemed like a big enough CL already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05: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
Brad Fitzpatrick
a00de45bbb mime: make FormatMediaType take full type for consistency
Fixes #2405

R=rsc
CC=golang-dev
https://golang.org/cl/5539048
2012-01-17 11:57:42 -08:00
Joel Sing
9ca57a706c crypto/mime/net/time: add netbsd to +build tags
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5501052
2011-12-21 21:44:47 +11:00
Alex Brainman
a462816753 build: multiple fixes to make "go install" work on windows
R=rsc
CC=golang-dev
https://golang.org/cl/5502054
2011-12-21 16:57:44 +11:00
Christopher Nielsen
728c16cf13 build: Changes to the build infrastructure for NetBSD.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5476048
2011-12-12 15:42:06 -05:00
Alex Brainman
ef65feda2a syscall: return error, not uintptr, when function returns error
R=rsc
CC=golang-dev
https://golang.org/cl/5450119
2011-12-08 12:07:21 +11:00
Alex Brainman
9bfe9dfde7 mime: remove ".wav" from tests (to fix build)
It looks like not all computers have
mime type for .wav extension.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5415045
2011-11-18 13:24:17 +11:00
Alex Brainman
ac17fd4cd2 mime: implement TypeByExtension for windows
Fixes #2071.

R=golang-dev, hcwfrichter, pascal, rsc
CC=golang-dev
https://golang.org/cl/5369056
2011-11-18 10:07:36 +11:00
Russ Cox
fd34e78b53 various: reduce overuse of os.EINVAL + others
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5372081
2011-11-13 22:42:42 -05:00
Rob Pike
45e3bcb343 renaming_3: gofix -r go1pkgrename src/pkg/[m-z]*
R=rsc
CC=golang-dev
https://golang.org/cl/5345045
2011-11-08 15:41:54 -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
Russ Cox
b50a847c3c csv, gob, json, mail, mime, xml: use rune
Nothing terribly interesting here.

R=golang-dev, r, borman
CC=golang-dev
https://golang.org/cl/5315043
2011-10-25 22:23:54 -07:00
Brad Fitzpatrick
bba7396fbd strings: implement a faster byte->string Replacer
This implements a replacer for when all old strings are single
bytes, but new values are not.

BenchmarkHTMLEscapeNew   1000000   1090 ns/op
BenchmarkHTMLEscapeOld   1000000   2049 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/5176043
2011-10-03 15:19:04 -07: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
Russ Cox
91643acc6f mime: fix build
The fix is to add ' ' after ';' so that we match
what we used to generate.
Packages like http look for the string with
the space in it, and I don't see a reason to
be so terse.

Also s/buffer/b/

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/4959044
2011-08-26 17:19:52 -04:00
Pascal S. de Kloe
bd3627cd7d mime: text charset defaults
Enforce + document the UTF-8 default.

R=rsc, bradfitz, adg
CC=golang-dev
https://golang.org/cl/4627049
2011-08-26 16:55:25 -04:00
Pascal S. de Kloe
fbdbb595b6 mime: media type formatter
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4654069
2011-08-26 16:55:18 -04: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
Russ Cox
971459e826 net/textproto: fix build
R=bradfitz
CC=golang-dev
https://golang.org/cl/4815041
2011-07-20 11:41:41 -04:00