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

3334 Commits

Author SHA1 Message Date
Nigel Tao
5f7b0bc366 image/jpeg: fix bounds calculation for grayscale JPEG images.
Also add grayscale test cases for image/decode_test.

R=r
CC=golang-dev
https://golang.org/cl/4526063
2011-05-17 15:47:14 -07:00
Robert Griesemer
9fa6cb2f2b big: better support for string conversions
Fixes #1842.

R=r
CC=golang-dev
https://golang.org/cl/4517081
2011-05-17 15:32:38 -07:00
Brad Fitzpatrick
9ea0bd3986 http: add http.SetCookie(ResponseWriter, *Cookie)
R=golang-dev, gary.burd, rsc
CC=golang-dev
https://golang.org/cl/4526062
2011-05-17 15:07:44 -07:00
Roger Peppe
83fd82b349 big: add Int methods to act on numbered bits.
Speeds up setting individual bits by ~75%, useful
when using big.Int as a bit set.

R=gri, rsc
CC=golang-dev
https://golang.org/cl/4538053
2011-05-17 13:38:21 -07:00
Robert Griesemer
8f57f49398 go/ast resolver: properly maintain map of package global imports
- add Data field to ast.Object
- for package objects, the Data field holds the package scope
- resolve several TODOs

R=rsc
CC=golang-dev
https://golang.org/cl/4538069
2011-05-17 11:22:52 -07:00
Rob Pike
1242c76794 reflect: make allocation test less fragile.
When GOMAXPROCS>1, the testing framework runs in parallel with the
test itself and may do a small number of allocations, so allow the
"noAllocs" condition to admit just a few.

Fixes #1782.

R=rsc
CC=golang-dev, rsc
https://golang.org/cl/4533041
2011-05-17 11:15:14 -04:00
Robert Hencke
3faa490f89 pkg: fix new incorrect prints found by govet
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4539063
2011-05-16 21:15:06 -07:00
Mikio Hara
db36e03692 net, http: add and make use of IP address scope identification API
Add seven methods to IP struct: IsUnspecified, IsLoopback,
IsMulticast, IsInterfaceLocalMulticast, IsLinkLocalMulticast,
IsLinkLocalUnicast and IsGlobalUnicast.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4515083
2011-05-16 23:21:13 -04:00
Alex Brainman
5342aedeed filepath: make EvalSymlinks work on Windows
Fixes #1830.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4526060
2011-05-17 12:33:36 +10:00
Rob Pike
de7c28fe76 image/gif: enable images with <8 bits per pixel.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4552042
2011-05-16 16:00:41 -07:00
Rob Pike
ff1093852f GIF: support decoding of interlaced images.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4535073
2011-05-16 15:17:17 -07:00
Gary Burd
aea17570c0 net: sort records returned by LookupSRV
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4518061
2011-05-16 17:48:00 -04:00
Mikio Hara
2ddcad96d7 net: protocol family adaptive address family selection
This CL will help to make an adaptive address family
selection possible when an any address family, vague
network string such as "ip", "tcp" or "udp" is passed
to Dial and Listen API.

Fixes #1769.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4438066
2011-05-16 17:03:06 -04:00
Alexey Borzenkov
b701cf3332 runtime: make StackSystem part of StackGuard
Fixes #1779

R=rsc
CC=golang-dev
https://golang.org/cl/4543052
2011-05-16 16:57:49 -04:00
Adam Langley
d84415d8f0 crypto/x509: support DSA public keys in X.509 certs.
R=agl
CC=golang-dev
https://golang.org/cl/4517072
2011-05-16 11:16:48 -07:00
Brad Fitzpatrick
3587085fb7 os: fix Windows build from earlier readdir change
It worked originally, until I renamed a variable. :/

dir_windows.go:11: undefined: e
http://godashboard.appspot.com/log/092397f2ac7a1e6e812dc6bebc65b40b02368700a119343d5cee5e2e89e0fde5

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4535072
2011-05-16 10:27:49 -07:00
Nigel Tao
0d111a62e1 image/jpeg: decode grayscale images, not just color images.
Also add an image package test that DecodeConfig returns the same
ColorModel as what Decode would.

R=r, r
CC=golang-dev
https://golang.org/cl/4529065
2011-05-16 10:13:17 -07:00
Brad Fitzpatrick
4da5cd4cd6 os: make Readdir & Readdirnames return os.EOF at end
Fixes #678

R=rsc, r, alex.brainman, bsiegert, jdpoirier
CC=golang-dev
https://golang.org/cl/4536058
2011-05-16 09:26:16 -07:00
Nigel Tao
77d66f4131 strings: make Reader.Read use copy instead of an explicit loop.
R=r, bradfitz, r
CC=golang-dev
https://golang.org/cl/4529064
2011-05-15 13:14:10 -07:00
Robert Hencke
cc2fc02467 pkg: fix incorrect prints found by govet
Also, clarify some error messages

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4548042
2011-05-14 20:43:18 -07:00
Brad Fitzpatrick
870791a5ac unicode: build maketables during testshort too
Fixes #1825

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4535066
2011-05-14 16:54:49 -07:00
Adam Langley
4eb67563f6 crypto/openpgp: change PublicKey.Serialize to include the header.
Signature.Serialize already does this and they should be consistent.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4521064
2011-05-14 19:13:12 -04:00
Brad Fitzpatrick
b2400c28cf fix windows build: http.Get finalURL removal missed earlier
Not sure why this only broke Windows. Make test is only run
on windows for that directory?

TBR=golang-dev

R=golang-dev
CC=golang-dev
https://golang.org/cl/4545044
2011-05-13 18:56:39 -07:00
Robert Griesemer
c35c672020 go/types: fix (some) builds
The position (type) for which the "invalid cycle" error
message is reported depends on which type in a cycle of
types is first checked. Which one is first depends on
the iteration order of maps which is different on
different platforms. For now, disable this error message.

R=rsc
CC=golang-dev
https://golang.org/cl/4527059
2011-05-13 18:33:04 -07:00
Brad Fitzpatrick
cd4d0004fa http: add Request.SetBasicAuth method
R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4543050
2011-05-13 15:43:46 -07:00
Luuk van Dijk
36cec789cd gc: generalize dst = append(src,...) inlining to arbitrary src and dst arguments.
R=rsc
CC=golang-dev
https://golang.org/cl/4517057
2011-05-14 00:35:10 +02:00
Robert Griesemer
ba006e6b6a go/types: type checker API + testing infrastructure
At the moment types.Check() only deals with global
types and only partially so. But the framework is
there to compute them and check for cycles. An initial
type test is passing.

First step of a series of CLs to come.

R=rsc
CC=golang-dev
https://golang.org/cl/4425063
2011-05-13 15:31:09 -07:00
Robert Griesemer
32b822f29a go spec: fix error in production syntax
Fix analoguous error in ebnf.go which already
correctly accepted an empty production.

Fixes #1821.

R=r
CC=golang-dev
https://golang.org/cl/4526056
2011-05-13 12:54:51 -07:00
Eivind Uggedal
092f34feca http: make HEAD client request follow redirects
HEAD requests should in my opinion have the ability to follow redirects
like the implementation of GET requests does. My use case is polling
several thousand severs to check if they respond with 200 status codes.
Using GET requests is neither efficient in running time of the task nor
for bandwidth consumption.

This suggested patch changes the return signature of http.Head() to match
that of http.Get(), providing the final URL in a redirect chain.

`curl -IL http://google.com` follows redirects with HEAD requests just fine.

Fixes #1806.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4517058
2011-05-13 08:17:59 -07:00
Brad Fitzpatrick
05a1b7ec41 http: remove finalURL from Client.Get; move to Response
This CL:

