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

321 Commits

Author SHA1 Message Date
Mikio Hara
cca39ff3b1 net: don't show verbose information when -test.v=false
Updates #10845.

Change-Id: I4cec670c7db88c50a6e5619e611744e161d73b3c
Reviewed-on: https://go-review.googlesource.com/10131
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-23 01:13:51 +00:00
Dave Cheney
994b2d4645 net: fix panic in TestDialerDualStack
This change ensures that the test does not try to close dual stack
listeners which have not yet been opened.

Spotted in crash here
http://build.golang.org/log/e5843777df400868ce708b7f00c50dc32c2ec478

Change-Id: I79d513e166effb3e018e2b9dfc23751d92fcbe4b
Reviewed-on: https://go-review.googlesource.com/10371
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-22 03:27:59 +00:00
Mikio Hara
49894be7b1 net: document that ListenMulticastUDP is for simple applications
Also mentions golang.org/x/net/ipv4 and golang.org/x/net/ipv6.

Change-Id: I653deac7a5e2b129237655a72d6c91207f1b1685
Reviewed-on: https://go-review.googlesource.com/9779
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-20 22:30:52 +00:00
Mikio Hara
7eec656bfd net: fix the series of TestLookup and external tests
On Windows, we need to make sure that the node under test has external
connectivity.

Fixes #10795.

Change-Id: I99f2336180c7b56474fa90a4a6cdd5a6c4dd3805
Reviewed-on: https://go-review.googlesource.com/10006
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-20 07:54:37 +00:00
Mikio Hara
17177a0daa net: fix data race in TestSocket{Conn,PacketConn}
Fixes #10891.

Change-Id: Ie432c9c5520ac29cea8fe6452628ec467567eea5
Reviewed-on: https://go-review.googlesource.com/10194
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-20 07:24:09 +00:00
Alex A Skinner
ef7e108565 net: redo resolv.conf recheck implementation
The previous implementation spawned an extra goroutine to handle
rechecking resolv.conf for changes.

This change eliminates the extra goroutine, and has rechecking
done as part of a lookup.  A side effect of this change is that the
first lookup after a resolv.conf change will now succeed, whereas
previously it would have failed.  It also fixes rechecking logic to
ignore resolv.conf parsing errors as it should.

Fixes #8652
Fixes #10576
Fixes #10649
Fixes #10650
Fixes #10845

Change-Id: I502b587c445fa8eca5207ca4f2c8ec8c339fec7f
Reviewed-on: https://go-review.googlesource.com/9991
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-15 18:14:47 +00:00
Mikio Hara
b83b011100 net: fix vet missed format error in test
Change-Id: I73c0aeb4b27fec84149c8e89753b27ff2190eabf
Reviewed-on: https://go-review.googlesource.com/10074
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-05-14 07:18:36 +00:00
Mikio Hara
ef54930ebb net: simplify sync.Once calls in tests
Change-Id: I0c2e1a4a8261887a696e585dda46e72d691191e0
Reviewed-on: https://go-review.googlesource.com/10070
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-14 01:47:35 +00:00
Brad Fitzpatrick
e5febf957f net/http: flush request body chunks in Transport
The Transport's writer to the remote server is wrapped in a
bufio.Writer to suppress many small writes while writing headers and
trailers. However, when writing the request body, the buffering may get
in the way if the request body is arriving slowly.

Because the io.Copy from the Request.Body to the writer is already
buffered, the outer bufio.Writer is unnecessary and prevents small
Request.Body.Reads from going to the server right away. (and the
io.Reader contract does say to return when you've got something,
instead of blocking waiting for more). After the body is finished, the
Transport's bufio.Writer is still used for any trailers following.

A previous attempted fix for this made the chunk writer always flush
if the underlying type was a bufio.Writer, but that is not quite
correct. This CL instead makes it opt-in by using a private sentinel
type (wrapping a *bufio.Writer) to the chunk writer that requests
Flushes after each chunk body (the chunk header & chunk body are still
buffered together into one write).

Fixes #6574

Change-Id: Icefcdf17130c9e285c80b69af295bfd3e72c3a70
Reviewed-on: https://go-review.googlesource.com/10021
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-14 00:29:24 +00:00
Mikio Hara
645e77ef10 net/internal/socktest: fix data race
Fixes #10796.

Change-Id: Ifcd2e771c64114e210fbfc5efaaceb53c534f745
Reviewed-on: https://go-review.googlesource.com/10007
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-13 21:38:34 +00:00
Mikio Hara
3b38626f7d net: don't run IP stack required tests on IP stack unimplemented kernels
Fixes #10787.

Change-Id: I35c96808a713dafb1f0fea301fa3f3528fe6a5bf
Reviewed-on: https://go-review.googlesource.com/9948
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-05-13 05:16:19 +00:00
Mikio Hara
6f7961da28 net, internal/syscall/unix: add SocketConn, SocketPacketConn
FileConn and FilePacketConn APIs accept user-configured socket
descriptors to make them work together with runtime-integrated network
poller, but there's a limitation. The APIs reject protocol sockets that
are not supported by standard library. It's very hard for the net,
syscall packages to look after all platform, feature-specific sockets.

This change allows various platform, feature-specific socket descriptors
to use runtime-integrated network poller by using SocketConn,
SocketPacketConn APIs that bridge between the net, syscall packages and
platforms.

New exposed APIs:
pkg net, func SocketConn(*os.File, SocketAddr) (Conn, error)
pkg net, func SocketPacketConn(*os.File, SocketAddr) (PacketConn, error)
pkg net, type SocketAddr interface { Addr, Raw }
pkg net, type SocketAddr interface, Addr([]uint8) Addr
pkg net, type SocketAddr interface, Raw(Addr) []uint8

Fixes #10565.

Change-Id: Iec57499b3d84bb5cb0bcf3f664330c535eec11e3
Reviewed-on: https://go-review.googlesource.com/9275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-13 01:04:23 +00:00
Alex Brainman
71bf182028 net: relax error checking in TestAcceptIgnoreSomeErrors
TestAcceptIgnoreSomeErrors was created to test that network
accept function ignores some errors. But conditions created
by the test also affects network reads. Change the test to
ignore these read errors when acceptable.

Fixes #10785

Change-Id: I3da85cb55bd3e78c1980ad949e53e82391f9b41e
Reviewed-on: https://go-review.googlesource.com/9942
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-12 04:02:25 +00:00
Mikio Hara
64b1aa12b3 net: drop unnecessary cast
Change-Id: I9b058472f5b4943db6e6f1c1243411ce61624c18
Reviewed-on: https://go-review.googlesource.com/9916
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-11 22:03:56 +00:00
Alexandre Cesaro
2b03610842 mime: Export RFC 2047 code
Fixes #4943
Fixes #4687
Fixes #7079

Change-Id: Ia96f07d650a3af935cd75fd7e3253f4af2977429
Reviewed-on: https://go-review.googlesource.com/7890
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-11 18:50:32 +00:00
Daniel Morsing
516f0d1c90 net/http: silence race detector on client header timeout test
When running the client header timeout test, there is a race between
us timing out and waiting on the remaining requests to be serviced. If
the client times out before the server blocks on the channel in the
handler, we will be simultaneously adding to a waitgroup with the
value 0 and waiting on it when we call TestServer.Close().

This is largely a theoretical race. We have to time out before we
enter the handler and the only reason we would time out if we're
blocked on the channel. Nevertheless, make the race detector happy
by turning the close into a channel send. This turns the defer call
into a synchronization point and we can be sure that we've entered
the handler before we close the server.

Fixes #10780

Change-Id: Id73b017d1eb7503e446aa51538712ef49f2f5c9e
Reviewed-on: https://go-review.googlesource.com/9905
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-11 16:41:03 +00:00
Mikio Hara
cbcc7584de net: increase timeout in TestWriteTimeoutFluctuation on darwin/arm
On darwin/arm, the test sometimes fails with:

Process 557 resuming
--- FAIL: TestWriteTimeoutFluctuation (1.64s)
	timeout_test.go:706: Write took over 1s; expected 0.1s
FAIL
Process 557 exited with status = 1 (0x00000001)
go_darwin_arm_exec: timeout running tests

This change increaes timeout on iOS builders from 1s to 3s as a
temporarily fix.

Updates #10775.

