Commit graph

10093 commits

Author SHA1 Message Date
Brad Fitzpatrick 5079129deb http: DoS protection: cap non-Handler Request.Body reads
Previously, if an http.Handler didn't fully consume a
Request.Body before returning and the request and the response
from the handler indicated no reason to close the connection,
the server would read an unbounded amount of the request's
unread body to advance past the request message to find the
next request's header. That was a potential DoS.

With this CL there's a threshold under which we read
(currently 256KB) in order to keep the connection in
keep-alive mode, but once we hit that, we instead
switch into a "Connection: close" response and don't
read the request body.

Fixes #2093 (along with number of earlier CLs)

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5268043
2011-10-14 17:34:07 -07:00
Anthony Martin b5077f82fa http: avoid panic caused by nil URL
The current code will panic if an invalid
request (one with a nil URL) is passed to
the doFollowingRedirects function.

Also, remove a redundant nil Header check.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5270046
2011-10-14 17:09:38 -07:00
Robert Griesemer c5b3a4fb07 godoc: updates for latest Go app-engine release.
R=adg
CC=golang-dev
https://golang.org/cl/5273044
2011-10-14 16:06:39 -07:00
Andrew Gerrand 92b7b48213 doc: add go-tour-kr, a Korean translation of A Tour of Go
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5273043
2011-10-15 08:42:31 +11:00
Dave Cheney a3ff67c3a7 godefs: add enum/const testdata
Also, add golden output data for linux/arm.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5256041
2011-10-14 17:34:00 -04:00
Chris Farmiloe 55751a38f0 xml: match Marshal's XMLName behavior in Unmarshal
When xml.Marshal is called on a struct it will happily
reflect the information in the "tag" of an XMLName member
regardless of the type to give the struct a tag-name in
it's XML form. This is backed up by the documentation which
says:

However xml.Unmarshal *does* care about the XMLName field
being of type xml.Name, and currently returns the error
"field XMLName does not have type xml.Name" if you have it
set to something else.

This is firstly inconsistant with xml.Marshal but it also
makes it impossible to use xml.Marshal alongside other
Marshallers (like json/bson) without poluting the state's
namespace with XMLName fields. Inorder to exclude fields
from other Marshallers the convention has been started to
tag fields as "omitempty"; which will cause the field not
to display if it is at it's "zero" state, XMLName cannot
have such as zero-state since it is a struct, so it is nicer
to use a pointer/bool value for XMLName so it can be easily
excluded when I want to Marshal my struct by some other
wire format.

Attached is the proposed minor change, that simply stops
erring if it can't set the name on the XMLName field, which
is just optional metadata anyway.
Fixes #2265.

R=rsc
CC=golang-dev
https://golang.org/cl/5067044
2011-10-14 17:29:54 -04:00
Brad Fitzpatrick b9ad2787dd http: RoundTrippers shouldn't mutate Request
Fixes #2146

R=rsc
CC=golang-dev
https://golang.org/cl/5284041
2011-10-14 14:16:43 -07:00
Russ Cox 236aff31c5 gofmt: fix //line handling
Fixes #2369.

R=gri
CC=golang-dev
https://golang.org/cl/5275048
2011-10-14 15:54:45 -04:00
Russ Cox 12ece77c14 build: stop on failed deps.bash
Apparently some versions of bash do the ||exit implicitly
when in set -e mode, but others do not.  ???

R=gri
CC=golang-dev
https://golang.org/cl/5285043
2011-10-14 15:54:36 -04:00
Jaroslavas Počepko ff866c4ca3 ld: Fixes issue 1899 ("cannot create 8.out.exe")
http://code.google.com/p/go/issues/detail?id=1899