-- removes Response.RequestMethod string
-- adds Response.Request *Request
-- removes the finalURL result parameter from client.Get()
-- adds a gofix rule for callers of http.Get which assign
   the final url to the blank identifier; warning otherwise

Caller who did:

res, finalURL, err := http.Get(...)

now need to do:

res, err := http.Get(...)
if err != nil {
   ...
}
finalURL := res.Request.URL.String()

R=rsc
CC=golang-dev
https://golang.org/cl/4535056
2011-05-13 07:31:24 -07:00
Mikio Hara
4336116d3b net: remove unused functions
Remove unused functions, getip() and sockaddrToString().
Remove unnecessary linebreaks.

R=golang-dev
CC=golang-dev
https://golang.org/cl/4523062
2011-05-13 07:00:06 -07:00
Robert Hencke
142008c325 strconv: document and test True and False for Atob
R=golang-dev
CC=golang-dev
https://golang.org/cl/4535057
2011-05-12 22:00:50 -07:00
Robert Griesemer
71630337f2 go/*: various small fixes
parser:
- resolve embedded interface type names
ast:
- clarify some comments
- correctly unquote import paths

R=rsc
CC=golang-dev
https://golang.org/cl/4528060
2011-05-12 20:14:58 -07:00
Benny Siegert
14c59abd76 image/tiff: Reject images with SampleFormat != 1.
The TIFF spec says that a baseline TIFF reader must gracefully terminate
when the image has a SampleFormat tag which it does not support.
For baseline compatibility, only SampleFormat=1 (the default) is needed.
Images with other sample formats (e.g. floating-point color values)
are very rare in practice.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4515073
2011-05-12 22:34:48 -04:00
Brad Fitzpatrick
f4e5f364c7 html: parse empty, unquoted, and single-quoted attribute values
Fixes #1391

R=nigeltao
CC=golang-dev
https://golang.org/cl/4453054
2011-05-12 16:11:35 -07:00
Robert Griesemer
82d1a9dce7 go/printer: more accurate comment for incomplete structs/interfaces
A struct or interface type node is marked incomplete if fields or
methods have been removed through any kind of filtering, not just
because entries are not exported.

The current message was misleading in some cases (for instance:
"godoc -src reflect Implements").

This CL requires CL 4527050 .

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4529054
2011-05-12 09:01:50 -07:00
Robert Griesemer
d376935a18 go/ast: consider anonymous fields and set Incomplete bit when filtering ASTs
Also:
- fieldListExports: don't require internal pointer to StructType/InterfaceType node
- filterFieldLists: make structure match fieldListExports

R=rsc
CC=golang-dev
https://golang.org/cl/4527050
2011-05-12 09:01:32 -07:00
Robert Griesemer
26bbb2b2f7 go/doc, godoc: when filtering for godoc, don't remove elements of a declaration
Partially revert CL 4518050. In go/doc.go, instead of calling the go/ast filter
functions, implement the corresponding match functions that do no remove
declaration elements.

Fixes #1803.

R=rsc
CC=golang-dev
https://golang.org/cl/4517055
2011-05-12 09:01:10 -07:00
Brad Fitzpatrick
fa23a70044 http: fix two Transport gzip+persist crashes
There were a couple issues:

-- HEAD requests were attempting to be ungzipped,
   despite having no content.  That was fixed in
   the previous patch version, but ultimately was
   fixed as a result of other refactoring:

-- persist.go's ClientConn "lastbody" field was
   remembering the wrong body, since we were
   mucking with it later. Instead, ditch
   ClientConn's readRes func field and add a new
   method passing it in, so we can use a closure
   and do all our bodyEOFSignal + gunzip stuff
   in one place, simplifying a lot of code and
   not requiring messing with ClientConn's innards.

-- closing the gzip reader didn't consume its
   contents.  if the caller wasn't done reading
   all the response body and ClientConn closed it
   (thinking it'd move past those bytes in the
   TCP stream), it actually wouldn't.  so introduce
   a new wrapper just for gzip reader to have its
   Close method do an ioutil.Discard on its body
   first, before the close.

Fixes #1725
Fixes #1804

R=rsc, eivind
CC=golang-dev
https://golang.org/cl/4523058
2011-05-11 22:33:15 -04:00
Adam Langley
d080a1cf14 compress/zlib: actually use provided dictionary.
R=rsc, bradfitz, bradfitzgoog
CC=golang-dev
https://golang.org/cl/4518056
2011-05-11 17:00:19 -04:00
Christian Himpel
158970ea66 http: write cookies according to RFC 6265
RFC 6265 requires that user agents MUST NOT send more than
one Cookie header in a request.

Note, this change also fixes an issue when sending requests
with more than one cookie header line to a php script served
by an apache web server.  Apache concatenates the cookies
with ", ", but php tries to split them only at ";".  E.g.
two cookies: "a=b, c=d" are seen by php as one cookie "a"
with the value "b, c=d".

Fixes #1801

R=bradfitz
CC=golang-dev
https://golang.org/cl/4535048
2011-05-11 13:33:27 -07:00
Brad Fitzpatrick
ca83cd2c2f http: fix transport bug with zero-length bodies
An optimization in Transport which re-uses TCP
connections early in the case where there is
no response body interacted poorly with
ErrBodyReadAfterClose.  Upon recycling the TCP
connection early we would Close the Response.Body
(in case the user forgot to), but in the case
of a zero-lengthed body, the user's handler might
not have run yet.

This CL makes sure the Transport doesn't try
to Close requests when we're about to immediately
re-use the TCP connection.

This also includes additional tests I wrote
while debugging.

R=rsc, bradfitzgoog
CC=golang-dev
https://golang.org/cl/4529050
2011-05-11 12:11:32 -07:00
Nigel Tao
51e6aa1e88 image/bmp: implement a BMP decoder.
R=r
CC=golang-dev
https://golang.org/cl/4521054
2011-05-11 11:12:45 -07:00
Nigel Tao
67992cae53 image/gif: minor fixes.
R=r
CC=golang-dev
https://golang.org/cl/4523054
2011-05-11 11:11:25 -07:00
Adam Langley
55d43f0ce8 crypto/x509/crl: add package
crl parses CRLs and exposes their details. In the future, Verify
should be able to use this for revocation checking.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4485045
2011-05-11 10:39:09 -04:00
Luuk van Dijk
d6b2925923 gc: inline append when len<cap
issue 1604

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4313062
2011-05-11 16:35:11 +02:00
Brad Fitzpatrick
b276293aba http: don't Clean query string in relative redirects
R=adg, rsc, kevlar, r
CC=golang-dev
https://golang.org/cl/4476045
2011-05-11 04:30:05 -07:00
Robert Griesemer
0389051aac go/ast, go/doc, godoc: consider struct fields and interface methods when filtering ASTs
So far, only top-level names where considered when trimming ASTs
using a filter function. For instance, "godoc reflect Implements"
didn't show the "Implements" method of the type Interface because
the local method name was not considered (on the other hand, "top-
level" declared methods associated with types were considered).

With this CL, AST filter functions look also at struct fields
and interface methods.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4518050
2011-05-10 11:09:56 -07:00
Albert Strasheim
69a91663d2 runtime: add newline to "finalizer already set" error
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4523047
2011-05-10 13:47:56 -04:00
Nigel Tao
4c1e1b815b image/jpeg: speed up decoding by inlining the clip function and
writing the idct result directly to the image buffer instead of
storing it in an intermediate d.blocks field.

Writing to d.blocks was necessary when decoding to an image.RGBA image,
but now that we decode to a ycbcr.YCbCr we can write each component
directly to the image buffer.

Crude "time ./6.out" scores to decode a specific 2592x1944 JPEG 20
times show a 16% speed-up:

BEFORE

user	0m10.410s
user	0m10.400s
user	0m10.480s
user	0m10.480s
user	0m10.460s

AFTER

user	0m9.050s
user	0m9.050s
user	0m9.050s
user	0m9.070s
user	0m9.020s

R=r
CC=golang-dev
https://golang.org/cl/4523052
2011-05-09 17:25:32 -07:00
Robert Griesemer
499ad9448b go/printer, gofmt: fix alignment of "=" in const/var declarations
gofmt -w src misc

Fixes #1414.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4456054
2011-05-09 15:16:34 -07:00
Robert Griesemer
447db23c4a go/parser: always introduce an ast.Object when declaring an identifier
When traversing parameter lists (e.g. for type checking), we want the
invariant that all identifers have associated objects (even _ idents),
so that we can associate a type with each object.

R=rsc
CC=golang-dev
https://golang.org/cl/4490042
2011-05-09 14:48:05 -07:00
Rob Pike
45ea58746b gif: fix build
Had bit test wrong on transparency; no excuses.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4526044
2011-05-09 06:38:04 -07:00
Rob Pike
a54dca8357 image/gif: implement transparency.
At least, as I understand it. The spec is unclear about what happens
with a local color map.

R=nigeltao, r2
CC=golang-dev
https://golang.org/cl/4515045
2011-05-08 17:26:16 -07:00
Alex Brainman
8bf1515825 syscall: change Overlapped.HEvent type, it is a handle
R=golang-dev, r, r2
CC=golang-dev
https://golang.org/cl/4471046
2011-05-08 16:33:44 +10:00
Alex Brainman
b191155ab4 syscall: fix bug in mksyscall_windows.pl
This change fixes generation of "shadow" variables for bool parameters.
Before the change, it was naming all bool variables with the same name of _p0.
Now it calls them _p0, _p1, ... So the code could compile.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4479047
2011-05-08 16:32:00 +10:00
Rob Pike
92834d351e image/gif: GIF decoder
It's incomplete but sufficient to decode 8-bit GIFs without interlacing
or transparency.   More to come.

I'll put in more tests as the feature set grows.

R=nigeltao, r2
CC=golang-dev
https://golang.org/cl/4522041
2011-05-07 22:57:42 -07:00
Nigel Tao
f467803dcd compress/lzw: silently drop implied codes that are too large,
instead of returning an error.

For example, http://www.w3.org/Graphics/GIF/spec-gif89a.txt
explicitly says that GIF encoders can use a full table as is,
without needing to send a clear code.

R=r, dsymonds, nigeltao_gnome, r2
CC=golang-dev
https://golang.org/cl/4518041
2011-05-07 18:57:32 -07:00
Anschel Schaffer-Cohen
a4dee3a746 gob: Doc typo fix
Fixes #1785.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4496042
2011-05-07 11:05:08 -07:00
Albert Strasheim
0629354bd3 runtime: handle out-of-threads on Linux gracefully
R=rsc
CC=golang-dev
https://golang.org/cl/4396050
2011-05-06 15:29:49 -04:00
David Symonds
606e12f9bf http: fix typo in URL.String doc comment.
R=adg
CC=golang-dev
https://golang.org/cl/4485046
2011-05-06 10:00:50 -07:00
Alex Brainman
8253edcb4c wingui: fix Makefile after rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4477046
2011-05-06 17:15:46 +10:00
Adam Langley
ffd550455c crypto/tls: export the verified chains.
The verified chains are the chains that were actually verified.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4462046
2011-05-05 13:44:36 -04:00
Adam Langley
e1bf165b28 crypto/x509: export raw SubjectPublicKeyInfo.
The SPKI will probably be used for identifying public keys in future
HSTS specs.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4485044
2011-05-05 13:37:42 -04:00
Roger Peppe
da39008a27 image: make AlphaColor.Set conform to usual signature
R=nigeltao, r
CC=golang-dev
https://golang.org/cl/4471045
2011-05-05 10:16:59 -07:00
Benny Siegert
d97b8a817b image/tiff: implement a decoder.
The current iteration can decode 8-bit images in
grayscale, paletted, RGB, RGBA and NRGBA mode. LZW compression
is implemented but does not work on my test images.
Deflate (i.e. zlib) compression with or without a horizontal
predictor is supported.

R=nigeltao, nigeltao_gnome
CC=golang-dev, mpl
https://golang.org/cl/4240051
2011-05-04 20:52:55 -07:00
Dmitry Chestnykh
737e96c7f3 image/png: support encoding of paletted images with alpha channel.
Encoder now writes tRNS chunk for non-opaque paletted images.
CL includes new test images (basn3a08-trns.[ps]ng).

R=nigeltao, rsc, r
CC=golang-dev
https://golang.org/cl/4432078
2011-05-04 20:46:27 -07:00
Ross Light
bcf3bfe2fe http/spdy: add type to FlagClearPreviouslyPersistedSettings constant
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4436074
2011-05-04 15:01:33 -04:00
Nigel Tao
13f08cd807 exp/draw: fast paths for drawing a YCbCr or an NRGBA onto an RGBA.
On my laptop, I had an 800x600 jpeg and an 800x600 png (with
transparency). I timed how long it took to draw each image onto an
equivalently sized, zeroed RGBA image.

Previously, the jpeg took 75ms and the png took 70ms, going through
the medium-fast path, i.e. func drawRGBA in draw.go.

After this CL, the jpeg took 14ms, and the png took 21ms with the
Over operator and 12ms with the Src operator.

It's only a rough estimate basd on one image file, but it should
give an idea of the order of magnitude of improvement.

R=rsc, r
CC=adg, golang-dev
https://golang.org/cl/4468044
2011-05-04 10:17:53 -07:00
Andrew Gerrand
73f4b847ae http: fix FormFile nil pointer dereference on missing multipart form
R=rsc
CC=golang-dev
https://golang.org/cl/4463042
2011-05-03 20:45:10 -07:00
Alex Brainman
684e065d05 net: disable dnsmsg_test on windows
R=golang-dev, bradfitzwork
CC=golang-dev
https://golang.org/cl/4466041
2011-05-04 13:08:36 +10:00
Brad Fitzpatrick
4b30d7cead http: improve a test
Should prevent failures on slow machines, such as:
http://godashboard.appspot.com/log/47b5cae591b7ad8908704e327f3b9b41945d7d5fecfc0c8c945d5545ece1a813

Verified the change (on a fast machine) by removing the
existing sleep, in which case the race happens ~50% of the
time with GOMAXPROCS > 1, but recovers gracefully with
retries.

R=rsc
CC=golang-dev
https://golang.org/cl/4441089
2011-05-03 11:25:35 -07:00
Russ Cox
86e6a44112 reflect: allow unexported key in Value.MapIndex
Fixes #1748.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4444087
2011-05-03 10:38:37 -04:00
Brad Fitzpatrick
8ef56f7e92 net: don't crash on unexpected DNS SRV responses
Fixes #1350

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4432089
2011-05-03 07:10:48 -07:00
Brad Fitzpatrick
ec1ee024ad os: remove race paranoia from Environ(); it's guarded now
R=rsc
CC=golang-dev
https://golang.org/cl/4426077
2011-05-02 23:08:27 -04:00
Rob Pike
a2354cd4e4 image: fix build
accidentally deleted one method
TBR=rsc

R=rsc
CC=golang-dev
https://golang.org/cl/4438090
2011-05-02 15:42:46 -07:00
Rob Pike
2398a74bd8 image: add type-specific Set methods and use them when decoding PNG.
This speeds up PNG decode about 20% by avoiding per-pixel interface conversions.

R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/4428080
2011-05-02 15:10:37 -07:00
Russ Cox
4002014cf8 http/pprof: fix POST reading bug
R=bradfitz
CC=golang-dev
https://golang.org/cl/4430075
2011-05-02 17:34:22 -04:00
Brad Fitzpatrick
12cf1699e7 net: default to 127.0.0.1, not localhost, in TestICMP
If localhost resolves to ::1, the IPv4-only test fails.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4444084
2011-05-02 14:22:40 -07:00
Brad Fitzpatrick
6876ad37f3 runtime: maybe fix Windows build broken by cgo setenv CL
R=rsc
CC=golang-dev
https://golang.org/cl/4428078
2011-05-02 13:35:28 -07:00
Brad Fitzpatrick
f279a93929 http: fix racy test with a simpler version
This was seen breaking the slow arm5 builder:
http://godashboard.appspot.com/log/ec54ee302a70c07093e8f5c47454b3eb48768b77e1d8cc7943d8951f8b6696be

The test was unnecessarily complex and didn't benefit from
using httptest.Server. That just got in the way.

R=rsc
CC=golang-dev
https://golang.org/cl/4439088
2011-05-02 13:01:36 -07:00
Brad Fitzpatrick
623e7de187 os: make Setenv update C environment variables
Fixes #1569

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4456045
2011-05-02 12:38:13 -07:00
Robert Griesemer
3599e3fc12 go/printer: make tests follow syntactic restrictions
R=rsc
CC=golang-dev
https://golang.org/cl/4439087
2011-05-02 10:05:43 -07:00
Robert Griesemer
16381b145e go/token: faster FileSet.Position implementation
- added a cache for last file looked up: avoids binary
  search if the file matches

- don't look up extra line info if not present
  (it is almost never present)

- inline one critical binary search call (inlining
  provides almost 30% improvement in this case)

Together, these changes make the go/printer benchmark
more than twice as fast (53% improvement). gofmt also
sped up by about the same amount.

Also: removed an unused internal field from FileSet.

Measurements (always best of 5 runs):

* original:
  printer.BenchmarkPrint     5    238354200 ns/op (100%)

* using last file cache:
  printer.BenchmarkPrint    10    201796600 ns/op (85%)

* avoiding lookup of extra line info:
  printer.BenchmarkPrint    10    157072700 ns/op (66%)

* inlining a critical binary search call:
  printer.BenchmarkPrint    10    111523500 ns/op (47%)

gofmt (always best of 3 runs):

* before:
  time gofmt -l src misc
  real	0m33.316s
  user	0m31.298s
  sys	0m0.319s

* after:
  time gofmt -l src misc
  real	0m15.889s
  user	0m14.596s
  sys	0m0.224s

R=r, dfc, bradfitz, rsc1
CC=golang-dev
https://golang.org/cl/4433086
2011-05-02 09:17:46 -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
Mikio Hara
bc926713c7 net: enable SO_REUSEPORT on BSD variants
Fixes #1694.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4445067
2011-05-02 10:50:12 -04:00
Mikio Hara
756df8e081 net: fix ipv6 test
Fixes #1767.

R=rsc
CC=golang-dev
https://golang.org/cl/4436073
2011-05-02 10:49:42 -04:00
Russ Cox
540feaae47 runtime, sync/atomic: fix arm cas
Works around bug in kernel implementation on old ARM5 kernels.
Bug was fixed on 26 Nov 2007 (between 2.6.23 and 2.6.24) but
old kernels persist.

Fixes #1750.

R=dfc, golang-dev
CC=golang-dev
https://golang.org/cl/4436072
2011-05-02 10:49:19 -04:00
Brad Fitzpatrick
807ce2719c jpeg: speed up RGBA encoding ~%50
Avoids image.At(), color.RGBA(), opposing 8 bit shifts,
and min function calls in a loop.  Not as pretty as before,
but the pure version is still there to revert back to
later if/when the compiler gets better.

before (best of 5)
jpeg.BenchmarkEncodeRGBOpaque   50   64781360 ns/op   18.97 MB/s

after (best of 5)
jpeg.BenchmarkEncodeRGBOpaque   50   42044300 ns/op   29.23 MB/s

(benchmarked on an HP z600; 16 core Xeon E5520 @ 2.27Ghz)

R=r, r2, nigeltao
CC=golang-dev
https://golang.org/cl/4433088
2011-05-02 07:26:40 -07:00
Brad Fitzpatrick
437015bbed png: speed up opaque RGBA encoding
With Linux/8g on a 2006 Mac Mini (1.66 GHz Intel Core Duo,
2KB L1, 2MB L2, 2G main memory), GOMAXPROCS unset:

start:
png.BenchmarkEncodePaletted	      50	  44772820 ns/op
png.BenchmarkEncodeRGBOpaque	      10	 208395900 ns/op
png.BenchmarkEncodeRGBA		       5	 331088000 ns/op

remove interface method calls:
png.BenchmarkEncodePaletted	      50	  44722880 ns/op
png.BenchmarkEncodeRGBOpaque	      10	 139042600 ns/op
png.BenchmarkEncodeRGBA		       5	 334033600 ns/op

flate inline min/max():
png.BenchmarkEncodePaletted	      50	  40631180 ns/op
png.BenchmarkEncodeRGBOpaque	      10	 124894900 ns/op
png.BenchmarkEncodeRGBA		       5	 312099000 ns/op

after adler change:
png.BenchmarkEncodePaletted	      50	  40181760 ns/op
png.BenchmarkEncodeRGBOpaque	      20	 121781950 ns/op
png.BenchmarkEncodeRGBA		       5	 313890800 ns/op

In comparison to 121 ms on this 2006 machine, on my
Core2 Duo 2.66 GHz laptop, the final BenchmarkEncodeRGBOpaque
runs in 27 ms. (these are all for 640x480 images)

R=nigeltao, rsc, r
CC=golang-dev
https://golang.org/cl/4432077
2011-05-02 07:25:53 -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
Evan Shaw
366986a3fe syscall: add Windows file mapping functions and constants
R=brainman, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4375046
2011-05-02 09:35:55 +10:00
Andrew Gerrand
89adf5dce4 http: rename ErrBodyReadAferClose to ErrBodyReadAfterClose
R=bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/4432085
2011-05-01 12:37:20 -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
Brad Fitzpatrick
cb375ffbb0 http: new error for reading a body after it's been closed
R=adg
CC=golang-dev
https://golang.org/cl/4433094
2011-04-30 19:54:08 -07:00
Robert Griesemer
0d1f76ded2 go/parser: accept parenthesized receive operations in select statements
R=rsc
CC=golang-dev
https://golang.org/cl/4439082
2011-04-29 13:06:03 -07:00
Brad Fitzpatrick
f5fa215d8a image: png & jpeg encoding benchmarks
No code changes in this CL.

R=r
CC=golang-dev
https://golang.org/cl/4445074
2011-04-29 10:42:44 -07:00
Ian Lance Taylor
2e7d6729d4 http/cgi: pass down environment variables for irix and solaris
Used by gccgo.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4435080
2011-04-29 10:38:07 -07:00
Evan Shaw
0add1c3ed8 http/cgi: correctly set request Content-Type
R=bradfitz
CC=golang-dev
https://golang.org/cl/4433087
2011-04-29 07:04:28 -07:00
Robert Griesemer
da9b8b8352 go/printer: added simple performance benchmark
R=r, dfc, bradfitzwork, bradfitz
CC=golang-dev
https://golang.org/cl/4441078
2011-04-28 17:06:34 -07:00
Brad Fitzpatrick
548c9c8624 cgi: set Request.TLS and Request.RemoteAddr for children
R=agl, eds, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4432079
2011-04-28 15:02:32 -07:00
Evan Shaw
98945a2bad cgi: export RequestFromMap
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4452056
2011-04-28 13:30:53 -07:00
Ross Light
1801972b30 http/spdy: new package
R=bradfitz, agl1, rsc
CC=golang-dev
https://golang.org/cl/4435055
2011-04-28 13:11:37 -07:00
Russ Cox
6f88288a13 xml: fix reflect error
Fixes #1749.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4431075
2011-04-28 15:43:42 -04:00
Brad Fitzpatrick
df2c5d5429 http: update cookie doc to reference new RFC 6265
R=rsc, r2
CC=golang-dev
https://golang.org/cl/4442100
2011-04-28 11:36:06 -07:00
Gustavo Niemeyer
3e9a1d50db syslog: fix skipping of net tests
Also remove some left over copy & paste
in the test of reflect.Copy for arrays.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4431074
2011-04-28 14:16:41 -03:00
Evan Shaw
f319e1df37 http: add Header.Write method
R=golang-dev, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/4426069
2011-04-28 00:16:15 -07:00
Andrew Gerrand
200bd0a057 http: add MultipartForm, FormFile, and ParseMultipartForm to Request
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4431068
2011-04-28 15:21:54 +10:00
Brad Fitzpatrick
ba43be30c4 adler32: speed up ~40% by avoiding bounds checks
before & after:
adler32.BenchmarkGolden	  100000	     14747 ns/op
adler32.BenchmarkGolden	  200000	      8761 ns/op

Found by profiling PNG encoding.

R=rsc, bradfitzwork, eds
CC=golang-dev
https://golang.org/cl/4441073
2011-04-27 21:36:11 -07:00
Russ Cox
37b3494026 runtime: fix typo in gc bug fix
This time for sure.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4437078
2011-04-28 00:20:37 -04:00
Russ Cox
370276a3e5 runtime: stack split + garbage collection bug
The g->sched.sp saved stack pointer and the
g->stackbase and g->stackguard stack bounds
can change even while "the world is stopped",
because a goroutine has to call functions (and
therefore might split its stack) when exiting a
system call to check whether the world is stopped
(and if so, wait until the world continues).

That means the garbage collector cannot access
those values safely (without a race) for goroutines
executing system calls.  Instead, save a consistent
triple in g->gcsp, g->gcstack, g->gcguard during
entersyscall and have the garbage collector refer
to those.

The old code was occasionally seeing (because of
the race) an sp and stk that did not correspond to
each other, so that stk - sp was not the number of
stack bytes following sp.  In that case, if sp < stk
then the call scanblock(sp, stk - sp) scanned too
many bytes (anything between the two pointers,
which pointed into different allocation blocks).
If sp > stk then stk - sp wrapped around.
On 32-bit, stk - sp is a uintptr (uint32) converted
to int64 in the call to scanblock, so a large (~4G)
but positive number.  Scanblock would try to scan
that many bytes and eventually fault accessing
unmapped memory.  On 64-bit, stk - sp is a uintptr (uint64)
promoted to int64 in the call to scanblock, so a negative
number.  Scanblock would not scan anything, possibly
causing in-use blocks to be freed.

In short, 32-bit platforms would have seen either
ineffective garbage collection or crashes during garbage
collection, while 64-bit platforms would have seen
either ineffective or incorrect garbage collection.
You can see the invalid arguments to scanblock in the
stack traces in issue 1620.

Fixes #1620.
Fixes #1746.

R=iant, r
CC=golang-dev
https://golang.org/cl/4437075
2011-04-27 23:21:12 -04:00
Russ Cox
09092a78e6 cgo: handle versioned ELF symbols
Fixes #1397.

R=iant
CC=golang-dev
https://golang.org/cl/4444064
2011-04-27 23:21:03 -04:00
Russ Cox
70b0de8e98 runtime: allow use of >512 MB on 32-bit platforms
runtime: memory allocated by OS not in usable range
runtime: out of memory: cannot allocate 1114112-byte block (2138832896 in use)
throw: out of memory

runtime.throw+0x40 /Users/rsc/g/go/src/pkg/runtime/runtime.c:102
        runtime.throw(0x1fffd, 0x101)
runtime.mallocgc+0x2af /Users/rsc/g/go/src/pkg/runtime/malloc.c:60
        runtime.mallocgc(0x100004, 0x0, 0x1, 0x1, 0xc093, ...)
runtime.mal+0x40 /Users/rsc/g/go/src/pkg/runtime/malloc.c:289
        runtime.mal(0x100004, 0x20bc4)
runtime.new+0x26 /Users/rsc/g/go/src/pkg/runtime/malloc.c:296
        runtime.new(0x100004, 0x8fe84000, 0x20bc4)
main.main+0x29 /Users/rsc/x.go:11
        main.main()
runtime.mainstart+0xf /Users/rsc/g/go/src/pkg/runtime/386/asm.s:93
        runtime.mainstart()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:178
        runtime.goexit()
----- goroutine created by -----
_rt0_386+0xbf /Users/rsc/g/go/src/pkg/runtime/386/asm.s:80

R=iant, r
CC=golang-dev
https://golang.org/cl/4444073
2011-04-27 23:20:53 -04: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
bb1ec0dfc8 tar: use ioutil.Discard
This one didn't come up in previous greps.

R=adg
CC=golang-dev
https://golang.org/cl/4430071
2011-04-27 15:57:22 -07: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
ec3fe2a5b6 http: put a limit on POST size
R=rsc
CC=golang-dev
https://golang.org/cl/4432076
2011-04-27 15:36:39 -07:00
Brad Fitzpatrick
6e71e1ca76 http: keep gzip reader inside eofsignaler
Fixes #1725

R=rsc
CC=golang-dev
https://golang.org/cl/4442086
2011-04-27 14:23:25 -07:00
Gustavo Niemeyer
6850dba0ca reflect: Fix Copy of arrays
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4438077
2011-04-27 18:22:53 -03:00
Brad Fitzpatrick
b477a79c4e cgi: improve Location response handling
Add local URI path support, which isn't as fringe
as I originally thought. (it's supported by Apache)

Send an implicit 302 status on redirects (not 200).

Fixes #1597

R=rsc, r
CC=golang-dev
https://golang.org/cl/4442089
2011-04-27 14:07:13 -07:00
Peter Mundy
aee6b1160e runtime: fix mkversion to output valid path separators
In a GOROOT path a backslash is a path separator
not an escape character. For example, `C:\go`.
Fixes gotest error:
version.go:3: unknown escape sequence: g

R=rsc
CC=golang-dev
https://golang.org/cl/4437076
2011-04-27 15:47:12 -04:00
Evan Shaw
87ac7c77c0 http/fcgi: New package
R=golang-dev, bradfitzgo, bradfitzwork, nigeltao, rog
CC=golang-dev
https://golang.org/cl/4271078
2011-04-27 12:34:34 -07:00
Rob Pike
a2014f104c rpc: run benchmarks over HTTP as well as direct network connections.
R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4442085
2011-04-26 16:16:51 -07:00
Rob Pike
a0a10d1988 rpc: allow the argument (first arg of method) to be a value rather than a pointer.
Can make the API nicer in some cases.

R=rsc, rog, r2
CC=golang-dev
https://golang.org/cl/4428064
2011-04-26 15:07:25 -07:00
Brad Fitzpatrick
214b82f2e0 http: new tests + panic hunting issue 1725
No bugs found yet, though.

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4436058
2011-04-26 12:32:59 -07:00
Adam Langley
8803d57f3e crypto/x509: memorize chain building.
I ran the new verification code against a large number of certificates
with a huge (>1000) number of intermediates.

I had previously convinced myself that a cycle in the certificate
graph implied a cycle in the hash graph (and thus, a contradiction).
This is bogus because the signatures don't cover each other.

Secondly, I managed to drive the verification into a time explosion
with a fully connected graph of certificates. The code would try to
walk the factorial number of paths.

This change switches the CertPool to dealing with indexes of
certificates rather than pointers: this makes equality easy. (I didn't
want to compare pointers because a reasonable gc could move objects
around over time.)

Secondly, verification now memorizes the chains from a given
certificate. This is dynamic programming for the lazy, but there's a
solid reason behind it: dynamic programming would ignore the Issuer
hints that we can exploit by walking up the chain rather than down.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4439070
2011-04-26 10:26:22 -04:00
Albert Strasheim
839e9eada0 syscall: Mlock, Munlock, Mlockall, Munlockall on Linux.
R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4433070
2011-04-26 06:41:19 -07:00
Russ Cox
e2f9c73391 runtime: more graceful out-of-memory crash
Used to fault trying to access l->list->next
when l->list == nil after MCentral_AllocList.
Now prints

runtime: out of memory: no room in arena for 65536-byte allocation (536870912 in use)
throw: out of memory

followed by stack trace.

Fixes #1650.

R=r, dfc
CC=golang-dev
https://golang.org/cl/4446062
2011-04-26 08:25:40 -04:00
Alex Brainman
b1deb3be7f os: fix race in ReadAt/WriteAt on Windows
R=bradfitzgo, rsc, peterGo
CC=golang-dev
https://golang.org/cl/4441051
2011-04-26 18:09:46 +10:00
Brad Fitzpatrick
1038e7c853 http: make Client redirect policy configurable
Work on issue 155

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4435071
2011-04-25 22:41:50 -07:00
Andrew Gerrand
43b97ce69b websocket: include *http.Request in websocket.Conn
This permits the websocket handler to inspect http headers and such.

Fixes #1726.

R=ukai, bradfitz, bradfitzgo
CC=golang-dev
https://golang.org/cl/4439069
2011-04-26 10:47:49 +10:00
Dave Cheney
079a5cffb3 runtime: fix arm build
R=rsc, r
CC=golang-dev
https://golang.org/cl/4438069
2011-04-25 15:33:57 -07:00
Russ Cox
8698bb6c8c runtime: turn "too many EPIPE" into real SIGPIPE
Tested on Linux and OS X, amd64 and 386.

R=r, iant
CC=golang-dev
https://golang.org/cl/4452046
2011-04-25 16:58:00 -04:00
Ian Lance Taylor
41e5de2184 time: Support Irix 6 location for zoneinfo files.
R=rsc
CC=golang-dev
https://golang.org/cl/4440066
2011-04-25 12:37:00 -07:00
Russ Cox
07abf1c732 fix tree for reflect rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4435067
2011-04-25 13:39:36 -04:00
Russ Cox
0e2bb62f23 reflect: rename Typeof, NewValue -> TypeOf, ValueOf
R=r, bradfitzgo
CC=golang-dev
https://golang.org/cl/4433066
2011-04-25 13:39:16 -04:00
Russ Cox
a8bf6f32cc runtime: correct out of memory error
Fixes #1511.

R=golang-dev, iant2
CC=golang-dev
https://golang.org/cl/4433065
2011-04-25 12:13:54 -04:00
Adam Langley
a9a6c90104 crypto/tls: use time(), not Time().
The unexported version returns a sensible default when the user hasn't
set a value. The exported version crashes in that case.

R=bradfitzgo, rsc1
CC=golang-dev
https://golang.org/cl/4435070
2011-04-25 10:27:36 -04:00
Nigel Tao
b6cb4f9bf4 jpeg: decode to a YCbCr image instead of an RGBA image.
R=r
CC=golang-dev
https://golang.org/cl/4436053
2011-04-24 19:25:49 +10:00
Rob Pike
f3113ee9b9 fmt: tweak the doc for %U.
Fixes #1727.

R=rsc
CC=golang-dev
https://golang.org/cl/4437069
2011-04-23 11:25:27 -07:00
Russ Cox
4f7fd3cb7f runtime: disable long test (fix arm build)
TBR=r
CC=golang-dev
https://golang.org/cl/4449051
2011-04-23 10:03:51 -04:00
Ian Lance Taylor
14531fbaa5 fmt: decrease recursion depth
This permits the test to run when using gccgo on system
without split-stack support.  See
http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01420.html
http://gcc.gnu.org/PR48553

R=r
CC=golang-dev
https://golang.org/cl/4440062
2011-04-22 16:59:21 -07:00
David Symonds
d911b872ce container/heap: fix circular dependency in test
Having the test be in the container/heap package yields a cycle
  container/heap (for the test)
  -> testing
  -> time
  -> container/heap (for timerHeap)

Occasionally the linker would get mixed up, resulting in a test panic
in a very weird place.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4395042
2011-04-22 16:29:05 -04:00
Petar Maymounkov
f589728ff4 http: in ServerConn and ClientConn, rename Close to Hijack, add Close
R=rsc
CC=golang-dev
https://golang.org/cl/4372046
2011-04-22 15:56:27 -04:00
Adam Langley
361e4e5f64 crypto/rsa: add file that I forgot to add last time.
R=rsc
CC=golang-dev
https://golang.org/cl/4452041
2011-04-22 15:46:49 -04:00
Adam Langley
555685e26c crypto/rsa: support > 3 primes.
With full multi-prime support we can support version 1 PKCS#1 private
keys. This means exporting all the members of rsa.PrivateKey, thus
making the API a little messy. However there has already been another
request to export this so it seems to be something that's needed.

Over time, rsa.GenerateMultiPrimeKey will replace rsa.GenerateKey, but
I need to work on the prime balance first because we're no longer
generating primes which are a multiples of 8 bits.

Fixes #987.

R=rsc
CC=golang-dev
https://golang.org/cl/4378046
2011-04-22 15:33:41 -04:00
Russ Cox
781df132f9 runtime: stop deadlock test properly (fix arm5 build)
TBR=r
CC=golang-dev
https://golang.org/cl/4446058
2011-04-22 15:22:11 -04:00
Dave Cheney
d5864454dc syscall: fix Ftruncate under linux/arm5
Fixes #1714.

R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4441056
2011-04-22 14:44:18 -04:00
Brad Fitzpatrick
c94db30ec9 http/cgi: pass some default environment variables
This isn't really part of RFC 3875 but matches
the behavior of Apache, et al.

R=iant, iant2
CC=golang-dev
https://golang.org/cl/4435065
2011-04-22 11:02:33 -07:00
Brad Fitzpatrick
4335bee42e os/user: new package to look up users
Only for Unix presently. Other operating systems
are stubbed out, as well as arm (lacks cgo).

R=rsc, r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4440057
2011-04-22 09:30:30 -07:00
Brad Fitzpatrick
81cfb4ec2b http: fix FileServer's default text content type
Fixes #1729

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4443057
2011-04-22 09:09:37 -07:00
Ian Lance Taylor
75ca6d189c http/cgi: copy some PATH environment variables to child
R=bradfitz, bradfitzwork, iant2, bradfitzgo
CC=golang-dev
https://golang.org/cl/4444058
2011-04-22 08:53:52 -07:00
Alex Brainman
59c18b0b36 os: Open with O_APPEND|O_CREATE to append to the end of file on Windows
Credit for the fix goes to Hector, test by PeterGo.

Fixes #1655.

R=golang-dev, rsc1, peterGo
CC=golang-dev, hector
https://golang.org/cl/4436051
2011-04-22 15:31:25 +10:00
Brad Fitzpatrick
8d6a12f570 http: clarify docs on Request HTTP version
Fixes #910

R=adg, rsc1
CC=golang-dev
https://golang.org/cl/4439062
2011-04-21 19:57:19 -07:00
Brad Fitzpatrick
750b6c63f9 http: close underlying gzip Reader too
Fixes #1724

R=rsc
CC=golang-dev
https://golang.org/cl/4443056
2011-04-21 16:01:29 -07:00
Brad Fitzpatrick
a1f5f3f109 xml: Parser hook for non-UTF-8 charset converters
Adds an optional hook to Parser to let charset
converters step in when a processing directive
with a non-UTF-8 encoding is specified.

(Open to alternative proposals too...)

R=rsc
CC=golang-dev
https://golang.org/cl/4437061
2011-04-21 14:37:26 -07:00
Mikio Hara
380f4ab2ff syscall: add BPF support for darwin/386, darwin/amd64
note: due to issue 1466 the Msghdr and BpfProgram
struct for src/pkg/syscall/ztypes_darwin_386.go,
src/pkg/syscall/ztypes_darwin_amd64.go had to be
edited after the godefs generation.

R=rsc
CC=golang-dev
https://golang.org/cl/4403042
2011-04-21 16:58:20 -04: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
Dmitriy Vyukov
29d78f1243 runtime: fix GOMAXPROCS vs garbage collection bug
Fixes #1715.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4434053
2011-04-21 12:09:25 -04:00
Ian Lance Taylor
1f09cc25a1 runtime: skip functions with no lines when building src line table
Avoid getting out of synch when a function, such as main.init,
has no associated line number information.  Without this the
function before main.init can skip the PC all the way to the
next function, which will cause the next function's line table
to be associated with main.init, and leave subsequent
functions with the wrong line numbers.

R=rsc
CC=golang-dev
https://golang.org/cl/4426055
2011-04-21 08:32:58 -07:00
Albert Strasheim
946a4ea0e3 syscall: Madvise and Mprotect for Linux.
R=rsc
CC=golang-dev
https://golang.org/cl/4369047
2011-04-21 10:23:11 -04:00
Dmitry Chestnykh
a260de44e9 net: try /etc/hosts before loading DNS config.
On Mac X 10.6 /etc/resolv.conf is changed dynamically,
and may not exist at all when all network connections
are turned off, thus any lookup, even for "localhost"
would fail with "error reading DNS config: open
/etc/resolv.conf: no such file or directory". This
change avoids the error by trying to lookup addresses
in /etc/hosts before loading DNS config.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4431054
2011-04-21 10:23:03 -04:00
Mikio Hara
338b7abdfc net: fix EAI_BADFLAGS error on freebsd
R=rsc
CC=golang-dev
https://golang.org/cl/4442072
2011-04-21 10:22:53 -04:00
Vincent Vanackere
1f59004511 syscall : add a field to ProcAttr so that StartProcess can hide the executed application on windows
The SW_HIDE parameter looks like the only way for a windows GUI application to execute a CLI subcommand without having a shell windows appearing.

R=brainman, golang-dev, bradfitzgo, rsc1
CC=golang-dev
https://golang.org/cl/4439055
2011-04-22 00:12:06 +10:00
Russ Cox
5ff3336490 gc: correct handling of unexported method names in embedded interfaces
go/types: update for export data format change
reflect: require package qualifiers to match during interface check
runtime: require package qualifiers to match during interface check
test: fixed bug324, adapt to be silent

Fixes #1550.
Issue 1536 remains open.

R=gri, ken2, r
CC=golang-dev
https://golang.org/cl/4442071
2011-04-21 08:14:50 -04:00
Alex Brainman
5aad514674 syscall: correct Windows CreateProcess input parameters
Fixes #1718.

R=golang-dev, rsc, peterGo, r
CC=golang-dev
https://golang.org/cl/4435059
2011-04-21 10:36:27 +10:00
Rob Pike
c4cc9c282f gob: have errorf always prefix the message with "gob: "
to regularize the errors.

R=rsc
CC=golang-dev
https://golang.org/cl/4446055
2011-04-20 14:22:52 -07:00
Russ Cox
6e928e411b net: fix windows build
TBR=r
CC=golang-dev
https://golang.org/cl/4425059
2011-04-20 17:11:25 -04:00
Rob Pike
220f83134a gob: use new Implements and AssignableTo methods in reflect
to improve the code and removea  TODO.

R=rsc
CC=golang-dev
https://golang.org/cl/4443054
2011-04-20 14:07:13 -07:00
Brad Fitzpatrick
8dad7fec1d http: don't proxy loopback addresses
Fixes #1589

R=rsc
CC=golang-dev
https://golang.org/cl/4443053
2011-04-20 13:53:34 -07:00
Russ Cox
e1ee3b5db6 reflect: add Type.Implements, Type.AssignableTo, Value.CallSlice; make Set match Go
This CL makes reflect require that values be assignable to the target type
in exactly the same places where that is the rule in Go.  It also adds
the Implements and AssignableTo methods so that callers can check
the types themselves so as to avoid a panic.

Before this CL, reflect required strict type identity.

This CL expands Call to accept and correctly marshal arbitrary
argument lists for variadic functions; it introduces CallSlice for use
in the case where the slice for the variadic argument is already known.

Fixes #327.
Fixes #1212.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4439058
2011-04-20 16:24:45 -04:00
Russ Cox
c9164a5d77 net: use C library resolver on FreeBSD, Linux, OS X / amd64, 386
This CL makes it possible to resolve DNS names on OS X
without offending the Application-Level Firewall.

It also means that cross-compiling from one operating
system to another is no longer possible when using
package net, because cgo needs to be able to sniff around
the local C libraries.  We could special-case this one use
and check in generated files, but it seems more trouble
than it's worth.  Cross compiling is dead anyway.

It is still possible to use either GOARCH=amd64 or GOARCH=386
on typical Linux and OS X x86 systems.

It is also still possible to build GOOS=linux GOARCH=arm on
any system, because arm is for now excluded from this change
(there is no cgo for arm yet).

R=iant, r, mikioh
CC=golang-dev
https://golang.org/cl/4437053
2011-04-20 15:21:59 -04:00
Russ Cox
64787e3123 reflect: update CanAddr, CanSet documentation
CanAddr was wrong, out of date; CanSet was incomplete.

R=r
CC=golang-dev
https://golang.org/cl/4442066
2011-04-20 15:04:04 -04:00
Nigel Tao
6a186d38d1 src/pkg: make package doc comments consistently start with "Package foo".
R=rsc
CC=golang-dev
https://golang.org/cl/4442064
2011-04-20 09:57:05 +10:00
Rob Pike
3cb973ff65 gob: fix trivial bug in map marshaling.
Forgot to send key/value types.

R=rsc
CC=golang-dev, hmc2you
https://golang.org/cl/4434058
2011-04-19 10:41:12 -07:00
Adam Langley
b8df1465cc crypto/openpgp: better handling of keyrings.
* Accept armored private key blocks
  * If an armored block is missing, return an InvalidArgumentError,
    rather than ignoring it.
  * If every key in a block is skipped due to being unsupported,
    return the last unsupported error.
  * Include the numeric type of unsupported public keys.
  * Don't assume that the self-signature comes immediately after the
    user id packet.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4434048
2011-04-19 11:00:35 -04:00
Adam Langley
90d3837193 crypto/x509: fix build
This pulls in changes that should have been in 3faf9d0c10c0, but
weren't because x509.go was part of another changelist.

TBR=bradfitzgo

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4433056
2011-04-19 10:11:37 -04:00
Adam Langley
c24c6d8340 crypto: move certificate verification into x509.
People have a need to verify certificates in situations other than TLS
client handshaking. Thus this CL moves certificate verification into
x509 and expands its abilities.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4407046
2011-04-19 09:57:58 -04:00
Nigel Tao
5500f027f7 image/jpeg: add an encoder.
It is based on changeset 4186064 by Raph Levien <raph@google.com>.

R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4435051
2011-04-19 11:00:47 +10:00
Russ Cox
3bac16a6bf reflect: allow Slice of arrays
R=r
CC=golang-dev
https://golang.org/cl/4444049
2011-04-18 20:00:42 -04:00
Russ Cox
857f17d346 http: fix IP confusion in TestServerTimeouts
Don't assume that localhost == 127.0.0.1.
It might be ::1.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4430055
2011-04-18 16:03:24 -04:00
Russ Cox
cded21a337 changes for more restricted reflect.SetValue
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4423043
2011-04-18 14:36:22 -04:00
Russ Cox
40fccbce6b reflect: more efficient; cannot Set result of NewValue anymore
* Reduces malloc counts during gob encoder/decoder test from 6/6 to 3/5.

The current reflect uses Set to mean two subtly different things.

(1) If you have a reflect.Value v, it might just represent
itself (as in v = reflect.NewValue(42)), in which case calling
v.Set only changed v, not any other data in the program.

(2) If you have a reflect Value v derived from a pointer
or a slice (as in x := []int{42}; v = reflect.NewValue(x).Index(0)),
v represents the value held there.  Changing x[0] affects the
value returned by v.Int(), and calling v.Set affects x[0].

This was not really by design; it just happened that way.

The motivation for the new reflect implementation was
to remove mallocs.  The use case (1) has an implicit malloc
inside it.  If you can do:

       v := reflect.NewValue(0)
       v.Set(42)
       i := v.Int()  // i = 42

then that implies that v is referring to some underlying
chunk of memory in order to remember the 42; that is,
NewValue must have allocated some memory.

Almost all the time you are using reflect the goal is to
inspect or to change other data, not to manipulate data
stored solely inside a reflect.Value.

This CL removes use case (1), so that an assignable
reflect.Value must always refer to some other piece of data
in the program.  Put another way, removing this case would
make

       v := reflect.NewValue(0)
       v.Set(42)

as illegal as

       0 = 42.

It would also make this illegal:

       x := 0
       v := reflect.NewValue(x)
       v.Set(42)

for the same reason.  (Note that right now, v.Set(42) "succeeds"
but does not change the value of x.)

If you really wanted to make v refer to x, you'd start with &x
and dereference it:

       x := 0
       v := reflect.NewValue(&x).Elem()  // v = *&x
       v.Set(42)

It's pretty rare, except in tests, to want to use NewValue and then
call Set to change the Value itself instead of some other piece of
data in the program.  I haven't seen it happen once yet while
making the tree build with this change.

For the same reasons, reflect.Zero (formerly reflect.MakeZero)
would also return an unassignable, unaddressable value.
This invalidates the (awkward) idiom:

       pv := ... some Ptr Value we have ...
       v := reflect.Zero(pv.Type().Elem())
       pv.PointTo(v)

which, when the API changed, turned into:

       pv := ... some Ptr Value we have ...
       v := reflect.Zero(pv.Type().Elem())
       pv.Set(v.Addr())

In both, it is far from clear what the code is trying to do.  Now that
it is possible, this CL adds reflect.New(Type) Value that does the
obvious thing (same as Go's new), so this code would be replaced by:

       pv := ... some Ptr Value we have ...
       pv.Set(reflect.New(pv.Type().Elem()))

The changes just described can be confusing to think about,
but I believe it is because the old API was confusing - it was
conflating two different kinds of Values - and that the new API
by itself is pretty simple: you can only Set (or call Addr on)
a Value if it actually addresses some real piece of data; that is,
only if it is the result of dereferencing a Ptr or indexing a Slice.

If you really want the old behavior, you'd get it by translating:

       v := reflect.NewValue(x)

into

       v := reflect.New(reflect.Typeof(x)).Elem()
       v.Set(reflect.NewValue(x))

Gofix will not be able to help with this, because whether
and how to change the code depends on whether the original
code meant use (1) or use (2), so the developer has to read
and think about the code.

You can see the effect on packages in the tree in
https://golang.org/cl/4423043/.

R=r
CC=golang-dev
https://golang.org/cl/4435042
2011-04-18 14:35:33 -04:00
Brad Fitzpatrick
6211b596d6 mime: add a TODO, fix the format of an error
R=r, rsc1
CC=golang-dev
https://golang.org/cl/4440054
2011-04-18 11:21:16 -07:00
Brad Fitzpatrick
98176b7760 mime: RFC 2231 continuation / non-ASCII support
Fixes #1119.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4437052
2011-04-18 10:59:39 -07:00
Quan Yong Zhai
f80f97a351 net: fix dialgoogle_test.go
~$ nslookup www.google.com
Server: 8.8.8.8
cannonical name = www-g-com-chn.l.google.com.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/4445045
2011-04-18 11:19:47 -04:00
Russ Cox
90d8c8a09f runtime: fix arm5 softfloat
R=dfc, ken2, rsc
CC=golang-dev
https://golang.org/cl/4446043
2011-04-17 14:16:26 -04:00
Dave Cheney
a58fe3bd23 websocket: fix socket leak in test
Possibly fixes issue 1694.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4427049
2011-04-17 09:43:27 -07:00
Brad Fitzpatrick
90e4ece365 mime: bunch more tests, few minor parsing fixes
Working towards issue 1119

Using test data from http://greenbytes.de/tech/tc2231/

R=r
CC=golang-dev
https://golang.org/cl/4430049
2011-04-15 16:33:52 -07:00
Ross Light
bfb486875a compress/zlib: add FDICT flag in Reader/Writer
R=bradfitzgo, rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4406046
2011-04-15 15:32:03 -07:00
Brad Fitzpatrick
4787e70b7b http: handler timeout support
Fixes #213

R=r, rsc
CC=golang-dev
https://golang.org/cl/4432043
2011-04-15 12:53:32 -07:00
Russ Cox
b7065c5da4 net: disable one more external network test
R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4442042
2011-04-15 11:21:29 -04:00
Brad Fitzpatrick
9b8d4e0977 json: keep track of error offset in SyntaxError
R=rsc
CC=golang-dev
https://golang.org/cl/4430043
2011-04-15 08:14:34 -07:00
Brad Fitzpatrick
e806565626 http: reverse proxy handler
R=rsc, petar-m
CC=golang-dev
https://golang.org/cl/4428041
2011-04-15 08:13:52 -07:00
Ian Lance Taylor
a696da10e0 gob: when decoding a string, allocate a string, not a []byte.
R=r, r2
CC=golang-dev
https://golang.org/cl/4430042
2011-04-15 06:49:39 -07:00
Russ Cox
4c9634fc5b build: remove DISABLE_NET_TESTS
Don't use external network during all.bash.

R=r, r2, rh, ality
CC=golang-dev
https://golang.org/cl/4429041
2011-04-15 08:20:42 -04:00
David Symonds
57d0c26c01 expvar: add Func for functions that return values that are JSON marshalable.
Remove {Float,Int,String}Func, which are now redundant.

Fixes #1684.

R=rsc, r, r2
CC=golang-dev
https://golang.org/cl/4410041
2011-04-15 01:21:18 -07:00
Russ Cox
6ca71fb897 os: turn EPIPE exit into panic
R=iant, r2
CC=golang-dev
https://golang.org/cl/4427042
2011-04-15 00:01:29 -04:00
Quan Yong Zhai
c09af6631f net: fix ParseIP
Fixes #1695.

R=golang-dev, rsc
CC=golang-dev, r
https://golang.org/cl/4418042
2011-04-14 23:49:51 -04:00
Brad Fitzpatrick
71f9dc2cea http: add NewRequest helper
NewRequest will save a lot of boilerplate code.

This also updates some docs on Request.Write and
adds some tests.

R=rsc, petar-m, r
CC=golang-dev
https://golang.org/cl/4406047
2011-04-14 20:36:52 -07:00