Change-Id: Ifdaf99cf5b8582c1a636a0f7d5cc66bb276efd72
Reviewed-on: https://go-review.googlesource.com/9915
Reviewed-by: Minux Ma <minux@golang.org>
2015-05-11 06:03:40 +00:00
Mikio Hara
82359d1c2d net: enable cgo test on solaris
Change-Id: I4ade27469d82839b4396e1a88465dddc6b31d578
Reviewed-on: https://go-review.googlesource.com/9838
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-05-09 02:58:50 +00:00
Alex Brainman
c3559f1621 net: do not skip TestAcceptIgnoreSomeErrors
No code changes, but the test passes here.
And TryBots are happy.

Fixes #8662 maybe

Change-Id: Id37380f72a951c9ad7cf96c0db153c05167e62ed
Reviewed-on: https://go-review.googlesource.com/9778
Reviewed-by: Minux Ma <minux@golang.org>
2015-05-07 06:59:25 +00:00
Brad Fitzpatrick
f97f876125 net: disable failing ICMP test for now
To be fixed later.

Updates #10730

Change-Id: Icac19f48c9e035dce192c97943b77b60411a3ea2
Reviewed-on: https://go-review.googlesource.com/9797
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-05-07 02:37:28 +00:00
Mikio Hara
f963cb707e net: don't run IP stack required tests on IP stack disabled kernels
This change doesn't work perfectly on IPv6-only kernels including CLAT
enabled kernels, but works enough on IPv4-only kernels.

Fixes #10721.
Updates #10729.

Change-Id: I7db0e572e252aa0a9f9f54c8e557955077b72e44
Reviewed-on: https://go-review.googlesource.com/9777
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-07 01:50:23 +00:00
Mikio Hara
76d67eaccc net: align temporary file, directory names in tests
Also adds missing temporary file deletion.

Change-Id: Ia644b0898022e05d2f5232af38f51d55e40c6fb5
Reviewed-on: https://go-review.googlesource.com/9772
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-07 01:44:12 +00:00
Brad Fitzpatrick
7165c9b30e net: always use cgo for DNS on Android
Android has (had?) its own local DNS resolver daemon, also my fault:

007e987fee

And you access that via libc, not DNS.

Fixes #10714

Change-Id: Iaff752872ce19bb5c7771ab048fd50e3f72cb73c
Reviewed-on: https://go-review.googlesource.com/9793
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-06 17:00:45 +00:00
Mikio Hara
9d0a2e4d6e net: fix inconsistent error values on Read for solaris
Updates #4856.

Change-Id: Ia04e24fb1fe57e244d7b1cd417f7f419ad610acd
Reviewed-on: https://go-review.googlesource.com/9776
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-05-06 12:43:45 +00:00
Aram Hăvărneanu
a77fcb3f8d net: fix comment in sendFile
Change-Id: Iacee13150b283f9d2867a7ca98f805900f7cbe50
Reviewed-on: https://go-review.googlesource.com/7943
Reviewed-by: Minux Ma <minux@golang.org>
2015-05-06 12:27:07 +00:00
Aram Hăvărneanu
b0e71f46b5 net: link with networking libraries when net package is in use
Fixes #10221.

Change-Id: Ib23805494d8af1946360bfea767f9727e2504dc5
Reviewed-on: https://go-review.googlesource.com/7941
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-05-06 12:26:52 +00:00
Aram Hăvărneanu
92e959a414 syscall, net: use sendfile on Solaris
Updates #5847.

Change-Id: Ic93f2e5f9a6aa3bd49cf75b16474ec5e897d17e1
Reviewed-on: https://go-review.googlesource.com/7940
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-05-06 12:26:35 +00:00
Aram Hăvărneanu
db8d5b7608 net: try to fix setKeepAlivePeriod on Solaris
Unfortunately Oracle Solaris does not have TCP_KEEPIDLE and
TCP_KEEPINTVL. TCP_KEEPIDLE is equivalent to TCP_KEEPALIVE_THRESHOLD,
but TCP_KEEPINTVL does not have a direct equivalent, so we don't set
TCP_KEEPINTVL any more.

Old Darwin versions also lack TCP_KEEPINTVL, but the code tries to set
it anyway so that it works on newer versions. We can't do that because
Oracle might assign the number illumos uses for TCP_KEEPINTVL to a
constant with a different meaning.

Unfortunately there's nothing we can do if we want to support both
illumos and Oracle Solaris with the same GOOS.

Updates #9614.

Change-Id: Id39eb5147f7afa8e951f886c0bf529d00f0e1bd4
Reviewed-on: https://go-review.googlesource.com/7690
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-05-06 12:03:20 +00:00
Aram Hăvărneanu
649c7b6dac net: add cgo support for Solaris
Change-Id: Ib66bebd418d97f38956970f93e69aa41e7c55523
Reviewed-on: https://go-review.googlesource.com/8262
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-05-06 11:37:55 +00:00
Mikio Hara
f77e10fb2e net: simplify error messages in tests
This change simplifies unnecessarily redundant error messages in tests.
There's no need to worry any more because package APIs now return
consistent, self-descriptive error values.

Alos renames ambiguous test functions and makes use of test tables.

Change-Id: I7b61027607c4ae2a3cf605d08d58cf449fa27eb2
Reviewed-on: https://go-review.googlesource.com/9662
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
2015-05-06 09:25:08 +00:00
Mikio Hara
9b184fd23c net: deflake listener tests
This change makes TestDualStack{TCP,UDP}Listener work more properly by
attempting to book an available service port before testing.

Also simplifies error messages in tests.

Fixes #5001.

Change-Id: If13b0d0039878c9bd32061a0440664e4fa7abaf7
Reviewed-on: https://go-review.googlesource.com/9661
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-06 07:46:37 +00:00
Mikio Hara
087d5c08f8 net: enable unixpacket tests on openbsd
Change-Id: I0e1519d429a295faa70013687d6faf2f5ce0be24
Reviewed-on: https://go-review.googlesource.com/9713
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-06 00:31:58 +00:00
Brad Fitzpatrick
c661cb01f7 net/http: don't send implicit Content-Length if Transfer-Encoding is set
Fixes #9987

Change-Id: Ibebd105a2bcdc1741f3b41aa78cb986f3f518b53
Reviewed-on: https://go-review.googlesource.com/9638
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-06 00:10:12 +00:00
Mikio Hara
055ecb7be5 net: fix inconsistent errors
These a series of changes fix inconsistent errors on the package net
APIs. Now almost all the APIs return OpError as a common error type
except Lookup, Resolve and Parse APIs. The Lookup, Resolve and Parse
APIs return more specific errors such as DNSError, AddrError or
ParseError.

