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

113 Commits

Author SHA1 Message Date
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
Dmitry Vyukov
a66aa77c2d net/http: add client benchmark
BenchmarkClient is intended for profiling
the client without the HTTP server code.
The server code runs in a subprocess.

Change-Id: I9aa128604d0d4e94dc5c0372dc86f962282ed6e8
Reviewed-on: https://go-review.googlesource.com/3164
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-27 19:10:58 +00:00
Martin Möhrmann
494b4ce2a7 net: simplify itoa conversions
Rename itod to uitoa to have consistent naming with other itoa functions.
Reduce redundant code by calling uitoa from itoa.
Reduce buffer to maximally needed size for conversion of 64bit integers.
Adjust calls to itoa functions in package net to use new name for itod.
Avoid calls to itoa if uitoa suffices.

Change-Id: I79deaede4d4b0c076a99a4f4dd6f644ba1daec53
Reviewed-on: https://go-review.googlesource.com/2212
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-01-22 13:01:28 +00:00
Evan Kroske
68b78b8abd net/http/fcgi: Fix resource leaks
Close the pipe for the body of a request when it is aborted and close
all pipes when child.serve terminates.

Fixes #6934

Change-Id: I1c5e7d2116e1ff106f11a1ef8e99bf70cf04162a
Reviewed-on: https://go-review.googlesource.com/1923
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-19 22:54:54 +00:00
Jongmin Kim
fd880f8d26 net/http: remove unused test type
Change-Id: Ia8d4459a39425583027f00410fe17b9686b768db
Reviewed-on: https://go-review.googlesource.com/3026
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-19 15:56:49 +00:00
Mikio Hara
3b5be4522a net: more accurate parsing of IPv4 header on IPConn
As shown in #9395, inaccurate implementation would be a cause of parsing
IPv4 header twice and corrupted upper-layer message issues.

Change-Id: Ia1a042e7ca58ee4fcb38fe9ec753c2ab100592ca
Reviewed-on: https://go-review.googlesource.com/3001
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-19 03:20:59 +00:00
Martin Möhrmann
c2c0bf77ef net/http/cgi: correctly handle pathnames for cygwin perl on windows
Cygwin perl uses unix pathnames in windows. Include cygwin perl in the
list of special cases for unix pathname handling in test.cgi.

Change-Id: I30445a9cc79d62d022ecc232c35aa5015b7418dc
Reviewed-on: https://go-review.googlesource.com/2973
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-01-17 22:51:55 +00:00
Ian Lance Taylor
fdb855420b net: fix some typos in comments
Change-Id: I1bf1ab930a5c258f5fcc85ca3037692c71bf3cb2
Reviewed-on: https://go-review.googlesource.com/2870
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
2015-01-15 22:59:04 +00:00
Brad Fitzpatrick
3ab4b68bc1 net/http: deflake TestResponseWriterWriteStringAllocs, test interface instead
Skip the allocation testing (which was only used as a signal for
whether the interface was implemented by ResponseWriter), and just
test for it directly.

Fixes #9575

Change-Id: Ie230f1d21b104537d5647e9c900a81509d692469
Reviewed-on: https://go-review.googlesource.com/2720
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-01-13 01:38:10 +00:00