aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/net/http
AgeCommit message (Collapse)Author
2014-05-20build: make nacl passRuss Cox
Add nacl.bash, the NaCl version of all.bash. It's a separate script because it builds a variant of package syscall with a large zip file embedded in it, containing all the input files needed for tests. Disable various tests new since the last round, mostly the ones using os/exec. Fixes #7945. LGTM=dave R=golang-codereviews, remyoudompheng, dave, bradfitz CC=golang-codereviews https://golang.org/cl/100590044
2014-05-19net/http: document that ProxyFromEnvironment special-cases localhostBrad Fitzpatrick
Fixes #7256 LGTM=r R=golang-codereviews, r CC=golang-codereviews, rsc https://golang.org/cl/97590043
2014-05-16net/http: allow Content-Type on 204 responsesBrad Fitzpatrick
Accidental change from fixing Content-Length on 204s in http://golang.org/issue/6685 earlier. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/92400047
2014-05-15net/http: fix nits found by go tool vetMikio Hara
LGTM=ruiu R=golang-codereviews, ruiu CC=golang-codereviews https://golang.org/cl/91480043
2014-05-12net/http: fix flaky testFabrizio Milo
Prevent idle transport on race condition. Fixes #7847 LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/96230044
2014-05-02std lib: fix various typos in commentsRobert Griesemer
Where the spelling changed from British to US norm (e.g., optimise -> optimize) it follows the style in that file. LGTM=adonovan R=golang-codereviews, adonovan CC=golang-codereviews https://golang.org/cl/96980043
2014-04-26net/http/httputil: tell people not to use ClientConn and ServerConnBrad Fitzpatrick
A very smart developer at Gophercon just asked me to help debug a problem and I was horrified to learn that he was using httputil's ClientConn. I forgot ClientConn and ServerConn were even included in Go 1! They should've been deleted. Scare people away from using them. The net/http package does not use them and they're unused, unmaintained and untouched in 4+ years. LGTM=r R=r, adg CC=golang-codereviews https://golang.org/cl/92790043
2014-04-26src: fix issues found by go vet stdRobert Hencke
LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/96850043
2014-04-25net/http/httputil: don't leak goroutines in DumpRequestOutBrad Fitzpatrick
Fixes #7869 LGTM=dsymonds R=golang-codereviews CC=adg, dsymonds, golang-codereviews, rsc https://golang.org/cl/91770048
2014-04-25net/http, strings, bytes: fix http race, revert part of Reader behavior changeBrad Fitzpatrick
I fixed this data race regression in two ways: in net/http itself, and also partially reverting the change from https://golang.org/cl/77580046 . Previously a Read from a strings.Reader or bytes.Reader returning 0 bytes would not be a memory write. After 77580046 it was. This reverts that back in case others depended on that. Also adds tests. Fixes #7856 LGTM=ruiu, iant R=iant, ruiu CC=golang-codereviews, gri https://golang.org/cl/94740044
2014-04-17net/http/httputil: include Content-Length in DumpResponse outputBrad Fitzpatrick
Fixes #5357 LGTM=nigeltao R=nigeltao CC=golang-codereviews https://golang.org/cl/87910050
2014-04-16net/http: allow commas and spaces in cookie valuesVolker Dobler
According to RFC 6265 a cookie value may contain neither commas nor spaces but such values are very common in the wild and browsers handle them very well so we'll allow both commas and spaces. Values starting or ending in a comma or a space are sent in the quoted form to prevent missinterpetations. RFC 6265 conforming values are handled as before and semicolons, backslashes and double-quotes are still disallowed. Fixes #7243 LGTM=nigeltao R=nigeltao CC=bradfitz, golang-codereviews https://golang.org/cl/86050045
2014-04-16all: fix typosRui Ueyama
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/88670043
2014-04-16net/http: fix data race in TestTransportResponseHeaderTimeoutBrad Fitzpatrick
Fixes #7264 LGTM=dvyukov R=dvyukov CC=golang-codereviews https://golang.org/cl/87970045
2014-04-16net/http: skip TestTransportClosesBodyOnError on Plan 9David du Colombier
LGTM=rsc R=bradfitz, rsc CC=golang-codereviews https://golang.org/cl/87800044
2014-04-14net/http: clarify Response.Body Close responsibilityBrad Fitzpatrick
Per TODO email in my inbox. LGTM=rsc R=golang-codereviews, rsc CC=adg, dsymonds, golang-codereviews, r https://golang.org/cl/87550045
2014-04-14net/http: make race detector happy for recently-added testBrad Fitzpatrick
Update #7264 Races: http://build.golang.org/log/a2e401fdcd4903a61a3375bff5da702a20ddafad http://build.golang.org/log/ec4c69e92076a747ac6d5df7eb7b382b31ab3d43 I think this is the first time I've actually seen a manifestation of Issue 7264, and one that I can reproduce. I don't know why it triggers on this test and not any others just like it, or why I can't reproduce Issue 7264 independently, even when Dmitry gives me minimal repros. Work around it for now with some synchronization to make the race detector happy. The proper fix will probably be in net/http/httptest itself, not in all hundred some tests. LGTM=rsc R=rsc CC=dvyukov, golang-codereviews https://golang.org/cl/87640043
2014-04-14net/http: close Body in client code always, even on errors, and documentBrad Fitzpatrick
Fixes #6981 LGTM=rsc R=golang-codereviews, nightlyone CC=adg, dsymonds, golang-codereviews, rsc https://golang.org/cl/85560045
2014-04-11net/http: quiet useless warning during shutdownBrad Fitzpatrick
What was happening on Issue 7010 was handler intentionally took 30 milliseconds and the proxy's client timeout was 35 milliseconds. Then it slammed the proxy with a bunch of requests. Sometimes the server would be too slow to respond in its 5 millisecond window and the client code would cancel the request, force-closing the persistConn. If this came at the right time, the server's reply was already in flight, and one of the goroutines would report: Unsolicited response received on idle HTTP channel starting with "H"; err=<nil> ... rightfully scaring the user. But the error was already handled and returned to the user, and this connection knows it's been shut down. So look at the closed flag after acquiring the same mutex guarding another field we were checking, and don't complain if it's a known shutdown. Also move closed down below the mutex which guards it. Fixes #7010 LGTM=dsymonds R=golang-codereviews, dsymonds CC=adg, golang-codereviews, rsc https://golang.org/cl/86740044
2014-04-11net/http/httptest: add test for issue 7264Dmitriy Vyukov
The test fails now with -race, so it's disabled. The intention is that the fix for issue 7264 will also modify this test the same way and enable it. Reporduce with 'go test -race -issue7264 -cpu=4'. Update #7264 LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/86770043
2014-04-10net/http: Return ErrNotMultipart from ParseMultipartForm if content-type ↵Matthew Cottingham
isn't multipart/form-data. Add test for multipart form requests with an invalid content-type to ensure ErrNotMultipart is returned. Change ParseMultipartForm to return ErrNotMultipart when it is returned by multipartReader. Modify test for empty multipart request handling to use POST so that the body is checked. Fixes #6334. This is the first changeset working on multipart request handling. Further changesets could add more tests and clean up the TODO. LGTM=bradfitz R=golang-codereviews, gobot, bradfitz, rsc CC=golang-codereviews https://golang.org/cl/44040043
2014-04-10net/http: don't reject 0-lengthed bodies with Expect 100-continueBrad Fitzpatrick
I was implementing rules from RFC 2616. The rules are apparently useless, ambiguous, and too strict for common software on the Internet. (e.g. curl) Add more tests, including a test of a chunked request. Fixes #7625 LGTM=dsymonds R=golang-codereviews, dsymonds CC=adg, golang-codereviews, rsc https://golang.org/cl/84480045
2014-04-10net/http: fix up Response.Write edge casesBrad Fitzpatrick
The Go HTTP server doesn't use Response.Write, but others do, so make it correct. Add a bunch more tests. This bug is almost a year old. :/ Fixes #5381 LGTM=adg R=golang-codereviews, adg CC=dsymonds, golang-codereviews, rsc https://golang.org/cl/85740046
2014-04-10net/http: document, test, define, clean up Request.TrailerBrad Fitzpatrick
Go's had pretty decent HTTP Trailer support for a long time, but the docs have been largely non-existent. Fix that. In the process, re-learn the Trailer code, clean some stuff up, add some error checks, remove some TODOs, fix a minor bug or two, and add tests. LGTM=adg R=golang-codereviews, adg CC=dsymonds, golang-codereviews, rsc https://golang.org/cl/86660043
2014-04-10net/http: fix requests failing on short gzip bodyAlexey Borzenkov
Fixes #7750. LGTM=bradfitz R=golang-codereviews, ibilicc, bradfitz CC=golang-codereviews https://golang.org/cl/84850043
2014-04-09net/http: don't reuse Transport connection unless Request.Write finishedBrad Fitzpatrick
In a typical HTTP request, the client writes the request, and then the server replies. Go's HTTP client code (Transport) has two goroutines per connection: one writing, and one reading. A third goroutine (the one initiating the HTTP request) coordinates with those two. Because most HTTP requests are done when the server replies, the Go code has always handled connection reuse purely in the readLoop goroutine. But if a client is writing a large request and the server replies before it's consumed the entire request (e.g. it replied with a 403 Forbidden and had no use for the body), it was possible for Go to re-select that connection for a subsequent request before we were done writing the first. That wasn't actually a data race; the second HTTP request would just get enqueued to write its request on the writeLoop. But because the previous writeLoop didn't finish writing (and might not ever), that connection is in a weird state. We really just don't want to get into a state where we're re-using a connection when the server spoke out of turn. This CL changes the readLoop goroutine to verify that the writeLoop finished before returning the connection. In the process, it also fixes a potential goroutine leak where a connection could close but the recycling logic could be blocked forever waiting for the client to read to EOF or error. Now it also selects on the persistConn's close channel, and the closer of that is no longer the readLoop (which was dead locking in some cases before). It's now closed at the same place the underlying net.Conn is closed. This likely fixes or helps Issue 7620. Also addressed some small cosmetic things in the process. Update #7620 Fixes #7569 LGTM=adg R=golang-codereviews, adg CC=dsymonds, golang-codereviews, rsc https://golang.org/cl/86290043
2014-04-02net/http: clarify Request fields' client-vs-server semanticsBrad Fitzpatrick
Fixes #7682 LGTM=adg R=golang-codereviews, adg CC=dsymonds, golang-codereviews, iant https://golang.org/cl/83800043
2014-03-25net/http: disable recently-introduced flaky test on WindowsBrad Fitzpatrick
Disable it until it's debugged so it doesn't hide other real problems on Windows. The test was known to be unreliable anyway (which is why it only needed 1 of 20 runs to pass), but apparently it never passes on Windows. Figure out why later. Update #7634 LGTM=alex.brainman R=adg, alex.brainman CC=golang-codereviews https://golang.org/cl/80110043
2014-03-25net/http: don't re-use Transport connections if we've seen an EOFBrad Fitzpatrick
This the second part of making persistent HTTPS connections to certain servers (notably Amazon) robust. See the story in part 1: https://golang.org/cl/76400046/ This is the http Transport change that notes whether our net.Conn.Read has ever seen an EOF. If it has, then we use that as an additional signal to not re-use that connection (in addition to the HTTP response headers) Fixes #3514 LGTM=rsc R=agl, rsc CC=golang-codereviews https://golang.org/cl/79240044
2014-03-18net/http: make use of testing.Errorf instead of testing.Fatalf in non-test ↵Mikio Hara
function goroutines See testing.FailNow for further information. Also avoid nil pointer derefernce in TestTransportMaxPerHostIdleConns. LGTM=dave R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/76470043
2014-03-17net/http: Request Body error should not be ignored.Luka Zakrajšek
Fixes #7521. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/76320043
2014-03-17net/http/fcgi: fix handling of request ID reuseCatalin Patulea
Request ID reuse is allowed by the FastCGI spec [1]. In particular nginx uses the same request ID, 1, for all requests on a given connection. Because serveRequest does not remove the request from conn.requests, this causes it to treat the second request as a duplicate and drops the connection immediately after beginRequest. This manifests with nginx option 'fastcgi_keep_conn on' as the following message in nginx error log: 2014/03/17 01:39:13 [error] 730#0: *109 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x, server: example.org, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "example.org" Because handleRecord and serveRequest run in different goroutines, access to conn.requests must now be synchronized. [1] http://www.fastcgi.com/drupal/node/6?q=node/22#S3.3 LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/76800043
2014-03-11net/http/cgi: serve 500, not 200, on invalid responses from child processesBrad Fitzpatrick
Per RFC 3875 section 6 rules. Fixes #7198 LGTM=adg R=adg CC=golang-codereviews https://golang.org/cl/68960049
2014-03-10net/http: eliminate defined-but-not-used var.Alan Donovan
gc does not report this as an error, but go/types does. (I suspect that constructing a closure counts as a reference to &all in gc's implementation). This is not a tool bug, since the spec doesn't require implementations to implement this check, but it does illustrate that dialect variations are always a nuisance. LGTM=rsc, bradfitz R=bradfitz CC=golang-codereviews, gri, rsc https://golang.org/cl/73850043
2014-03-06net/http/cgi: kill child CGI process on copy errorBrad Fitzpatrick
Fixes #7196 LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, iant https://golang.org/cl/69970052
2014-03-06net/http: make TestUseProxy repeatableDmitriy Vyukov
Currently it fails on second and subsequent runs (when using -cpu=1,2,4) as: --- FAIL: TestUseProxy-4 (0.00 seconds) proxy_test.go:109: useProxy(barbaz.net) = true, want false proxy_test.go:109: useProxy(foobar.com) = true, want false proxy_test.go:109: useProxy(www.foobar.com) = true, want false LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/71940044
2014-03-05net/http: deflake a testBrad Fitzpatrick
I missed this one in codereview.appspot.com/70010050 Same thing, but different test. Fixes windows-amd64-race and likely other Windows machines failing like: http://build.golang.org/log/0382bf0048bf5835a51a8a902df5c6fc73cd7ff5 LGTM=adg R=rsc, adg CC=golang-codereviews https://golang.org/cl/71770043
2014-03-05net/http: minor fixes and optimization for Response.TLSBrad Fitzpatrick
Also add it to doc/go1.3.txt. Update #7289 LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/71740043
2014-03-05net/http: Add TLS Connection State to Responses.Paul A Querna
Fixes #7289. LGTM=bradfitz R=golang-codereviews, r, bradfitz, rsc CC=golang-codereviews https://golang.org/cl/52660047
2014-03-04net/http: improve Client.Timeout docs, quiet testBrad Fitzpatrick
LGTM=adg R=adg CC=golang-codereviews https://golang.org/cl/70930043
2014-03-04net/http: make Request.ParseForm parse form-urlencoded for method PATCH tooMatt Aimonetti
Fixes #7454 LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/70990044
2014-03-04net/http: fix test failure on some Windows machinesBrad Fitzpatrick
The network connection dies differently from the server's perspective on (some) Windows when the client goes away. Match on the common prefix (common to Unix and Windows) instead of the network error part. Fixes #7456 LGTM=josharian R=golang-codereviews, josharian CC=alex.brainman, golang-codereviews, iant https://golang.org/cl/70010050
2014-03-04net/http: deflake another alloc testBrad Fitzpatrick
I have one machine where this 25 test run is flaky and fails ("21 >= 21"), but 50 works everywhere. LGTM=josharian R=josharian CC=golang-codereviews https://golang.org/cl/67870053
2014-03-04net/http: disable an alloc test under the race detectorBrad Fitzpatrick
LGTM=dvyukov R=dvyukov CC=golang-codereviews https://golang.org/cl/70200052
2014-03-03net/http: fix location of StateHijacked and StateActiveBrad Fitzpatrick
1) Move StateHijacked callback earlier, to make it panic-proof. A Hijack followed by a panic didn't previously result in ConnState getting fired for StateHijacked. Move it earlier, to the time of hijack. 2) Don't fire StateActive unless any bytes were read off the wire while waiting for a request. This means we don't transition from New or Idle to Active if the client disconnects or times out. This was documented before, but not implemented properly. This CL is required for an pending fix for Issue 7264 LGTM=josharian R=josharian CC=golang-codereviews https://golang.org/cl/69860049
2014-03-03net/http: in Client, consume small redirect bodies before making next requestBrad Fitzpatrick
In Go 1.2, closing a request body without reading to EOF causes the underlying TCP connection to not be reused. This client code following redirects was never updated when that happened. This was part of a previous CL but moved to its own CL at Josh's request. Now with test too. LGTM=josharian R=josharian CC=golang-codereviews https://golang.org/cl/70800043
2014-03-02net/http: add Client.Timeout for end-to-end timeoutsBrad Fitzpatrick
Fixes #3362 LGTM=josharian R=golang-codereviews, josharian CC=adg, dsymonds, golang-codereviews, n13m3y3r https://golang.org/cl/70120045
2014-03-01net/http: ensure ConnState for StateNew fires before Server.Serve returnsRichard Crowley
The addition of Server.ConnState provides all the necessary hooks to stop a Server gracefully, but StateNew previously could fire concurrently with Serve exiting (as it does when its net.Listener is closed). This previously meant one couldn't use a WaitGroup incremented in the StateNew hook along with calling Wait after Serve. Now you can. Update #4674 LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/70410044
2014-02-28net/http: de-flake ConnState testBrad Fitzpatrick
LGTM=josharian R=golang-codereviews, josharian CC=golang-codereviews https://golang.org/cl/70270043
2014-02-28net/http: add Server.ErrorLog; log and test TLS handshake errorsBrad Fitzpatrick
Fixes #7291 LGTM=agl R=golang-codereviews, agl CC=agl, golang-codereviews https://golang.org/cl/70250044