An OpError may contain nested error information. For example, Dial may
return an OpError containing a DNSError, AddrError, unexposed type/value
or other package's type/value like the following:
	OpError{/* dial info */, Err: &DNSError{}}
	OpError{/* dial info */, Err: &AddrError{}}
	OpError{/* dial info */, Err: <unexposed type or value>}
	OpError{/* dial info */, Err: <other package's type or value>}

and Read and Write may return an OpError containing other OpError when
an application uses io.Copy or similar:
	OpError{/* for io.Reader */, Err: &OpError{/* for io.Writer */}}

When an endpoint is created for connection-oriented byte-stream
protocols, Read may return an io.EOF when the connection is closed by
remote endpoint.

Fixes #4856.

A series of changes:
- net: fix inconsistent error values on Dial, Listen partially
  https://go.googlesource.com/go/+/89b7c66d0d14462fd7893be4290bdfe5f9063ae1
- net: fix inconsistent error values on Read
  https://go.googlesource.com/go/+/ec1144423f45e010c72363fe59291d43214b6e31
- net: fix inconsistent error values on Write
  https://go.googlesource.com/go/+/11b5f98bf0d5eb8854f735cc332c912725070214
- net: fix inconsistent error values on Close
  https://go.googlesource.com/go/+/310db63c5bc121e7bfccb494c01a6b91a257e7fc
- net: fix inconsistent error values on Accept
  https://go.googlesource.com/go/+/4540e162b1aefda8157372764ad3d290a414ef1d
- net: fix inconsistent error values on File
  https://go.googlesource.com/go/+/885111365ba0a74421059bfbd18f4c57c1e70332
- net: fix inconsistent error values on setters
  https://go.googlesource.com/go/+/2173a27903897c481b0a0daf3ca3e0a0685701db
- net: fix inconsistent error values on Interface
  https://go.googlesource.com/go/+/456cf0f22c93e1a6654980f4a48a564555f6c8a2
- net: fix inconsistent error values on Lookup
  https://go.googlesource.com/go/+/0fc582e87942b2e52bed751b6c56660ba99e9a7d
- net: add Source field to OpError
  https://go.googlesource.com/go/+/afd2d2b6df3ebfe99faf347030f15adfdf422fa0

Change-Id: Id678e369088dc9fbe9073cfe7ff8a8754a57d61f
Reviewed-on: https://go-review.googlesource.com/9236
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-05 09:40:07 +00:00
Mikio Hara
2708f19600 net: add missing ReadFrom, WriteTo deadline tests
Change-Id: If84edfaec361ca2fbb75707c4ad30e4ce64f7013
Reviewed-on: https://go-review.googlesource.com/9664
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-05 08:54:28 +00:00
Brad Fitzpatrick
c723230e4a net/http: fix scheduling race resulting in flaky test
The test was measuring something, assuming other goroutines had
already scheduled.

Fixes #10427

Change-Id: I2a4d3906f9d4b5ea44b57d972e303bbe2b0b1cde
Reviewed-on: https://go-review.googlesource.com/9561
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-01 21:41:03 +00:00
Brad Fitzpatrick
125ed11c0a net/http: document ServeFile and FileServer index.html redirect behavior
Fixes #9876

Change-Id: I97a354fde827dfccc9e373fadea2e37d094439b0
Reviewed-on: https://go-review.googlesource.com/9538
Reviewed-by: Rob Pike <r@golang.org>
2015-04-30 20:42:58 +00:00
Alex A Skinner
f390135733 net: make go DNS use localhost if resolv.conf is missing or empty
Per resolv.conf man page, "If this file does not exist, only the name
server on the local machine will be queried."

This behavior also occurs if file is present but unreadable,
or if no nameservers are listed.

Fixes #10566

Change-Id: Id5716da0eae534d5ebfafea111bbc657f302e307
Reviewed-on: https://go-review.googlesource.com/9380
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-30 18:19:00 +00:00
Brad Fitzpatrick
ae080c1aec net/http: handle "close" amongst multiple Connection tokens
Fixes #8840

Change-Id: I194d0248734c15336f91a6bcf57ffcc9c0a3a435
Reviewed-on: https://go-review.googlesource.com/9434
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-29 23:52:43 +00:00
Mikio Hara
98e0556231 net: deflake timeout, deadline tests
This change deflakes timeout, deadline tests, especially fixes socket
and goroutine leaks. Also adds a few missing tests that use features
introduced after go1 release.

Change-Id: Ibf73a4859f8d4a0ee494ca2fd180cbce72a7a2c7
Reviewed-on: https://go-review.googlesource.com/9464
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-29 23:37:21 +00:00
Mikio Hara
2385f692e8 net: consolidate listener test files
This change merges unicast_posix_test.go and multicast_test.go into
listen_test.go before deflaking tests for Listen functions.

No code changes.

Change-Id: Ic4cd6531b95dfb5b6e6e254241692eca61a71e94
Reviewed-on: https://go-review.googlesource.com/9460
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-29 23:04:39 +00:00
Mikio Hara
4f38ef811f net: add missing Close tests
This change adds missing CloseRead test and Close tests on Conn,
Listener and PacketConn with various networks.

Change-Id: Iadf99eaf526a323f853d203edc7c8d0577f67972
Reviewed-on: https://go-review.googlesource.com/9469
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-29 23:01:45 +00:00
Peter Waldschmidt
632778c3a3 net/http: Don't set Content-Length: -1 when responding to a POST
Fixes an issue where Response.Write writes out a Content-Length: -1
header when the corresponding Request is a POST or PUT and the
ContentLength was not previously set.

This was encountered when using httputil.DumpResponse
to write out the response from a server that responded to a PUT
request with no Content-Length header. The dumped output is
thus invalid.

Change-Id: I52c6ae8ef3443f1f9de92aeee9f9581dabb05991
Reviewed-on: https://go-review.googlesource.com/9496
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-29 22:58:37 +00:00
Mikio Hara
afd2d2b6df net: add Source field to OpError
Not only by network, transport-layer intermediaries but by
virtualization stuff in a node, it is hard to identify the root cause of
weird faults without information of packet flows after disaster
happened.

This change adds Source field to OpError to be able to represent a
5-tuple of internet transport protocols for helping dealing with
complicated systems.

Also clarifies the usage of Source and Addr fields.

Updates #4856.

Change-Id: I96a523fe391ed14406bfb21604c461d4aac2fa19
Reviewed-on: https://go-review.googlesource.com/9231
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-29 22:37:30 +00:00
tnt
bfb077e0ee net: allow a dns TXT record to contain more than one <character-string>
RFC 1035 3.3.14 allows a TXT record to contain one or more <character-string>s.
The current implementation returns a "no such host" error if there is more
than one <character-string> in the TXT record.

Fixes #10482

Change-Id: I0ded258005e6b7ba45f687fecd10afa2b321bb77
Reviewed-on: https://go-review.googlesource.com/8966
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2015-04-29 21:48:48 +00:00
Mikio Hara
a0cff2989a net: remove dead code in Write
Also, please be informed that the Write method on both connected and
unconnected-mode sockets may return a positive number of bytes written
with timeout or use of closed network connection error.

Change-Id: I2e2e6192e29cef4e9389eb0422c605c6d12e6a3c
Reviewed-on: https://go-review.googlesource.com/9466
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-29 04:40:59 +00:00
Mikio Hara
edac5d9144 net: rename dialgoogle_test.go to external_test.go
In the followup changes, tests that require external facilities such as
DNS servers and RRs will move into external_test.go.

Change-Id: Ib460b0c51961159830357652dbf5430e1ba01514
Reviewed-on: https://go-review.googlesource.com/9461
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-04-29 02:24:27 +00:00
Brad Fitzpatrick
339cf9807d net/http: documentation updates
Fixes #10366 (how to set custom headers)
Fixes #9836 (PATCH in PostForm)
Fixes #9276 (generating a server-side Request for testing)
Update #8991 (clarify Response.Write for now; export ReverseProxy's copy later?)

Change-Id: I95a11bf3bb3eeeeb72775b6ebfbc761641addc35
Reviewed-on: https://go-review.googlesource.com/9410
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-28 21:58:58 +00:00
Brad Fitzpatrick
5ed44e9d4d net/http: test and document suppressing implicit Content-Type response header
No code changes.

Fixes #8992

Change-Id: I10c8340a4f8e3e7add9b3ac5aa0a1e8d8aa49f40
Reviewed-on: https://go-review.googlesource.com/9412
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-28 20:49:08 +00:00
Mikio Hara
9bef5cfb9b net: don't miss testing server teardowns when test fails early
Change-Id: I9fa678e43b4ae3970323cac474b5f86d4d933997
Reviewed-on: https://go-review.googlesource.com/9382
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-28 00:01:33 +00:00
Brad Fitzpatrick
4a0ba7aa17 net: use Go's DNS resolver when system configuration permits
If the machine's network configuration files (resolv.conf,
nsswitch.conf) don't have any unsupported options, prefer Go's DNS
resolver, which doesn't have the cgo & thread over.

It means users can have more than 500 DNS requests outstanding (our
current limit for cgo lookups) and not have one blocked thread per
outstanding request.

Discussed in thread https://groups.google.com/d/msg/golang-dev/2ZUi792oztM/Q0rg_DkF5HMJ

Change-Id: I3f685d70aff6b47bec30b63e9fba674b20507f95
Reviewed-on: https://go-review.googlesource.com/8945
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-23 02:48:43 +00:00
Daniel Morsing
723f86537c net/http: fix race between dialing and canceling
In the brief window between getConn and persistConn.roundTrip,
a cancel could end up going missing.

Fix by making it possible to inspect if a cancel function was cleared
and checking if we were canceled before entering roundTrip.

Fixes #10511

Change-Id: If6513e63fbc2edb703e36d6356ccc95a1dc33144
Reviewed-on: https://go-review.googlesource.com/9181
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-22 12:23:55 +00:00
Brad Fitzpatrick
5fa2d9915f net/http: make ServeContent errors return more specific HTTP status codes
Previously all errors were 404 errors, even if the real error had
nothing to do with a file being non-existent.