R=rsc, alex.brainman, bsiegert, hectorchu, bradfitz
CC=golang-dev
https://golang.org/cl/4978047
2011-10-14 20:37:07 +01:00
Adam Langley b3812bf6db crypto/x509: add code for dealing with PKIX public keys.
We also have functions for dealing with PKCS#1 private keys. This
change adds functions for PKIX /public/ keys. Most of the time one
won't be parsing them because they usually come in certificates, but
marshaling them happens and I've previously copied the code from
x509.go for this.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5286042
2011-10-14 15:11:21 -04:00
Adam Langley e74dcbeb0f crypto/x509: keep the raw Subject and Issuer.
X509 names, like everything else X509, are ludicrously general. This
change keeps the raw version of the subject and issuer around for
matching. Since certificates use a distinguished encoding, comparing
the encoding is the same as comparing the values directly. This came
up recently when parsing the NSS built-in certificates which use the
raw subject and issuer for matching trust records to certificates.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5275047
2011-10-14 15:06:54 -04:00
Adam Langley 37e802a7c5 asn1: accept UTF8 strings as ASN.1 ANY values
R=bradfitz
CC=golang-dev
https://golang.org/cl/5172042
2011-10-14 15:06:11 -04:00
Brad Fitzpatrick c4b9c8bb7d http: shut up a false Transport warning on Windows
Fixes #2057

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5269044
2011-10-14 11:31:00 -07:00
Luca Greco d296fa1c95 websocket: tweak hybi ReadHandshake to supports Firefox implementation
Firefox Websocket implementation send a "Connection: keep-alive, upgrade"
header during the handshake (and as descripted on the last hybi draft
the "Connection" header must include, but doesn't need to be equal to,
"upgrade":

   '4. A "Connection" header field that includes the token "Upgrade",
    treated as an ASCII case-insensitive value.'

From:
http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17#page-23

R=golang-dev, ukai, cw, rsc
CC=golang-dev
https://golang.org/cl/5233059
2011-10-14 14:27:45 -04:00
Russ Cox 6c1f4ff15f A+C: Luca Greco (individual CLA)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5274045
2011-10-14 14:27:26 -04:00
Chris Hundt 550fa3fa2d goyacc: make more gofmt-compliant
Adjust goyacc.go to produce code that is gofmt-compliant whenever it is easy to do so. Also changed two lines in cpyact that appeared to be bugs.

Also updated units.y to remove a few other errors.

After this change, units.go has only two style errors: an extra newline at the top of the file, and yys misaligned in yySymType.

R=rsc
CC=golang-dev
https://golang.org/cl/5265047
2011-10-14 13:10:02 -04:00
Russ Cox b9faf5ff7d CONTRIBUTORS: Chris Hundt (Google CLA)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5284043
2011-10-14 13:09:56 -04:00
Brad Fitzpatrick ddc3381e8b net: skip ICMP test on Windows too unless uid 0
This test fails for me on Windows 7 64-bit non-Admin.

R=golang-dev, rsc, krautz
CC=golang-dev
https://golang.org/cl/5276048
2011-10-14 10:07:27 -07:00
Mikkel Krautz ec10d67725 crypto/tls: fix broken looping code in windows root CA fetcher
R=alex.brainman, hectorchu, rsc
CC=golang-dev
https://golang.org/cl/5263045
2011-10-14 12:26:38 -04:00
David Anderson bb282baa93 syscall: adjust Mount to accomodate stricter FS implementations.
Notably, the "data" argument should be nil if no options are
given, or (at least) the cgroup filesystem will refuse to
mount.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5147047
2011-10-14 09:19:45 -07:00
Alex Brainman 8225f4d71f crypto/tls: disable root cert fetching to fix windows build
R=golang-dev
CC=golang-dev
https://golang.org/cl/5267044
2011-10-14 17:53:01 +11:00
Nigel Tao b82a8e7c22 html: fix some tokenizer bugs with attribute key/values.
The relevant spec sections are 13.2.4.38-13.2.4.40.
http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#attribute-value-(double-quoted)-state

R=andybalholm
CC=golang-dev
https://golang.org/cl/5262044
2011-10-14 15:22:02 +11:00
Mikkel Krautz 3153395ed0 crypto/tls: fetch root CA from Windows store
R=rsc
CC=golang-dev
https://golang.org/cl/5281044
2011-10-13 22:58:19 -04:00
Robert Griesemer 812249fe5e gotype: move to exp/gotype per Go 1 plan
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/5269043
2011-10-13 16:36:53 -07:00
Robert Griesemer da7538c29c gotype: fix build (update test)
R=r
CC=golang-dev
https://golang.org/cl/5277044
2011-10-13 16:06:27 -07:00
Nigel Tao a49b8b9875 html: rewrite the tokenizer to be more consistent.
Previously, the tokenizer made two passes per token. The first pass
established the token boundary. The second pass picked out the tag name
and attributes inside that boundary. This was problematic when the two
passes disagreed. For example, "<p id=can't><p id=won't>" caused an
infinite loop because the first pass skipped everything inside the
single quotes, and recognized only one token, but the second pass never
got past the first '>'.

This change rewrites the tokenizer to use one pass, accumulating the
boundary points of token text, tag names, attribute keys and attribute
values as it looks for the token endpoint.

It should still be reasonably efficient: text, names, keys and values
are not lower-cased or unescaped (and converted from []byte to string)
until asked for.

One of the token_test test cases was fixed to be consistent with
html5lib. Three more test cases were temporarily disabled, and will be
re-enabled in a follow-up CL. All the parse_test test cases pass.

R=andybalholm, gri
CC=golang-dev
https://golang.org/cl/5244061
2011-10-14 09:58:39 +11:00
Russ Cox 6198336bb5 gofix: make fix order explicit
Also test only specific fixes, not all fixes.
This means we don't have to keep updating old
test cases to match later changes to the library.

I had to adjust some of the reflect test cases,
because they were implicitly testing
reflect+oserrorstring, not just reflect.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5283042
2011-10-13 18:45:38 -04:00
Robert Griesemer 29c2838cb4 go/types: move to exp/types per Go 1 plan
This package is only used by gotype at the moment.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5266042
2011-10-13 15:41:48 -07:00
Russ Cox f58ed4e641 gc: disallow close on receive-only channels
Fixes #2353.
Fixes #2246.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5282042
2011-10-13 16:58:04 -04:00
Russ Cox d65aaf24a6 crypto/tls: more Unix root certificate locations
Hard work done by
http://mercurial.selenic.com/wiki/CACertificates

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5276043
2011-10-13 16:17:15 -04:00
Russ Cox d1bafffa4b runtime: run goroutines during init
Fixes #583.
Fixes #1776.
Fixes #2001.
Fixes #2112.

R=golang-dev, bradfitz, r, gri
CC=golang-dev
https://golang.org/cl/5265044
2011-10-13 15:54:23 -04:00
Russ Cox eb3aba24b5 gc: stricter multiple assignment + test
Fixes #693.

R=ken2
CC=golang-dev
https://golang.org/cl/5265045
2011-10-13 15:46:39 -04:00
Russ Cox fa538114ed spec: define order of multiple assignment
R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5240055
2011-10-13 15:44:17 -04:00
Mikkel Krautz 38fb09b412 crypto/tls: fetch root certificates using Mac OS API
Fixes #1009.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/5262041
2011-10-13 13:59:13 -04:00
Christopher Wedgwood 604bd70085 make.bash: more robustly detect gold 2.20
On recent Debian systems the gold 2.20 check triggers though
Debian doesn't have version 2.20 but rather has:

        GNU gold (GNU Binutils for Debian 2.21.52.20110606) 1.11
                                                ^^^^

R=rsc, iant
CC=golang-dev
https://golang.org/cl/5252055
2011-10-13 12:25:25 -04:00
Russ Cox c18d1a78a4 gc: implement new return restriction
R=ken2
CC=golang-dev
https://golang.org/cl/5245056
2011-10-13 12:17:55 -04:00
Russ Cox 06862617c1 build: fix for new return restriction
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5257057
2011-10-13 12:17:18 -04:00
Russ Cox f0e82dd493 go/types: clean up after test
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5245057
2011-10-13 12:17:08 -04:00
Evan Martin 3ac7cae6e8 emacs: add a "godoc" command, like M-x man
This runs godoc and displays its output in a new buffer.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5268041
2011-10-13 09:07:42 -07:00
Brad Fitzpatrick 145c18365e doc: minor homepage tweak
Don't imply that the tour isn't browser-based.

R=adg
CC=golang-dev
https://golang.org/cl/5265041
2011-10-13 09:03:24 -07:00
Dmitriy Vyukov bf9c778fe2 gc: pass FlagNoPointers to runtime.new
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5151043
2011-10-13 11:06:55 +03:00
Dmitriy Vyukov cd5f144fe2 doc: remove link to http://golanguage.ru/
I check it for several months and it always says
ERR_NAME_RESOLUTION_FAILED

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5272041
2011-10-13 10:09:43 +03:00
Robert Hencke c50182480d pkg: fix incorrect prints found by govet
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/5266041
2011-10-13 13:34:01 +11:00
Benny Siegert beed0a7844 image/tiff: Implement PackBits decoding.
The decompression routine is in its own file because
G3 encoding (which is more complicated) will be put
there.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5177047
2011-10-13 13:31:26 +11:00
Andrew Balholm c64e8e327e html: insert implied <p> and </p> tags
(test # 25 in tests1.dat)
#data
<p><b><div></p></b></div>X
#document
| <html>
|   <head>
|   <body>
|     <p>
|       <b>
|     <div>
|       <b>
|
|           <p>
|           "X"

R=nigeltao
CC=golang-dev
https://golang.org/cl/5254060
2011-10-13 12:40:48 +11:00
Nigel Tao 85368292a3 html: when a parse test fails, don't bother testing rendering.
R=andybalholm
CC=golang-dev
https://golang.org/cl/5248061
2011-10-13 11:53:15 +11:00
Rob Pike 1204f740cf gotest: correct the documentation of -parallel.
It said the default was zero, but it's actually $GOMAXPROCS.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5229059
2011-10-12 16:56:39 -07:00
Rob Pike aa2f439c6a fmt: remove an obsolete reference to os.ErrorString in a comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5229057
2011-10-12 13:50:08 -07:00
Christopher Wedgwood 707e5acd71 updates: append(y,[]byte(z)...) -> append(y,z...)"
(more are possible but omitted for now as they are part of
specific tests where rather than changing what is there we
should probably expand the tests to cover the new case)

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5247058
2011-10-12 13:42:04 -07:00