Skip to content

Commit

Permalink
net/http: fix flaky TestServerValidatesHostHeader
Browse files Browse the repository at this point in the history
Passes with go test -race -count=1000 -name=TestServerValidatesHostHeader now
without hanging.

Fixes #13950

Change-Id: I41c3a555c642595c95c8c52f19a05a4c68e67630
Reviewed-on: https://go-review.googlesource.com/18660
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
bradfitz committed Jan 14, 2016
1 parent efd93a4 commit 38ca046
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/net/http/serve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3827,7 +3827,7 @@ func TestServerValidatesHostHeader(t *testing.T) {
{"HTTP/1.0", "Host: \xff\r\n", 400},
}
for _, tt := range tests {
conn := &testConn{closec: make(chan bool)}
conn := &testConn{closec: make(chan bool, 1)}
io.WriteString(&conn.readBuf, "GET / "+tt.proto+"\r\n"+tt.host+"\r\n")

ln := &oneConnListener{conn}
Expand Down Expand Up @@ -3867,7 +3867,7 @@ func TestServerValidatesHeaders(t *testing.T) {
{"foo: foo\xfffoo\r\n", 200}, // non-ASCII high octets in value are fine
}
for _, tt := range tests {
conn := &testConn{closec: make(chan bool)}
conn := &testConn{closec: make(chan bool, 1)}
io.WriteString(&conn.readBuf, "GET / HTTP/1.1\r\nHost: foo\r\n"+tt.header+"\r\n")

ln := &oneConnListener{conn}
Expand Down

0 comments on commit 38ca046

Please sign in to comment.