Fixes #10283

Change-Id: I5b08b471a9064c347510cfcf8557373704eef7c0
Reviewed-on: https://go-review.googlesource.com/9200
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
2015-04-22 10:35:44 +00:00
Brad Fitzpatrick
58c1c011a6 net/http: fix rare Transport readLoop goroutine leak
There used to be a small window where if a server declared it would do
a keep-alive connection but then actually closed the connection before
the roundTrip goroutine scheduled after being sent a response from the
readLoop goroutine, then the readLoop goroutine would loop around and
block forever reading from a channel because the numExpectedResponses
accounting was done too late.

Fixes #10457

Change-Id: Icbae937ffe83c792c295b7f4fb929c6a24a4f759
Reviewed-on: https://go-review.googlesource.com/9169
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-22 10:29:22 +00:00
Mikio Hara
15648d2e77 net: replace server tests
This change replaces server tests with new ones that require features
introduced after go1 release, such as runtime-integrated network poller,
Dialer, etc.

Change-Id: Icf1f94f08f33caacd499cfccbe74cda8d05eed30
Reviewed-on: https://go-review.googlesource.com/9195
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-22 00:29:40 +00:00
Mikio Hara
03eb132684 net: deflake zero byte IO tests on datagram
This change deflakes zero byte read/write tests on datagram sockets, and
enables them by default.

Change-Id: I52f1a76f8ff379d90f40a07bb352fae9343ea41a
Reviewed-on: https://go-review.googlesource.com/9194
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-22 00:13:37 +00:00
Mikio Hara
275755401d net: fix WriteTo on Plan 9
This change excludes internal UDP header size from a result of number of
bytes written on WriteTo.

Change-Id: I847d57f7f195657b6f14efdf1b4cfab13d4490dd
Reviewed-on: https://go-review.googlesource.com/9196
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
2015-04-22 00:11:30 +00:00
Mikio Hara
0f6a3ba420 net: fix possible nil pointer dereference on ReadFrom for windows
Fixes #10516.

Change-Id: Ia93f53d4e752bbcca6112bc75f6c3dbe30b90dac
Reviewed-on: https://go-review.googlesource.com/9192
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-21 06:34:44 +00:00
Mikio Hara
0fc582e879 net: fix inconsistent error values on Lookup
This change fixes inconsistent error values on
Lookup{Addr,CNAME,Host,IP.MX,NS,Port,SRV,TXT}.

Updates #4856.

Change-Id: I059bc8ffb96ee74dff8a8c4e8e6ae3e4a462a7ef
Reviewed-on: https://go-review.googlesource.com/9108
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-21 05:16:07 +00:00
Mikio Hara
456cf0f22c net: fix inconsistent error values on Interface
This change fixes inconsistent error values on Interfaces,
InterfaceAddrs, InterfaceBy{Index,Name}, and Addrs and MulticastAddrs
methods of Interface.

Updates #4856.

Change-Id: I09e65522a22f45c641792d774ebf7a0081b874ad
Reviewed-on: https://go-review.googlesource.com/9140
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-21 04:16:14 +00:00
Mikio Hara
2173a27903 net: fix inconsistent error values on setters
This change fixes inconsistent error values on
Set{Deadline,ReadDeadline,WriteDeadline,ReadBuffer,WriteBuffer} for
Conn, Listener and PacketConn, and
Set{KeepAlive,KeepAlivePeriod,Linger,NoDelay} for TCPConn.

Updates #4856.

Change-Id: I34ca5e98f6de72863f85b2527478b20d8d5394dd
Reviewed-on: https://go-review.googlesource.com/9109
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-21 04:05:59 +00:00
Mikio Hara
885111365b net: fix inconsistent error values on File
This change fixes inconsistent error values on
File{Conn,Listener,PacketConn} and File method of Conn, Listener.

Updates #4856.

Change-Id: I3197b9277bef0e034427e3a44fa77523acaa2520
Reviewed-on: https://go-review.googlesource.com/9101
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-21 03:37:41 +00:00
Mikio Hara
832c573595 net: add helpers for server testing
Also moves a few server test helpers into mockserver_test.go.

Change-Id: I5a95c9bc6f0c4683751bcca77e26a8586a377466
Reviewed-on: https://go-review.googlesource.com/9106
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-21 01:00:11 +00:00
Brad Fitzpatrick
b016eba489 net/http: fix Transport data race, double cancel panic, cancel error message
Fixes #9496
Fixes #9946
Fixes #10474
Fixes #10405

Change-Id: I4e65f1706e46499811d9ebf4ad6d83a5dfb2ddaa
Reviewed-on: https://go-review.googlesource.com/8550
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-20 20:34:43 +00:00
Mikio Hara
757f21fd6f net: fix a nit found by vet
Change-Id: Ic965b48bdc0e0ffba9bed5ff6b3d28ff742f8b2d
Reviewed-on: https://go-review.googlesource.com/9100
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-19 10:45:49 +00:00
Mikio Hara
4540e162b1 net: fix inconsistent error values on Accept
This change fixes inconsistent error values on Accept{,TCP,Unix}.

Updates #4856.

Change-Id: Ie3bb534c19a724cacb3ea3f3656e46c810b2123f
Reviewed-on: https://go-review.googlesource.com/8996
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-18 03:38:50 +00:00
Mikio Hara
310db63c5b net: fix inconsistent error values on Close
This change fixes inconsistent error values on Close, CloseRead and
CloseWrite.

Updates #4856.

Change-Id: I3c4d46ccd7d6e1a2f52d8e75b512f62c533a368d
Reviewed-on: https://go-review.googlesource.com/8994
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-18 03:12:04 +00:00
Mikio Hara
11b5f98bf0 net: fix inconsistent error values on Write
This change fixes inconsistent error values on Write,
WriteTo{,UDP,IP,Unix} and WriteMsg{UDP,IP,Unix}.

Updates #4856.

Change-Id: I4208ab6a0650455ad7d70a80a2d6169351d6055f
Reviewed-on: https://go-review.googlesource.com/8993
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-18 02:44:08 +00:00
Mikio Hara
ec1144423f net: fix inconsistent error values on Read
This change fixes inconsistent error values on Read,
ReadFrom{,UDP,IP,Unix} and ReadMsg{UDP,IP,Unix}.

Updates #4856.

Change-Id: I7de5663094e09be2d78cdb18ce6f1e7ec260888d
Reviewed-on: https://go-review.googlesource.com/8992
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-18 02:19:46 +00:00
Mikio Hara
d0f3100b47 net: break up TestErrorNil into Test{Dial,Listen,ListenPacket}Error
Change-Id: I7c6c91a0551aacb49e1beb4a39215b93c8c7fcfa
Reviewed-on: https://go-review.googlesource.com/8997
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-18 01:43:35 +00:00
Mikio Hara
6d3a7e79a4 net: clean up cgo
This change adds a type addrinfoErrno to represent getaddrinfo,
getnameinfo-specific errors, and uses it in cgo-based lookup functions.

Also retags cgo files for clarification and does minor cleanup.

Change-Id: I6db7130ad7bf35bbd4e8839a97759e1364c43828
Reviewed-on: https://go-review.googlesource.com/9020
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-17 23:19:19 +00:00
Mikio Hara
89b7c66d0d net: fix inconsistent error values on Dial, Listen partially
This change makes TestDialError, TestListenError work without any
external dependency, enables them by default, and removes unnecessary
-run_error_test flag for fixing #4856.

Also fixes inconsistent error values on Dial, Listen partially as a
first stab.

Updates #4856.

Change-Id: Ie10c151ae06759085f352c7db2ca45107a81914f
Reviewed-on: https://go-review.googlesource.com/8903
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-17 00:42:57 +00:00
Mikio Hara
3185cfbfbb net: rename netFD.proto to netFD.net on Plan 9
In followup changes, we'll move OpError around from the netFD layer to
the Conn layer for fixing #4856. Before doing that, this change makes
netFD of Plan 9 match netFD for POSIX platforms to avoid conflict.

