summaryrefslogtreecommitdiff
path: root/src/net
Commit message (Collapse)AuthorAgeFilesLines
* net/http: update bundled http2Brad Fitzpatrick2016-12-061-9/+78
| | | | | | | | | | | | | | | Updates bundled x/net/http2 to git rev 8dab9293 for: http2: make Transport retry on server's GOAWAY graceful shutdown https://golang.org/cl/33971 Fixes #18083 Change-Id: I676f5eb4b490a4d86356778bb17296c451f16d90 Reviewed-on: https://go-review.googlesource.com/34011 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tom Bergan <tombergan@google.com>
* net/http: fix typo in Request.GetBody's doc stringChris Broadfoot2016-12-061-1/+1
| | | | | | Change-Id: I84043b6fe4b20a2514d47217e07e44f26bec52ab Reviewed-on: https://go-review.googlesource.com/33973 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net/http: revert change making NewRequest set ContentLength -1Brad Fitzpatrick2016-12-013-25/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The introduction of NoBody and related body-peeking bug fixes also added a "cleanup" of sorts to make NewRequest set the returned Requests's ContentLength to -1 when it didn't know it. Using -1 to mean unknown is what the documentation says, but then people apparently(?) depended on it being zero so they could do this: req, _ := http.NewRequest("POST", url, someNonNilReaderWithUnkownSize) req.Body = nil res, err := http.DefaultClient.Do(req) ... and expect it to work. After https://golang.org/cl/31445 the contrived(?) code above stopped working, since Body was nil and ContentLength was -1, which has been disallowed since Go 1.0. So this restores the old behavior of NewRequest, not setting it to -1. That part of the fix isn't required as of https://golang.org/cl/31726 (which added NoBody) I still don't know whether this bug is hypothetical or actually affected people in practice. Let's assume it's real for now. Fixes #18117 Change-Id: I42400856ee92a1a4999b5b4668bef97d885fbb53 Reviewed-on: https://go-review.googlesource.com/33801 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/http: teach NewRequest that NoBody has ContentLength zeroBrad Fitzpatrick2016-12-012-1/+13
| | | | | | | | | | | | NoBody is new in Go 1.8. Found while investigating #18117 Change-Id: I6bda030f358e2270f090d108cb3a89c8a2665fcb Reviewed-on: https://go-review.googlesource.com/33714 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: fix writev tests on AndroidElias Naur2016-12-011-1/+1
| | | | | | Change-Id: Iacced25363f54ee2cc1e00a71605dba7fb447162 Reviewed-on: https://go-review.googlesource.com/33772 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net/http: clarify Request.Context's lifetimeBrad Fitzpatrick2016-12-011-2/+2
| | | | | | | | | | | | Reverts https://golang.org/cl/23672 and tweaks the text to clarify HTTP/2 request cancelations also cancel the context (not just closing the TCP conn). Fixes #18143 Change-Id: I9f838e09b906d455c98f676e5bc5559f8f7ecb17 Reviewed-on: https://go-review.googlesource.com/33769 Reviewed-by: Chris Broadfoot <cbro@golang.org>
* net/http: document how headers are forwarded by ClientJoe Tsai2016-11-301-2/+27
| | | | | | | | Fixes #18096 Change-Id: I22e1abb75dc19c4d1985b6857c79a81b9db5a76c Reviewed-on: https://go-review.googlesource.com/33670 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net/http: fix test TestServeMuxHandlerRedirectsShenghou Ma2016-11-301-2/+2
| | | | | | | | | | | | | | The code was intended to test that mux handler should redirect at most once, but the added loop condition defeated that. Remove the loop condition and document the intention better. Fixes #18068. Change-Id: I2a4ea041eae27168b45a09aa46e740ac03921594 Reviewed-on: https://go-review.googlesource.com/33654 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* net/http: remove logging on bad client requestsKenny Grant2016-11-301-2/+0
| | | | | | | | | | As discussed in #18095 the server should not log for bad user input. Change-Id: I628a796926eff3a971e5b04abec17ea377c3f9b7 Reviewed-on: https://go-review.googlesource.com/33617 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: expand nss myhostname fallback detectionDan Peterson2016-11-293-59/+101
| | | | | | | | | | | | | Expand myhostname fallback detection to properly detect the local hostname in addition to other supported special names and suffixes. Fixes #17967 Change-Id: I1fe141fd9838b25886c08b6f2fd325e58be60457 Reviewed-on: https://go-review.googlesource.com/33550 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net/http/httptest: fix typo in doc commentMichal Bohuslávek2016-11-291-1/+1
| | | | | | Change-Id: I89f276b32015882437e128814573343a4ca53569 Reviewed-on: https://go-review.googlesource.com/33615 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net/http, net/http/httptest: cross-reference the two NewRequest funcsBrad Fitzpatrick2016-11-282-5/+8
| | | | | | | | Updates #18082 Change-Id: I2e65b115b809c1e1bf813f538989d1a1f96b2876 Reviewed-on: https://go-review.googlesource.com/33636 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/http: document restrictions on ETag as expected by ServeContentJoe Tsai2016-11-281-2/+2
| | | | | | | | | | Fixes #18054 Change-Id: I6773943a95b92eebd7e347f8f7a80843b4827243 Reviewed-on: https://go-review.googlesource.com/33630 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: document that Header.Get key is case insensitiveKaviraj2016-11-283-3/+11
| | | | | | | | | | | Document that key in Header.Get(key) is case insensitive in http.Header, mail.Header, textproto.Header. Fixes #18019 Change-Id: Iba7932491e02e555190b6fce053088b580a853ef Reviewed-on: https://go-review.googlesource.com/33530 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: add missing comma on BUGS section for consistencyMikio Hara2016-11-281-2/+2
| | | | | | | | Change-Id: Ic96fb52f37257e06e77cc08da5c73ea6f9ff158c Reviewed-on: https://go-review.googlesource.com/33592 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: update documentation on Conn and PacketConnJoe Tsai2016-11-261-14/+26
| | | | | | | | Fixes #17982 Change-Id: I4884a6b57905420ac0e37210c411de98c582de1d Reviewed-on: https://go-review.googlesource.com/33473 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net/http: fix receiver for Server.Shutdown and Server.CloseDan Peterson2016-11-241-15/+15
| | | | | | | | Change-Id: Ia27ca728bafcf20d001b477787b21d16ae12960d Reviewed-on: https://go-review.googlesource.com/33552 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net/http: fix parallel tests using global DefaultTransportBrad Fitzpatrick2016-11-222-8/+33
| | | | | | | | | | | | | | | | When I added t.Parallel to some tests earlier, I overlooked some using the global "Get" func, which uses DefaultTransport. The DefaultTransport can have its CloseIdleConnections called by other parallel tests. Use a private Transport instead. Fixes #18006 Change-Id: Ia4faca5bac235cfa95dcf2703c25f3627112a5e9 Reviewed-on: https://go-review.googlesource.com/33432 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/http: skip TestLinuxSendfile on mips64 for nowBrad Fitzpatrick2016-11-221-3/+1
| | | | | | | | | | | See issues for details. We can expand this test during the Go 1.9 cycle. Updates #18008 Change-Id: I78b6b7e8dede414769be97898e29f969bc2a9651 Reviewed-on: https://go-review.googlesource.com/33430 Reviewed-by: Cherry Zhang <cherryyz@google.com>
* net/http: maybe fix TestLinuxSendfile on mips64Brad Fitzpatrick2016-11-211-1/+5
| | | | | | | | Updates #18008 Change-Id: I8fde0d71d15b416db4d262f6db8ef32a209a192f Reviewed-on: https://go-review.googlesource.com/33426 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/http: deflake TestClientTimeoutBrad Fitzpatrick2016-11-211-10/+9
| | | | | | | | | | | | | | | | Should fix flakes like: https://build.golang.org/log/c8da331317064227f38d5ef57ed7dba563ba1b38 --- FAIL: TestClientTimeout_h1 (0.35s) client_test.go:1263: timeout after 200ms waiting for timeout of 100ms FAIL Change-Id: I0a4dba607524e8d7a00f498e27d9598acde5d222 Reviewed-on: https://go-review.googlesource.com/33420 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: use testenv.SkipFlaky instead of testing.SkipMikio Hara2016-11-171-1/+1
| | | | | | | | Change-Id: Ic219fedbe6bbb846f31111fa21df6f2b8620e269 Reviewed-on: https://go-review.googlesource.com/33263 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: tweak comment on ExampleCIDRMaskMikio Hara2016-11-171-3/+5
| | | | | | | | | | CIDRMask just returns a mask which corresponds to an address prefix in CIDR nonation. A subnet for an IPv6 mask sounds a bit confusing. Change-Id: Ic7859ce992bc2de4043d3b25caf9a1051d118b0e Reviewed-on: https://go-review.googlesource.com/33262 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/http: deflake TestInterruptWithPanic_nil_h2, againBrad Fitzpatrick2016-11-171-0/+10
| | | | | | | | | | Updates #17243 Change-Id: Iaa737874e75fdac73452f1fc13a5749e8df78ebe Reviewed-on: https://go-review.googlesource.com/33332 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: add example for CIDRMaskKevin Burke2016-11-161-0/+11
| | | | | | | | | | | | | I had trouble translating the documentation language into a subnet - e.g. whether /31 was CIDRMask(1, 31) or CIDRMask(1, 32) or CIDRMask(31, 32) so I thought I'd add a short example showing how to create the right masks. Change-Id: Ia6a6de08c5c30b6d2249b3194cced2d3c383e317 Reviewed-on: https://go-review.googlesource.com/32677 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: disable TestAcceptTimeout for nowBrad Fitzpatrick2016-11-161-0/+1
| | | | | | | | | | | | | It's too flaky and doing more harm than good. Disable it until it can be made reliable. Updates #17948 Updates #17927 Change-Id: Iaab7f09a4060da377fcd3ca2262527fef50c558d Reviewed-on: https://go-review.googlesource.com/33330 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: deflake TestAcceptTimeout againMikio Hara2016-11-161-2/+0
| | | | | | | | | | | | | | | This is a followup to CL 33257. It looks like active close operation at passive open side sometimes takes a bit long time on Darwin. Fixes #17948. Change-Id: Ida17639c4e66a43e1be1f74fd0ef3baddde25092 Reviewed-on: https://go-review.googlesource.com/33258 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: deflake TestAcceptTimeoutMikio Hara2016-11-161-6/+7
| | | | | | | | | | | This change makes use of synchronization primitive instead of context-based canceling not to depend on defer execution scheduling. Fixes #17927. Change-Id: I5ca9287a48bb5cdda6845a7f12757f95175c5db8 Reviewed-on: https://go-review.googlesource.com/33257 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: don't run TestTCPBig unconditionallyMikio Hara2016-11-162-2/+4
| | | | | | | | | | | | | | The test requires tons of memory and results various failures, mainly runtime errors and process termination by SIGKILL, caused by resource exhaustion when the node under test doesn't have much resources. This change makes use of -tcpbig flag to enable the test. Change-Id: Id53fa5d88543e2e60ca9bb4f55a1914ccca844e1 Reviewed-on: https://go-review.googlesource.com/33254 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net/http: fix a typo in testMikio Hara2016-11-161-1/+1
| | | | | | Change-Id: I897237667ffe9e9b2a5f92251a6f665d29479fd2 Reviewed-on: https://go-review.googlesource.com/33255 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: don't call t.Fatal from a goroutineIan Lance Taylor2016-11-153-8/+15
| | | | | | | | | | Fixes #17900. Change-Id: I42cda6ac9cf48ed739d3a015a90b3cb15edf8ddf Reviewed-on: https://go-review.googlesource.com/33243 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: add test that TCP Close unblocks blocked ReadsBrad Fitzpatrick2016-11-152-3/+19
| | | | | | | | | | | | | I guess this was fixed at some point. Remove a skipped test in net/http and add an explicit test in net. Fixes #17695 Change-Id: Idb9f3e236b726bb45098474b830c95c1fce57529 Reviewed-on: https://go-review.googlesource.com/33242 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/http: update bundled http2 for write scheduling order fixBrad Fitzpatrick2016-11-151-5/+5
| | | | | | | | | | | | | | | Updates x/net/http2 to x/net git rev 00ed5e9 for: http2: schedule RSTStream writes onto its stream's queue https://golang.org/cl/33238 Fixes #17243 Change-Id: I79cc5d15bf69ead28d549d4f798c12f4ee2a2201 Reviewed-on: https://go-review.googlesource.com/33241 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net/http: update bundled http2, add TestServerKeepAlivesEnabled h1/h2 testsBrad Fitzpatrick2016-11-143-8/+71
| | | | | | | | | | | | | | | | | Updates x/net/http2 to x/net git rev 6dfeb344 for: http2: make Server respect http1 Server's SetKeepAlivesEnabled https://golang.org/cl/33153 And adds a test in std. Fixes #17717 Change-Id: I3ba000abb6f3f682261e105d8a4bb93bde6609fe Reviewed-on: https://go-review.googlesource.com/33231 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tom Bergan <tombergan@google.com>
* net/http: enable timeout tests on Plan 9David du Colombier2016-11-132-15/+0
| | | | | | | | | | | | | | | | | | | | Deadlines have been implemented on Plan 9 in CL 31521. Enable the following tests: - TestServerTimeouts - TestOnlyWriteTimeout - TestTLSHandshakeTimeout - TestIssue4191_InfiniteGetTimeout - TestIssue4191_InfiniteGetToPutTimeout Updates #7237. Change-Id: If5e75cfaa9133dcf9ce6aac9fc2badafc1612b64 Reviewed-on: https://go-review.googlesource.com/33197 Run-TryBot: David du Colombier <0intro@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net/http: fix error message in TestClientWriteShutdownDavid du Colombier2016-11-131-1/+1
| | | | | | | | Change-Id: I3c664201baef6d7dbed94dab63db0ac974bf6817 Reviewed-on: https://go-review.googlesource.com/33198 TryBot-Result: Gobot Gobot <gobot@golang.org> Run-TryBot: David du Colombier <0intro@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: fix vet nitsJosh Bleecher Snyder2016-11-131-1/+1
| | | | | | | | | | | | | | Fixes these vet complaints: net/error_test.go:254: unrecognized printf flag for verb 'T': '#' os/os_test.go:1067: arg mt for printf verb %d of wrong type: time.Time runtime/debug/garbage_test.go:83: arg dt for printf verb %d of wrong type: time.Time Change-Id: I0e986712a4b083b75fb111e687e424d06a85a47b Reviewed-on: https://go-review.googlesource.com/33167 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: enable timeout tests on Plan 9David du Colombier2016-11-131-28/+3
| | | | | | | | | | | | | | | | | | | | | | Deadlines have been implemented on Plan 9 in CL 31521. Enable the following tests: - TestReadTimeout - TestReadFromTimeout - TestWriteTimeout - TestWriteToTimeout - TestReadTimeoutFluctuation - TestVariousDeadlines - TestVariousDeadlines1Proc - TestVariousDeadlines4Proc - TestReadWriteDeadlineRace Change-Id: I221ed61d55f7f1e4345b37af6748c04e1e91e062 Reviewed-on: https://go-review.googlesource.com/33196 Run-TryBot: David du Colombier <0intro@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net/http/httptest: remove workaround on Plan 9David du Colombier2016-11-121-10/+0
| | | | | | | | | | This issue has been fixed in CL 31390. Change-Id: I0c2425fd33be878037d10d612a50116a7b693431 Reviewed-on: https://go-review.googlesource.com/33195 Run-TryBot: David du Colombier <0intro@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: enable TestReadTimeoutUnblocksRead on Plan 9David du Colombier2016-11-121-3/+0
| | | | | | | | | | Deadlines have been implemented on Plan 9 in CL 31521. Fixes #17477. Change-Id: Icb742ac30933b6d2f9350fc4e6acbcd433c66c21 Reviewed-on: https://go-review.googlesource.com/33190 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: implement asynchonous cancelable I/O on Plan 9David du Colombier2016-11-123-5/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change is an experimental implementation of asynchronous cancelable I/O operations on Plan 9, which are required to implement deadlines. There are no asynchronous syscalls on Plan 9. I/O operations are performed with blocking pread and pwrite syscalls. Implementing deadlines in Go requires a way to interrupt I/O operations. It is possible to interrupt reads and writes on a TCP connection by forcing the closure of the TCP connection. This approach has been used successfully in CL 31390. However, we can't implement deadlines with this method, since we require to be able to reuse the connection after the timeout. On Plan 9, I/O operations are interrupted when the process receives a note. We can rely on this behavior to implement a more generic approach. When doing an I/O operation (read or write), we start the I/O in its own process, then wait for the result asynchronously. The process is able to handle the "hangup" note. When receiving the "hangup" note, the currently running I/O operation is canceled and the process returns. This way, deadlines can be implemented by sending an "hangup" note to the process running the blocking I/O operation, after the expiration of a timer. Fixes #11932. Fixes #17498. Change-Id: I414f72c7a9a4f9b8f9c09ed3b6c269f899d9b430 Reviewed-on: https://go-review.googlesource.com/31521 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: spell "marshal" and "unmarshal" consistentlyDmitri Shuralyov2016-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tree is inconsistent about single l vs double l in those words in documentation, test messages, and one error value text. $ git grep -E '[Mm]arshall(|s|er|ers|ed|ing)' | wc -l 42 $ git grep -E '[Mm]arshal(|s|er|ers|ed|ing)' | wc -l 1694 Make it consistently a single l, per earlier decisions. This means contributors won't be confused by misleading precedence, and it helps consistency. Change the spelling in one error value text in newRawAttributes of crypto/x509 package to be consistent. This change was generated with: perl -i -npe 's,([Mm]arshal)l(|s|er|ers|ed|ing),$1$2,' $(git grep -l -E '[Mm]arshall' | grep -v AUTHORS | grep -v CONTRIBUTORS) Updates #12431. Follows https://golang.org/cl/14150. Change-Id: I85d28a2d7692862ccb02d6a09f5d18538b6049a2 Reviewed-on: https://go-review.googlesource.com/33017 Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: deflake TestTCPSupriousConnSetupCompletion [sic]Brad Fitzpatrick2016-11-112-3/+4
| | | | | | | | | | | | And rename it. Fixes #17703 Change-Id: I73c82a9b3f96180699c6d33c069a666018eb30f9 Reviewed-on: https://go-review.googlesource.com/33149 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/smtp: make Client.Auth trim final space if Auth.Start toServer is emptyBrad Fitzpatrick2016-11-112-1/+42
| | | | | | | | | | | | | | | | | | Users can implement the smtp.Auth interface and return zero bytes in the "toServer []byte" return value from the Auth.Start method. People apparently do this to implement the SMTP "LOGIN" method. But we were then sending "AUTH LOGIN \r\n" to the server, which some servers apparently choke on. So, trim it when the toServer value is empty. Fixes #17794 Change-Id: I83662dba9e0f61b1c5000396c096cf7110f78361 Reviewed-on: https://go-review.googlesource.com/33143 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/http: make Server respect shutdown state after handler finishesBrad Fitzpatrick2016-11-112-3/+8
| | | | | | | | | | | | | If the Server's Shutdown (or SetKeepAlivesEnabled) method was called while a connection was in a Handler, but after the headers had been written, the connection was not later closed. Fixes #9478 Updates #17754 (reverts that workaround) Change-Id: I65324ab8217373fbb38e12e2b8bffd0a91806072 Reviewed-on: https://go-review.googlesource.com/33141 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net/http: make Server log on bad requests from clientsKenny Grant2016-11-115-17/+56
| | | | | | | | | | Fixes #12745 Change-Id: Iebb7c97cb5b68dc080644d796a6ca1c120d41b26 Reviewed-on: https://go-review.googlesource.com/27950 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net/http: deflake new TestInterruptWithPanic_h2Brad Fitzpatrick2016-11-112-12/+34
| | | | | | | | | | | | | | | | | | | TestInterruptWithPanic_h2 was added yesterday in https://golang.org/cl/33099 and https://golang.org/cl/33103 Deflake it. The http2 server sends an error before logging. Rather than reorder the http2 code to log before writing the RSTStream frame, just loop for a bit waiting for the condition we're expecting. This goes from 2 in 500 flakes for me to unreproducible. Change-Id: I062866a5977f50c820965aaf83882ddd7bf98f91 Reviewed-on: https://go-review.googlesource.com/33140 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
* net: apply tcp4/tcp6 restrictions to literals in ResolveTCPAddrRuss Cox2016-11-116-48/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The restrictions were already being applied to the IP addresses received from the host resolver. Apply the same restrictions to literal IP addresses not passed to the host resolver. For example, ResolveTCPAddr("tcp4", "[2001:db8::1]:http") used to succeed and now does not (that's not an IPv4 address). Perhaps a bit surprisingly, ResolveTCPAddr("tcp4", "[::ffff:127.0.0.1]:http") succeeds, behaving identically to ResolveTCPAddr("tcp4", "127.0.0.1:http"), and ResolveTCPAddr("tcp6", "[::ffff:127.0.0.1]:http") fails, behaving identically to ResolveTCPAddr("tcp6", "127.0.0.1:http"). Even so, it seems right to match (by reusing) the existing filtering as applied to addresses resolved by the host C library. If anyone can make a strong argument for changing the filtering of IPv4-inside-IPv6 addresses, the fix can be applied to all the code paths in a separate CL. Fixes #14037. Change-Id: I690dfdcbe93d730e11e00ea387fa7484cd524341 Reviewed-on: https://go-review.googlesource.com/32100 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: fix vet nitsJosh Bleecher Snyder2016-11-111-1/+1
| | | | | | | | | | | | | | | | Fixes these complaints from vet: cmd/compile/internal/gc/noder.go:32: cmd/compile/internal/syntax.Error composite literal uses unkeyed fields cmd/compile/internal/gc/noder.go:1035: cmd/compile/internal/syntax.Error composite literal uses unkeyed fields cmd/compile/internal/gc/noder.go:1051: cmd/compile/internal/syntax.Error composite literal uses unkeyed fields cmd/compile/internal/syntax/parser_test.go:182: possible formatting directive in Error call net/http/client_test.go:1334: possible formatting directive in Fatal call Change-Id: I5f90ec30f3c106c7e66c92e2b6f8d3b4874fec66 Reviewed-on: https://go-review.googlesource.com/33133 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: bring domain name length checks into RFC complianceRichard Gibson2016-11-114-21/+90
| | | | | | | | | | | | The 255-octet limit applies to wire format, not presentation format. Fixes #17549 Change-Id: I2b5181c53fba32fea60178e0d8df9114aa992b55 Reviewed-on: https://go-review.googlesource.com/31722 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>