Commit Graph

13242 Commits

Author SHA1 Message Date
Brad Fitzpatrick
e4ed9494e5 net/http: fix response Connection: close, close client connections
Fixes #3663
Updates #3540 (fixes it more)
Updates #1967 (fixes it more, re-enables a test)

R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/6213064
2012-05-23 11:19:38 -07:00
Robert Griesemer
7482822bba go/parser: minor cleanup
- there is no label scope at package level
- open/close all scopes symmetrically now
  that there is only one parse entry point
  (parseFile)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6230047
2012-05-23 09:37:48 -07:00
Brad Fitzpatrick
eacc3cc8a1 net/http: clarify ErrBodyNotAllowed error message
It's usually due to writing on HEAD requests.

R=golang-dev, rsc, r, r
CC=golang-dev
https://golang.org/cl/6206106
2012-05-23 09:31:24 -07:00
Shenghou Ma
e0b0f62d96 cmd/ld: fix Linux/ARM build
CL 5823055 removed a line introduced in Linux/ARM cgo support.
        Because readsym() now returns nil for "$a", "$d" mapping symbols,
        no matter the settings of `needSym', we still have to guard against
        them in ldelf().

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6220073
2012-05-23 11:36:24 +08:00
Alex Brainman
50e5951374 syscall: implement SetsockoptLinger for windows
R=rsc
CC=golang-dev
https://golang.org/cl/6225048
2012-05-23 13:05:05 +10:00
Brad Fitzpatrick
71c1a7b777 cmd/api: add api/next.txt
This quiets all.bash noise for upcoming features we know about.

The all.bash warnings will now only print for things not in next.txt
(or in next.txt but not in the API).

Once an API is frozen, we rename next.txt to a new frozen file
(like go1.txt)

Fixes #3651

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6218069
2012-05-22 18:41:20 -07:00
Andrew Balholm
33a89b5fda exp/html: adjust the last few insertion modes to match the spec
Handle text, comment, and doctype tokens in afterBodyIM, afterAfterBodyIM,
and afterAfterFramesetIM.

Pass three more tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6231043
2012-05-23 11:11:34 +10:00
Robert Griesemer
13a59b8c6d math/big: implement JSON un/marshaling support for Ints
Also: simplified some existing tests.

No support for Rats for now because the precision-preserving
default notation (fractions of the form a/b) is not a valid
JSON value.

Fixes #3657.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6211079
2012-05-22 17:20:37 -07:00
Ugorji Nwoke
4f7c33cd5a text/template: exec should accept interface value as valid.
Currently, if you pass some data to a template as an interface (e.g. interface{})
and extract that value that value as a parameter for a function, it fails, saying
wrong type.

This is because it is only looking at the interface type, not the interface content.

This CL uses the underlying content as the parameter to the func.

Fixes #3642.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6218052
2012-05-22 15:21:35 -07:00
Shenghou Ma
576d648b2a cmd/ld, cmd/6l, cmd/8l, cmd/5l: fix hidden/local symbol import for ELF systems
Introduce a newsym() to cmd/lib.c to add a symbol but don't add
them to hash table.
   Introduce a new bit flag SHIDDEN and bit mask SMASK to handle hidden
and/or local symbols in ELF symbol tables. Though we still need to order
the symbol table entries correctly.
   Fix for issue 3261 comment #9.
   For CL 5822049.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/5823055
2012-05-23 02:32:27 +08:00
Shenghou Ma
1c4b77a7c8 cmd/ld: take section symbols' value into account for PE
ld -r could generate multiple section symbols for the same section,
but with different values, we have to take that into account.
    Fixes #3322.
    Part of issue 3261.
    For CL 5822049.

R=golang-dev, iant, rsc, iant
CC=golang-dev
https://golang.org/cl/5823059
2012-05-23 02:27:44 +08:00
Shenghou Ma
090f9fc3ef sync/atomic: use cas64 to implement {Load,Store,Add}{Uint,Int}64 on Linux/ARM
Now with GOARM=5 our all.bash should pass on ARMv5 systems.
        Fixes #3331.

R=golang-dev, rsc, dvyukov
CC=golang-dev
https://golang.org/cl/6210071
2012-05-23 02:02:01 +08:00
Shenghou Ma
fb3a1b6821 runtime: support conditional execution in ARM softfloat
Fixes #3638.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6213057
2012-05-23 02:00:40 +08:00
Russ Cox
3d03ec8896 undo CL 6112054 / 2eec2501961c
Now that we've fixed the Expect: test, this CL should be okay.

««« original CL description
net/http: revert 97d027b3aa68

Revert the following change set:

        changeset:   13018:97d027b3aa68
        user:        Gustavo Niemeyer <gustavo@niemeyer.net>
        date:        Mon Apr 23 22:00:16 2012 -0300
        summary:     net/http: allow clients to disable keep-alive

This broke a test on Windows 64 and somebody else
will have to check.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6112054
»»»

Fixes #3540.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6228046
2012-05-22 13:56:40 -04:00
Russ Cox
77f00e5e5a unicode: fix comment about variable types
In both the web and command line tool,
the comment is shown after the declaration.
But in the code the comment is obviously before.
Make the text not refer to a specific order.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/6206094
2012-05-22 13:53:57 -04:00
Jan Ziak
fbaf59bf1e cmd/gc: export constants in hexadecimal
R=golang-dev, r, rsc, iant, remyoudompheng, dave
CC=golang-dev
https://golang.org/cl/6206077
2012-05-22 13:53:38 -04:00
Russ Cox
15436da232 crypto/md5: faster inner loop, 3x faster overall
The speedup is a combination of unrolling/specializing
the actual code and also making the compiler generate better code.

Go 1.0.1 (size: 1239 code + 320 data = 1559 total)
md5.BenchmarkHash1K   1000000	   7178 ns/op	 142.64 MB/s
md5.BenchmarkHash8K    200000	  56834 ns/op	 144.14 MB/s

Partial unroll  (size: 1115 code + 256 data = 1371 total)
md5.BenchmarkHash1K   5000000	   2513 ns/op	 407.37 MB/s
md5.BenchmarkHash8K    500000	  19406 ns/op	 422.13 MB/s

Complete unroll  (size: 1900 code + 0 data = 1900 code)
md5.BenchmarkHash1K   5000000	   2442 ns/op	 419.18 MB/s
md5.BenchmarkHash8K    500000	  18957 ns/op	 432.13 MB/s

Comparing Go 1.0.1 and the complete unroll (this CL):

benchmark               old MB/s     new MB/s  speedup
md5.BenchmarkHash1K       142.64       419.18    2.94x
md5.BenchmarkHash8K       144.14       432.13    3.00x

On the same machine, 'openssl speed md5' reports 441 MB/s
and 531 MB/s for our two cases, so this CL is at 90% and 80% of
those speeds, which is at least in the right ballpark.
OpenSSL is using carefully engineered assembly, so we are
unlikely to catch up completely.

Measurements on a Mid-2010 MacPro5,1.

R=golang-dev, bradfitz, agl
CC=golang-dev
https://golang.org/cl/6220046
2012-05-22 13:53:27 -04:00
Russ Cox
1c44575530 net/http: refactor body logic in test
This just eliminates some duplication.
Also add a pointer to RFC 1122, in case
this comes up again.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6229044
2012-05-22 13:46:53 -04:00
Dmitriy Vyukov
845aa1fc2c runtime: faster GC sweep phase
benchmark                              old ns/op    new ns/op    delta

garbage.BenchmarkParser               3731065750   3715543750   -0.41%
garbage.BenchmarkParser-2             3631299750   3495248500   -3.75%
garbage.BenchmarkParser-4             3386486000   3339353000   -1.39%
garbage.BenchmarkParser-8             3267632000   3286422500   +0.58%
garbage.BenchmarkParser-16            3299203000   3316081750   +0.51%

garbage.BenchmarkTree                  977532888    919453833   -5.94%
garbage.BenchmarkTree-2                919948555    853478000   -7.23%
garbage.BenchmarkTree-4                841329000    790207000   -6.08%
garbage.BenchmarkTree-8                787792777    740380666   -6.01%
garbage.BenchmarkTree-16               899257166    846594555   -5.86%

garbage.BenchmarkTree2                 574876300    571885800   -0.52%
garbage.BenchmarkTree2-2               348162700    345888900   -0.65%
garbage.BenchmarkTree2-4               184912500    179137000   -3.22%
garbage.BenchmarkTree2-8               104243900    103485600   -0.73%
garbage.BenchmarkTree2-16               97269500     85137100  -14.25%

garbage.BenchmarkParserPause           141101976    157746974  +11.80%
garbage.BenchmarkParserPause-2         103096051     83043048  -19.45%
garbage.BenchmarkParserPause-4          52153133     45951111  -11.89%
garbage.BenchmarkParserPause-8          36730190     38901024   +5.91%
garbage.BenchmarkParserPause-16         32678875     29578585   -9.49%

garbage.BenchmarkTreePause              29487065     29648439   +0.55%
garbage.BenchmarkTreePause-2            22443494     21306159   -5.07%
garbage.BenchmarkTreePause-4            15799691     14985647   -5.15%
garbage.BenchmarkTreePause-8            10768112     9531420   -12.97%
garbage.BenchmarkTreePause-16           16329891     15205158   -6.89%

garbage.BenchmarkTree2Pause           2586957240   2577533200   -0.36%
garbage.BenchmarkTree2Pause-2         1683383760   1673923800   -0.56%
garbage.BenchmarkTree2Pause-4         1102860320   1074040280   -2.68%
garbage.BenchmarkTree2Pause-8          902627920    886122400   -1.86%
garbage.BenchmarkTree2Pause-16         856470920    804152320   -6.50%

garbage.BenchmarkParserLastPause       277316000    280839000   +1.25%
garbage.BenchmarkParserLastPause-2     179446000    163687000   -8.78%
garbage.BenchmarkParserLastPause-4     106752000     94144000  -11.81%
garbage.BenchmarkParserLastPause-8      57758000     61640000   +6.72%
garbage.BenchmarkParserLastPause-16     51235000     42552000  -16.95%

garbage.BenchmarkTreeLastPause          45244000     50786000  +12.25%
garbage.BenchmarkTreeLastPause-2        37163000     34654000   -6.75%
garbage.BenchmarkTreeLastPause-4        24178000     21967000   -9.14%
garbage.BenchmarkTreeLastPause-8        20390000     15648000  -30.30%
garbage.BenchmarkTreeLastPause-16       22398000     20180000   -9.90%

garbage.BenchmarkTree2LastPause       5748706000   5718809000   -0.52%
garbage.BenchmarkTree2LastPause-2     3481570000   3458844000   -0.65%
garbage.BenchmarkTree2LastPause-4     1849073000   1791330000   -3.22%
garbage.BenchmarkTree2LastPause-8     1042375000   1034811000   -0.73%
garbage.BenchmarkTree2LastPause-16     972637000    851323000  -14.25%

There is also visible improvement in consumed CPU time:
tree2 -heapsize=8000000000 -cpus=12
before: 248.74user 6.36system 0:52.74elapsed 483%CPU
after:  229.86user 6.33system 0:51.08elapsed 462%CPU
-1.66s of real time, but -18.91s of consumed CPU time

R=golang-dev
CC=golang-dev
https://golang.org/cl/6215065
2012-05-22 13:35:52 -04:00
Robert Griesemer
581e7c2a78 go/ast: document CommentGroup.Text and add test case.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6206096
2012-05-22 10:30:35 -07:00
Brad Fitzpatrick
5a0333764b net/http: improve TestServerExpect
Fail more usefully, and Logf in one place instead of Errorf where
an error is acceptable.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6221059
2012-05-22 10:27:34 -07:00
Robert Griesemer
f26d61731d go/parser: fix comment grouping (day 1 bug)
Comment groups must end at the end of a line (or the
next non-comment token) if the group started on a line
with non-comment tokens.

This is important for correct computation of "lead"
and "line" comments (Doc and Comment fields in AST nodes).

Without this fix, the "line" comment for F1 in the
following example:

type T struct {
     F1 int // comment1
     // comment2
     F2 int
}

is "// comment1// comment2" rather than just "// comment1".

This bug was present from Day 1 but only visible when
looking at export-filtered ASTs where only comments
associated with AST nodes are printed, and only in rare
cases (e.g, in the case above, if F2 where not exported,
godoc would show "// comment2" anyway because it was
considered part of the "line" comment for F1).

The bug fix is very small (parser.go). The bulk of the
changes are additional test cases (parser_test.go).

The fix exposed a caching bug in go/printer via one of the
existing tests, hence the changes to printer.go.

As an aside, the fix removes the the need for empty lines
before an "// Output" comment for some special cases of
code examples (e.g.: src/pkg/strings/example_test.go, Count
example).

No impact on gofmt formatting of src, misc.

Fixes #3139.

R=rsc
CC=golang-dev
https://golang.org/cl/6209080
2012-05-22 10:04:34 -07:00
Robert Griesemer
f596eb5d8d godoc: slightly smarter synopsis extraction
Ignore synopses that start with
"Copyright", "All rights", and "Author".

R=rsc
CC=golang-dev
https://golang.org/cl/6218047
2012-05-22 10:04:13 -07:00
Robert Griesemer
7b9a6d8dda go/scanner: strip carriage returns from commments
Also:
- cleaned up and simplified TestScan
- added tests for comments containing carriage returns

Fixes #3647.

R=rsc
CC=golang-dev
https://golang.org/cl/6225047
2012-05-22 10:03:53 -07:00
Alexey Borzenkov
f7277dac57 net/url: better parsing of urls with @ symbol in authority
Fixes #3439

R=r, rsc, dsymonds, n13m3y3r
CC=golang-dev
https://golang.org/cl/6206090
2012-05-22 12:44:24 -04:00
Russ Cox
6a22e2fb3f cmd/6a: delete dead code
R=ken2
CC=golang-dev
https://golang.org/cl/6223060
2012-05-22 11:42:44 -04:00
Joel Sing
495a9dc2b3 syscall: implement nametomib() on netbsd
Implement nametomib() on NetBSD using the CTL_QUERY node discovery
mechanism.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6211071
2012-05-23 01:33:48 +10:00
Benjamin Black
5c6162cdd1 crypto/x509: Add ECDSA support
R=golang-dev, agl, rsc
CC=golang-dev
https://golang.org/cl/6208087
2012-05-22 11:03:59 -04:00
Adam Langley
5759c6022c crypto/ecdsa: add full set of NIST test vectors.
This includes the NIST test suite for ECDSA and alters the test to
parse and evaluate it.

R=golang-dev, bradfitz, rsc, b
CC=golang-dev
https://golang.org/cl/6219058
2012-05-22 10:33:14 -04:00
Adam Langley
477d7b1663 crypto/ecdsa: fix case where p != 0 mod 8 and the hash length < p.
I made a typo which breaks P-521.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6219057
2012-05-22 10:17:39 -04:00
Andrew Balholm
8f66d7dc32 exp/html: adjust inSelectIM to match spec
Simplify the flow of control.

Handle EOF, null bytes, <html>, <input>, <keygen>, <textarea>, <script>.

Pass 5 more tests.

R=golang-dev, rsc, nigeltao
CC=golang-dev
https://golang.org/cl/6220062
2012-05-22 15:30:13 +10:00
Russ Cox
c4ea1c955e cmd/8a, cmd/8l: add BSWAPL
R=ken2
CC=golang-dev
https://golang.org/cl/6208093
2012-05-22 00:29:07 -04:00
Russ Cox
ed480128a6 cmd/6a, cmd/6l: add BSWAPL, BSWAPQ
R=ken2
CC=golang-dev
https://golang.org/cl/6209087
2012-05-22 00:12:58 -04:00
Russ Cox
85266dfd4d runtime: relax TestGcSys
This fixes occasional 64-bit failures.
Maybe it will fix the 32-bit failures too,
so re-enable on 32-bit for now.

R=golang-dev, bradfitz, r, dvyukov
CC=golang-dev
https://golang.org/cl/6218050
2012-05-22 00:07:13 -04:00
Matthew Horsnell
875f34fd49 debug/elf: Expose entry point from Header in File struct.
Fixes #3470.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6195074
2012-05-21 23:29:30 -04:00
Andrew Balholm
7648f61c7d exp/html: adjust inCellIM to match spec
Clean up flow of control.

Ignore </table>, </tbody>, </tfoot>, </thead>, </tr> if there is not
an appropriate element in table scope.

Pass 3 more tests.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6206093
2012-05-22 10:31:08 +10:00
Russ Cox
053e4edd80 crypto/rsa: add SHA-224 hash prefix
http://www.rsa.com/rsalabs/node.asp?id=2125:

NOTE: A new OID has been defined for the combination
of the v1.5 signature scheme and the SHA-224 hash function:
        sha224WithRSAEncryption OBJECT IDENTIFIER ::=
Like the other sha*WithRSAEncryption OIDs in PKCS #1 v2.1,
this OID has NULL parameters.
The DigestInfo encoding for SHA-224 (see Section 9.2, Note 1) is:
        (0x)30 2d 30 0d 06 09 60 86 48 01 65 03 04 02 04 05 00 04 1c || H

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6208076
2012-05-21 14:10:16 -04:00
Brad Fitzpatrick
d45f22e3c8 net/http: fix duplicate status code in Response.Write
Fixes #3636

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6203094
2012-05-21 11:07:27 -07:00
Volker Dobler
b4456df6d2 net/http: add cookies from jar to POST request.
The main content of this CL is a test case checking the reported
issue 3511 and a tiny fix for it.  A subsequent CL will refactor
the fix as proposed issue 3511.

Fixes #3511.

R=golang-dev, steven.hartland, bradfitz
CC=golang-dev
https://golang.org/cl/6013049
2012-05-21 10:57:15 -07:00
Brad Fitzpatrick
30c0d2315e net/http: fix regression and mute known test failure for now
Two tests added in 820ffde8c are expected to fail until the fix
for Issue 3540 goes back in (pending Windows net fixes), so
make those tests just Logf for now, with a TODO to re-enable.

Add a new client test.

Rearrange the transport code to be more readable, and fix the
bug from 820ffde8c where the persistConn was being closed before
the body was fully ready.

Fixes #3644
Updates #1967 (not yet fixed, but should be after Issue 3540)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6211069
2012-05-21 10:39:31 -07:00
Russ Cox
8f8640a057 cmd/6g: allow use of R14, R15 now
We stopped reserving them in 2009 or so.

R=ken
CC=golang-dev
https://golang.org/cl/6215061
2012-05-21 12:59:26 -04:00
Joel Sing
40b310706b net: reduce dial tests on netbsd
Add NetBSD to the list of operating systems that have a reduced set
of dial tests.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6208083
2012-05-21 00:38:14 +10:00
Joel Sing
67a0c4f7f9 syscall: fix SockaddrDatalink on netbsd
RawSockaddrDatalink and SockaddrDatalink need to match - make Data
have length 12 for both.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6223051
2012-05-21 00:13:22 +10:00
Andrew Balholm
4973c1fc7e exp/html: adjust inRowIM to match spec
Delete cases that just fall down to "anything else" action.

Handle </tbody>, </tfoot>, and </thead>.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6203061
2012-05-20 14:26:20 +10:00
Mikio Hara
ba57c88003 net: fix leak in test
Also change the Listner variable name from l to ln.

R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/5918046
2012-05-19 10:42:54 +09:00
Mikio Hara
9cfb845af6 syscall: add comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6215046
2012-05-19 08:35:51 +09:00
James Gray
ccd63c3c19 net/http: non-keepalive connections close successfully
Connections did not close if Request.Close or Response.Close was true. This meant that if the user wanted the connection to close, or if the server requested it via "Connection: close", the connection would not be closed.

Fixes #1967.

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6201044
2012-05-18 10:34:37 -07:00
Brad Fitzpatrick
434625d1be A+C: add James Gray (Individual CLA)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6213055
2012-05-18 10:32:54 -07:00
Benjamin Black
57557c0d49 tls: add AES256 ciphers
R=golang-dev, rsc, agl
CC=golang-dev
https://golang.org/cl/6188061
2012-05-18 11:06:58 -04:00
Adam Langley
6f682de3c0 A+C: b@b3k.us
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6220050
2012-05-18 11:04:32 -04:00