Change-Id: Iea7632716d48722a1758e52effefec964a3a9442
Reviewed-on: https://go-review.googlesource.com/8990
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-17 00:09:13 +00:00
David du Colombier
3eadc59b0d net: fix typo in comment
Change-Id: I8b2063e65d3454a694a789c1682dacfe0bea2e19
Reviewed-on: https://go-review.googlesource.com/8965
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-16 18:45:05 +00:00
Mikio Hara
57bc7a0434 net: fix TestDialGoogle with -ipv6 when CGO_ENABLED=0
Under some dial tests that require external network connectivity, we
must prevent application traffic but must not interfere with control
plane traffic such as DNS message exchange. But test helper function
disableSocketConnect prevents both application and control plane traffic
unconditionally and makes some dial tests with -ipv6 fail when
CGO_ENABLED=0.

This change makes disableSocketConnect take a look at not only address
family but socket type for fixing some dial tests with -ipv6 when
CGO_ENBALED=0.

Change-Id: I32241d9592d31483424bb5e69cb4d56f3fc20312
Reviewed-on: https://go-review.googlesource.com/8743
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-16 00:44:52 +00:00
Mikio Hara
47515e0116 net: add Listen system call hook for testing
Change-Id: I63053c45081f47ba736720a78d85c31c13767891
Reviewed-on: https://go-review.googlesource.com/8642
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-15 11:47:49 +00:00
Mikio Hara
130e3f9a32 net/internal/socktest: add hook for Listen, failed system call counters
Change-Id: Icaac9a48a3b9a3c5542235162e21ab8303592965
Reviewed-on: https://go-review.googlesource.com/8641
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-15 11:03:50 +00:00
Brad Fitzpatrick
47f095501e net: remove old comment
The memory model has been clarified since. This is legal and doesn't
need justification.

Change-Id: I60f9938503f86f52bb568ca1a99ac721ee72cee5
Reviewed-on: https://go-review.googlesource.com/8913
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-04-14 04:38:20 +00:00
Ian Lance Taylor
63cced7b31 net: document that DNSError.Timeout and Temporary are unreliable
Update #10417.

Change-Id: Ibfbdd05358f696a37217eef160f71b14a468ff86
Reviewed-on: https://go-review.googlesource.com/8788
Reviewed-by: Rob Pike <r@golang.org>
2015-04-13 20:41:50 +00:00
David Crawshaw
c0d48836ec net/http/cgi: skip fork test on darwin/arm64
Just like darwin/arm.

Change-Id: Ib9a32bb0aed5f08b27de11a93aaf273cacdf5779
Reviewed-on: https://go-review.googlesource.com/8819
Reviewed-by: Minux Ma <minux@golang.org>
2015-04-13 11:51:53 +00:00
Brad Fitzpatrick
dc2d64bf81 cmd/go: cache results of HTTP requests done during meta tag discovery
Previously, running

  $ go get -u -v golang.org/x/tools/cmd/godoc

would results in dozens of HTTP requests for

  https://golang.org/x/tools?go-get=1

once per package under x/tools.

Now it caches the results. We still end up doing one HTTP request for
all the packages under x/tools, but this reduces the total number of
HTTP requests in ~half.

This also moves the singleflight package back into an internal
package. singleflight was originally elsewhere as a package, then got
copied into "net" (without its tests). But now that we have internal,
put it in its own package, and restore its test.

Fixes #9249

Change-Id: Ieb5cf04fc4d0a0c188cb957efdc7ea3068c34e3f
Reviewed-on: https://go-review.googlesource.com/8727
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-13 07:08:00 +00:00
Paul Marks
a5dec3859a net: make multi-IP resolution more flexible.
Remove the "netaddr" type, which ambiguously represented either one
address, or a list of addresses. Instead, use "addrList" wherever
multiple addresses are supported.

The "first" method returns the first address matching some condition
(e.g. "is it IPv4?"), primarily to support legacy code that can't handle
multiple addresses.

The "partition" method splits an addrList into two categories, as
defined by some strategy function. This is useful for implementing
Happy Eyeballs, and similar two-channel algorithms.

Finally, internetAddrList (formerly resolveInternetAddr) no longer
mangles the ordering defined by getaddrinfo. In the future, this may
be used by a sequential Dial implementation.

Updates #8453, #8455.

Change-Id: I7375f4c34481580ab40e31d33002a4073a0474f3
Reviewed-on: https://go-review.googlesource.com/8360
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-10 09:03:25 +00:00
Daniel Morsing
39377013cb net/http: handle close/response race more gracefully
There was a logical race in Transport.RoundTrip where a roundtrip with
a pending response would race with the channel for the connection
closing. This usually happened for responses with connection: close
and no body.

We handled this race by reading the close channel, setting a timer
for 100ms and if no response was returned before then, we would then
return an error.

This put a lower bound on how fast a connection could fail. We couldn't
fail a request faster than 100ms.

Reordering the channel operations gets rid of the logical race. If
the readLoop causes the connection to be closed, it would have put
its response into the return channel already and we can fetch it with
a non-blocking receive.

Change-Id: Idf09e48d7a0453d7de0120d3055d0ce5893a5428
Reviewed-on: https://go-review.googlesource.com/1787
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-09 13:46:50 +00:00
Mikio Hara
957255f5ab net/http: don't send IPv6 zone identifier in outbound request, per RFC 6874
When making a request to an IPv6 address with a zone identifier, for
exmaple [fe80::1%en0], RFC 6874 says HTTP clients must remove the zone
identifier "%en0" before writing the request for security reason.

This change removes any IPv6 zone identifer attached to URI in the Host
header field in requests.

Fixes #9544.

Change-Id: I7406bd0aa961d260d96f1f887c2e45854e921452
Reviewed-on: https://go-review.googlesource.com/3111
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-09 09:26:52 +00:00
Rob Pike
514eb4aa54 net/rpc: document that the type must be exported, not just the methods
Fixes #10379.

Change-Id: Ia4cdda36ed57a06371f9ace7365ce9e215228487
Reviewed-on: https://go-review.googlesource.com/8654
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 18:34:35 +00:00
Mikio Hara
8e95654ac8 net/url: allow Parse, ParseRequestURI to parse ipv6 zone identifiers in URIs
Using IPv6 link-local addresses to make connections between on-link
nodes is useful for small distributed applications but it requires zone
identifiers to distinguish a correct IP link. It's the same for
transports using URI for destination discovery such as HTTP, WebSocket.

This change allows Parse, ParseRequestURI functions and String method of
URL to parse/return a literal IPv6 address followed by a zone identifier
within a URI as described in RFC 6874.

Fixes #6530.

Change-Id: I2936ea65c1446994770cf2ee2c28a1c73faaa0ca
Reviewed-on: https://go-review.googlesource.com/2431
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-07 14:24:23 +00:00
Mikio Hara
5a83f06c21 net: deflake dual IP stack tests
This change deflakes TestDialerDualStackFDLeak, TestDialerDualStack,
TestResolve{TCP,UDP,IP}Addr by removing external dependencies.

Fixes #8764.

Change-Id: I5cca0a93776cf05652e0e6a4a4ff4af392ccb885
Reviewed-on: https://go-review.googlesource.com/8485
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-07 13:32:28 +00:00
Mikio Hara
f077505d9a net: fix tester goroutine leakage in tests
This change tries to stop various tester goroutines at the end of each
scope for avoiding interference between test cases including benchmarks.
Not yet finished completely but enough to land upcoming changes to Dial
functions. The rest will be fixed later.

Change-Id: Ic38b8681a3a2ddbcd69ba3696f24a61d418a0346
Reviewed-on: https://go-review.googlesource.com/8398
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-07 03:26:03 +00:00
Mikio Hara
be4c38ed34 net: move testHookSetKeepAlive into hook.go
Change-Id: I1f2d4e3b0351a7a47c3a6073833a17dbc0c7b05c
Reviewed-on: https://go-review.googlesource.com/8520
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-07 03:02:10 +00:00
Mikio Hara
35b3db253c net: add lookup IP hook for testing
This change adds testHookLookIP to enable to inject DNS name to IP
address mappings for Happ{y,yish,ier} Eyeballs dial testing.

Change-Id: I8ac04a594e1e2bd77909528df0552889914a7790
Reviewed-on: https://go-review.googlesource.com/8399
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-07 02:34:42 +00:00
Igor Dolzhikov
debe12cfcf net/http, math/big, cmd/internal/gc/big: replaced errors.New(fmt.Sprintf(...)) in favour fmt.Errorf()
Change-Id: I38fc0ab84a374cb9be0234e40665d7cea0e76fc1
Reviewed-on: https://go-review.googlesource.com/8402
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-06 15:40:34 +00:00
Paul Marks
c50a8416c8 net: dialChannel should not treat an expired deadline as noDeadline.
Now, only a zero deadline is interpreted as noDeadline.  Any other time
in the past yields an immediate timeout.

TestConnectDeadlineInThePast already covers this case.  We just need to
un-skip it for plan9, where dialChannel is used.

Change-Id: I995fd1a632c31f8004dac772c3d7c43a2a5853b0
Reviewed-on: https://go-review.googlesource.com/8435
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-04-06 01:03:31 +00:00
Mikio Hara
21ed40c8cb net: deflake TestDialGoogle, TestResolveDialGoogle
This change makes use of the socktest package instead of the non-thread
safe variable syscall.SocketDisableIPv6 for simulating unreachable
external networks.

Also adds -ipv4 flag, -ipv6 flag already exists, as a control knob for
testing on each of IPv4-only, IPv6-only and dual IP stack kernels.

Fixes #7687.

Change-Id: I82002007fd526e8cf4de207f935e721df049a22f
Reviewed-on: https://go-review.googlesource.com/8390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-03 01:50:30 +00:00
Mikio Hara
167562f652 net: deflake TestDialTimeoutFDLeak
This change makes TestDialTimeoutFDLeak work on almost all the supported
platforms.

Updates #4384.

Change-Id: I3608f438003003f9b7cfa17c9e5fe7077700fd60
Reviewed-on: https://go-review.googlesource.com/8392
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-03 00:48:47 +00:00
Mikio Hara
3a9024b498 net: move init function into net.go
It's a single, package-wide init function specified for the net package.

Change-Id: Id5894d65e1a92297cc16803cc5e4d4eef0b4b099
Reviewed-on: https://go-review.googlesource.com/8391
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-03 00:23:23 +00:00
Mikio Hara
52c84c34fd net: move test flags into main_test.go
Also updates the comments on test flags.

Change-Id: I8dbd90270e08728ab309ab88a3030e0f8e547175
Reviewed-on: https://go-review.googlesource.com/8394
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-02 09:07:24 +00:00
Mikio Hara
8b0e38ffb4 net: deflake TestDialTimeout
This change makes TestDialTimeout work on almost all the supported
platforms.

Updates #3016.
Updates #3307.
Updates #3867.
Updates #5380.
Updates #5349.

Change-Id: Iacf0ebea23cdd8f6c0333d70c667a5a5f5eb0ed2
Reviewed-on: https://go-review.googlesource.com/8220
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-02 01:04:49 +00:00
Mikio Hara
93553dd216 net: fix data race in benchmarks
Fixes #10307.

Change-Id: If70f36a6f1c4e465a47a0bc4d38b318424111106
Reviewed-on: https://go-review.googlesource.com/8330
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-01 22:02:41 +00:00
Mikio Hara
29d1f3b85c net: add socket system call hooks for testing
This change adds socket system call hooks to existing test cases for
simulating a bit complicated network conditions to help making timeout
and dual IP stack test cases work more properly in followup changes.

Also test cases print debugging information in non-short mode like the
following:

Leaked goroutines:
net.TestWriteTimeout.func2(0xc20802a5a0, 0xc20801d000, 0x1000, 0x1000, 0xc2081d2ae0)
	/go/src/net/timeout_test.go:170 +0x98
created by net.TestWriteTimeout
	/go/src/net/timeout_test.go:173 +0x745
net.runDatagramPacketConnServer(0xc2080730e0, 0x2bd270, 0x3, 0x2c1770, 0xb, 0xc2081d2ba0, 0xc2081d2c00)
	/go/src/net/server_test.go:398 +0x667
created by net.TestTimeoutUDP
	/go/src/net/timeout_test.go:247 +0xc9
	(snip)

Leaked sockets:
3: {Cookie:615726511685632 Err:<nil> SocketErr:0}
5: {Cookie:7934075906097152 Err:<nil> SocketErr:0}

Socket statistical information:
{Family:1 Type:805306370 Protocol:0 Opened:17 Accepted:0 Connected:5 Closed:17}
{Family:2 Type:805306369 Protocol:0 Opened:450 Accepted:234 Connected:279 Closed:636}
{Family:1 Type:805306369 Protocol:0 Opened:11 Accepted:5 Connected:5 Closed:16}
{Family:28 Type:805306369 Protocol:0 Opened:95 Accepted:22 Connected:16 Closed:116}
{Family:2 Type:805306370 Protocol:0 Opened:84 Accepted:0 Connected:34 Closed:83}
{Family:28 Type:805306370 Protocol:0 Opened:52 Accepted:0 Connected:4 Closed:52}

Change-Id: I0e84be59a0699bc31245c78e2249423459b8cdda
Reviewed-on: https://go-review.googlesource.com/6390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-31 23:07:42 +00:00
Mikio Hara
7b2b45e544 net: simplify test helpers
This change consolidates test helpers that test platform capabilities.
testNetwork, testAddress and testListenArgs report whether given
ariguments are testable on the current platform configuration to
mitigate to receive weird test results.

Change-Id: Ie1ed568a1f9cc50f3155945ea01562904bc2c389
Reviewed-on: https://go-review.googlesource.com/8076
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-28 08:21:10 +00:00
Brad Fitzpatrick
8047093e5b net: reenable a previously skipped test
Update #8859

Change-Id: I5b0005b308e83954a495f06d27b7d8d30e813820
Reviewed-on: https://go-review.googlesource.com/8193
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-27 16:15:56 +00:00
Mikio Hara
4d54f27b35 net/internal/socktest: new package
Package socktest provides utilities for socket testing.

This package allows test cases in the net package to simulate
complicated network conditions such as that a destination address is
resolvable/discoverable but is not routable/reachable at network layer.
Those conditions are required for testing functionality of timeout,
multiple address families.

Change-Id: Idbe32bcc3319b41b0cecac3d058014a93e13288b
Reviewed-on: https://go-review.googlesource.com/6090
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-25 00:13:46 +00:00
Shenghou Ma
1c26176b67 net/url: fix docs for URL.String
Fixes #10227.

Change-Id: I64d5522e76da5a717e3c4169405e5ef35d6c262e
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7974
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-24 23:56:43 +00:00
David Crawshaw
5bf9249eda net/http: enable segfaulting test on darwin/arm
Issue #10043 was resolved by https://golang.org/cl/7072.
This test now passes.

Change-Id: I7bdef63d9ee4edcede23613a14a2ddce14018f34
Reviewed-on: https://go-review.googlesource.com/7931
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-23 14:27:17 +00:00
Mikio Hara
14082fad9b net: fix TestInterfaces, TestInterfaceAddrs on platforms without loopback interface
Fixes #10214.

Change-Id: If29d26c590eb53d4976e0a6ace0ed33aaf0c3e80
Reviewed-on: https://go-review.googlesource.com/7924
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-03-23 10:00:34 +00:00
Brad Fitzpatrick
a0fb8f8cce net/http: ignore the Unix epoch time in ServeContent
ServeContent ignored zero time.Time{} values when generating
Last-Modified response headers and checking If-Modified-Since request
headers. Do the same for a time.Time representing the Unix epoch zero
value, as this is a common bogus value. Callers who really want to
send that value (incredibly unlikely) can add a nanosecond to it and
it will be truncated to second granularity anyway.

Fixes #9842

Change-Id: I69f697bfc4017404a92a34e3fe57e2711c1e299d
Reviewed-on: https://go-review.googlesource.com/7915
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-03-23 02:16:56 +00:00
Quoc-Viet Nguyen
7274b1f6c9 net/http/pprof: Correct body tag in index template
The body tag in the pprof template was misplaced.

Change-Id: Icd7948b358f52df1acc7e033ab27a062990ef977
Reviewed-on: https://go-review.googlesource.com/7795
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-19 22:45:34 +00:00
Josh Bleecher Snyder
2adc4e8927 all: use "reports whether" in place of "returns true if(f)"
Comment changes only.

Change-Id: I56848814564c4aa0988b451df18bebdfc88d6d94
Reviewed-on: https://go-review.googlesource.com/7721
Reviewed-by: Rob Pike <r@golang.org>
2015-03-18 15:14:06 +00:00
Matt Joiner
4f489f59c2 net/http/pprof: Use relative links to profiles in index html
This allows /debug/pprof/ and descendents to be used through
http.StripPrefix and other path rewriting handlers.

Change-Id: I53673876c107bbfaf430123ead78e6524b42ac21
Reviewed-on: https://go-review.googlesource.com/7351
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-12 01:13:26 +00:00
David Crawshaw
ac080fa6d8 net: skip unixgram tests on darwin/arm
Change-Id: I9d2c84237f7b1c4dc2e53adf249b7518dda81a21
Reviewed-on: https://go-review.googlesource.com/7165
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-09 15:34:32 +00:00
Mikio Hara
bcf43e9565 net: gofmt
Change-Id: Ifcf7b96e67b63a08f410a7ba21e8bf4dd20e7d8e
Reviewed-on: https://go-review.googlesource.com/7122
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-08 22:03:21 +00:00
Andrew Pilloud
f00362b9ec net: LookupHost and Resolve{TCP,UDP,IP}Addr should use zone from getaddrinfo
The unix and windows getaddrinfo calls return a zone with IPv6
addresses. IPv6 link-local addresses returned are only valid on the
given zone. When the zone is dropped, connections to the address
will fail. This patch replaces IP with IPAddr in several internal
resolver functions, and plumbs through the zone.

Change-Id: Ifea891654f586f15b76988464f82e04a42ccff6d
Reviewed-on: https://go-review.googlesource.com/5851
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-03-08 09:58:11 +00:00
David Crawshaw
5e49bfec92 net: fix darwin/amd64 build
Accidental semantics change in 4c6364a87d.

Change-Id: I0bbfc441662d79af4dbac6f9fc4e3a485adfb924
Reviewed-on: https://go-review.googlesource.com/6831
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-04 22:56:23 +00:00
Shenghou Ma
4c6364a87d net: skip unsupported tests (unix and unixgram) on darwin/arm
Change-Id: Id1927180ecd18b849727225adea05465d36b3973
Reviewed-on: https://go-review.googlesource.com/6210
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-04 22:12:05 +00:00
David Crawshaw
4f6630de3a net/http: disable segfaulting test on darwin/arm
Issue #10043

Change-Id: I6ce7f303cd96ac575f7a673dd4a459339382d22e
Reviewed-on: https://go-review.googlesource.com/6692
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-03 23:09:06 +00:00
Mikio Hara
59cc5a197f syscall: fix parsing ipv6 address prefix on dragonfly
This change fixes a missing case that a routing address contains an
invalid address family label but it holds a valid length of address
structure.

Also makes test robust.

Fixes #10041.

Change-Id: I2480ba273929e859896697382d1a75b01a116b98
Reviewed-on: https://go-review.googlesource.com/6391
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-03 03:27:14 +00:00
Dmitry Vyukov
04a3a74456 net/http/fcgi: fix test
Currently the test fails if run more than once:

$ go test -v -run=TestChildServeCleansUp -cpu=1,1 net/http/fcgi
=== RUN TestChildServeCleansUp
--- PASS: TestChildServeCleansUp (0.00s)
=== RUN TestChildServeCleansUp
fatal error: all goroutines are asleep - deadlock!

The problem is that the writer mutates test input data,
so it is wrong on the second execution.

Change-Id: I4ca54dd2926c6986b2908023ac65e5e65630ed26
Reviewed-on: https://go-review.googlesource.com/6383
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-02 06:59:29 +00:00
Brad Fitzpatrick
aedee30870 net: deflake TestPacketConn, increase timeout
Tests sometimes failed with:

ok   mime/internal/quotedprintable      0.606s
ok   mime/multipart                     0.819s
--- FAIL: TestPacketConn (0.10s)
    packetconn_test.go:96: PacketConn.ReadFrom failed: WSARecvFrom udp 127.0.0.1:64156: i/o timeout
FAIL
FAIL    net     3.602s
ok      net/http        4.618s
ok      net/http/cgi    0.576s

Theory: 100 ms is too short. Small timer granularity on Wnidows, or an
allocation in the middle causing a GC sometimes?

In any case, increase it to 500 ms.

Change-Id: I48cc4d600eb168db9f85c0fd05335dd630254c3c
Reviewed-on: https://go-review.googlesource.com/4922
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-03-01 22:55:34 +00:00
Brad Fitzpatrick
cf14e0e333 net: disable TestTCPReadWriteAllocs on dragonfly
Update #8859
Update #10042

Change-Id: Idc7eadb447b73563ce9085e50c2042652442c2d9
Reviewed-on: https://go-review.googlesource.com/6412
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-01 22:32:22 +00:00
Russ Cox
4734464a14 net: disable failing interface tests on dragonfly
(Issue #10041.)

Change-Id: Ia894ab60ac6b09926c684f99aacca79275cbced4
Reviewed-on: https://go-review.googlesource.com/6365
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-01 00:19:32 +00:00
Josh Bleecher Snyder
b1c0d8a54b net: disable TestTCPReadWriteAllocs on darwin
Having this test fail, as it does reliably for me,
makes working frustrating. Disable it for now,
until we can diagnose the issue.

Update issue #8859.

Change-Id: I9dda30d60793e7a51f48f445c78ccb158068cc25
Reviewed-on: https://go-review.googlesource.com/6381
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-28 20:43:55 +00:00
David Crawshaw
be7090498b net/http/cgi: skip exec test on darwin/arm
Change-Id: I2fc3cf94b465bf9d7ff8d7bf935b45e334b401e3
Reviewed-on: https://go-review.googlesource.com/6180
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-26 22:46:39 +00:00
Mikio Hara
3dd029aa7e net: enable TestTCPReadWriteAllocs in short mode
The change 2096 removed unwanted allocations and a few noises in test
using AllocsPerRun. Now it's safe to enable this canary test on netpoll
hotpaths.

Change-Id: Icdbee813d81c1410a48ea9960d46447042976905
Reviewed-on: https://go-review.googlesource.com/5713
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-02-24 08:26:56 +00:00
Alexandre Cesaro
828129fdbc net/mail: move RFC 2047 code to internal/mime
The code concerning quoted-printable encoding (RFC 2045) and its
variant for MIME headers (RFC 2047) is currently spread in
mime/multipart and net/mail. It is also not exported.

This commit is the second step to fix that issue. It moves the
RFC 2047 encoding and decoding functions from net/mail to
internal/mime. The exported API is unchanged.

Updates #4943

Change-Id: I5f58aa58e74bbe4ec91b2e9b8c81921338053b00
Reviewed-on: https://go-review.googlesource.com/2101
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-23 17:46:37 +00:00
Aaron Jacobs
d5630142fd net/http: Removed some unused constants in request.go.
Change-Id: I05cdf357249166a45105703e9317793aa2088844
Reviewed-on: https://go-review.googlesource.com/5560
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-22 23:52:44 +00:00
Mikio Hara
69275eef5e net, syscall: more accurate parsers for routing messages on BSD variants
This changes fixes two issues with regard to handling routing messages
as follows:
- Misparsing on platforms (such as FreeBSD) supporting multiple
  architectures in the same kernel (kern.supported_archs="amd64 i386")
- Misparsing with unimplemented messages such as route, interface
  address state notifications

To fix those issues, this change implements all the required socket
address parsers, adds a processor architecture identifying function to
FreeBSD and tests.

Fixes #9707.
Fixes #8203.

Change-Id: I7ed7b4a0b6f10f54b29edc681a2f35603f2d8d45
Reviewed-on: https://go-review.googlesource.com/4330
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-20 04:33:28 +00:00
Alex Sergeyev
eaf8e8cbe5 net/http/cgi: fix REMOTE_ADDR, REMOTE_HOST, add REMOTE_PORT
Env vars were incorrectly copying whole value of http.RemoteAddr
to REMOTE_ADDR and REMOTE_HOST. They contained IP:port pair which
instead should only have IP (RFC 3875, other sources).

Module also was not setting REMOTE_PORT variable which become de-facto
standard for passing TCP client port to CGI scripts (Apache mod_cgi,
IIS, and probably others)

Fixes #9861

Change-Id: Ia73e664c48539e3c7db4997d09d957884e98d8a5
Reviewed-on: https://go-review.googlesource.com/4933
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-18 19:56:50 +00:00
Yasuhiro Matsumoto
d866cd6817 all: fix typo in doc
Change-Id: I89fdda2914030dfea3183a8b4681dd4b33489729
Reviewed-on: https://go-review.googlesource.com/4996
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 04:37:18 +00:00
Mikio Hara
f43a8dea92 net: disable WriteMsgUDP tests on nacl, windows (fix build)
Change-Id: I695b89ec2b63233d94c49c4a40a57b50350ec67c
Reviewed-on: https://go-review.googlesource.com/4350
TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-10 23:21:40 +00:00
Mikio Hara
a9a6757c64 net: update documentation for WriteMsgUDP
Change-Id: I69f24887601e491d6d722bfeb2952d927df8ad80
Reviewed-on: https://go-review.googlesource.com/4351
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-10 22:27:17 +00:00
Nicolas S. Dade
263405ea4a net: permit WriteMsgUDP to connected UDP sockets
The sanity checks at the beginning of WriteMsgUDP were too
strict, and did not allow a case sendmsg(2) suppports: sending
to a connected UDP socket.

This fixes the sanity checks. Either the socket is unconnected,
and a destination addresses is required (what all existing callers
must have been doing), or the socket is connected and an explicit
destination address must not be used.

Fixes #9807

Change-Id: I08d4ec3c2bf830335c402acfc0680c841cfcec71
Reviewed-on: https://go-review.googlesource.com/3951
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-02-10 08:00:39 +00:00
Rajat Goel
d34ee29a52 net/http: fix test to check that requests to 'localhost' are not proxied
I think the test was meant to test requests to 'localhost:80' instead
of 'localhost:80:80'. It passes even with 'localhost:80:80' because
net.SplitHostPort fails inside useProxy. Please comment if you want to
leave old 'localhost:80' is the list too to check old code path.

Change-Id: Ic4cd21901563449e3d4e2f4c8caf723f4ca15bac
u
Reviewed-on: https://go-review.googlesource.com/4293
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-10 03:01:30 +00:00
mattn
ea22a08fd4 net: re-implement Interfaces and InterfaceAddrs for IPNet, IPv6 on Windows
Fixes #5395

Change-Id: I4322bc8a974d04d9bae6b48c71c5d32d9252973c
Reviewed-on: https://go-review.googlesource.com/3024
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-02-10 00:44:05 +00:00
Dmitry Vyukov
6d06d4862d net: don't allocate dialer closure if we won't use it
When we use dialMulti we also allocate dialSingle closure for no reason.

Change-Id: I074282a9d6e2c2a1063ab311a1b95e10fe65219f
Reviewed-on: https://go-review.googlesource.com/4119
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-09 08:30:40 +00:00
Brad Fitzpatrick
46bff7558a net/smtp: document SendMail more
Fixes #9776

Change-Id: I53741fd970244bbfa6874adcb4f1e3d0e7de386b
Reviewed-on: https://go-review.googlesource.com/4162
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-07 22:23:10 +00:00
Shenghou Ma
7e43aee301 net: document that user shouldn't modify returned Addr
Ideally, those methods should return a copy of the Addr, but
due to the Go 1 API guarantee, we cannot make that change now:
there might exist client code that uses the returned Addr as
map index and thus relies on the fact that different invocation
of the method returns the same pointer. Changing this behavior
will lead to hidden behaviour change in those programs.

Update #9654.

Change-Id: Iad4235f2ed7789b3a3c8e0993b9718cf0534ea2b
Reviewed-on: https://go-review.googlesource.com/3851
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-06 19:21:40 +00:00
Péter Surányi
9b6ccb1323 all: don't refer to code.google.com/p/go{,-wiki}/
Only documentation / comment changes. Update references to
point to golang.org permalinks or go.googlesource.com/go.
References in historical release notes under doc are left as is.

Change-Id: Icfc14e4998723e2c2d48f9877a91c5abef6794ea
Reviewed-on: https://go-review.googlesource.com/4060
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-06 14:41:47 +00:00
Erik Aigner
017182258a net/http: Fix typo in MaxBytesReader comment
Change-Id: Ida064ff422d077d508ef94f52fc813daa6277a99
Reviewed-on: https://go-review.googlesource.com/3933
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-05 16:38:10 +00:00
Mikio Hara
c768a84b38 net: remove the dregs of old built-in poll server
We don't need placeholders for the old built-in poll server any more.

Change-Id: I3a510aec6a30bc2ac97676c400177cdfe557b8dc
Reviewed-on: https://go-review.googlesource.com/3863
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-02-04 10:16:38 +00:00
Mikio Hara
5ab3823c6b net: update TDDO
The issue #8432 has been marked as an issue for golang.org/x/net.

Change-Id: Ia39abd99b685c820ea6169ee6505b16028e7e77f
Reviewed-on: https://go-review.googlesource.com/3836
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-04 04:57:32 +00:00
Blake Gentry
38dcc8cd88 net/http: remove unused switchReader type
Change-Id: Ic8a01d06ffc6c80beaf6dee9e7242dcbb7425e71
Reviewed-on: https://go-review.googlesource.com/3822
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-03 23:24:36 +00:00
Mikio Hara
826fa06189 net: case insensitivity of DNS labels in built-in stub resolver
This change adds support for case insensitivity of DNS labels to
built-in DNS stub resolver as described in RFC 4343.

Fixes #9215.

Change-Id: Ia752fe71866a3bfa3ea08371985b799d419ddea3
Reviewed-on: https://go-review.googlesource.com/3685
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-03 10:29:50 +00:00
Erik Aigner
77067c1697 net/http: remove redundant strings.TrimPrefix
We already checked for the prefix with strings.HasPrefix

Change-Id: I33852fd19ffa92aa33b75b94b4bb505f4043a54a
Reviewed-on: https://go-review.googlesource.com/3691
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-03 09:58:37 +00:00
David Crawshaw
09114fb359 net: failed not faild
Change-Id: Iea4221186325783db2029b07af1409015ddeda99
Reviewed-on: https://go-review.googlesource.com/3695
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-02 11:36:04 +00:00
Mikio Hara
e16ed28707 net: remove full stack test cases for IPConn
A few packages that handle net.IPConn in golang.org/x/net sub repository
already implement full stack test cases with more coverage than the net
package. There is no need to keep duplicate code around here.

This change removes full stack test cases for IPConn that require
knowing how to speak with each of protocol stack implementation of
supported platforms.

Change-Id: I871119a9746fc6a2b997b69cfd733463558f5816
Reviewed-on: https://go-review.googlesource.com/3404
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-29 10:21:44 +00:00
Mikio Hara
5e279ddd01 net: remove solaris tag from cgo
For now solaris port does not support cgo. Moreover, its system calls
and library interfaces are different from BSD.

Change-Id: Idb4fed889973368b35d38b361b23581abacfdeab
Reviewed-on: https://go-review.googlesource.com/3306
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-01-29 10:07:21 +00:00
Brad Fitzpatrick
f3857f5748 net/http: close HTTP response bodies in benchmark
This should fix the race builders.

Change-Id: I9c9e7393d5e29d64ab797e346b34b1fa1dfe6d96
Reviewed-on: https://go-review.googlesource.com/3441
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-01-28 19:40:59 +00:00
Dmitry Vyukov
690db9c89f net/http/pprof: add tracing support
net/http/pprof part of tracing functionality:
https://docs.google.com/document/u/1/d/1FP5apqzBgr7ahCCgFO-yoVhk4YZrNIDNf9RybngBc14/pub
Full change:
https://codereview.appspot.com/146920043

Change-Id: I9092028fcbd5e8f97a56f2c155889ccdfb494afb
Reviewed-on: https://go-review.googlesource.com/1453
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-28 19:40:09 +00:00
Dmitry Vyukov
8bc30e0733 net/http: fix goroutine leak in benchmark
Race builders report goroutine leaks after addition of this benchmark:
http://build.golang.org/log/18e47f4cbc18ee8db125e1f1157573dd1e333c41
Close idle connection in default transport.

Change-Id: I86ff7b2e0972ed47c5ebcb9fce19e7f39d3ff530
Reviewed-on: https://go-review.googlesource.com/3412
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-28 13:42:12 +00:00
Mikio Hara
bed884e8b9 net: update test cases for network interface API
This change extends existing test case to Windows for helping to fix
golang.org/issue/5395.

Change-Id: Iff077fa98ede511981df513f48d84c19375b3e04
Reviewed-on: https://go-review.googlesource.com/3304
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-01-28 03:39:20 +00:00