mirror of
https://github.com/golang/go
synced 2024-11-22 08:44:41 -07:00
http: fix IP confusion in TestServerTimeouts
Don't assume that localhost == 127.0.0.1. It might be ::1. R=bradfitzgo CC=golang-dev https://golang.org/cl/4430055
This commit is contained in:
parent
cded21a337
commit
857f17d346
@ -247,7 +247,7 @@ func TestServerTimeouts(t *testing.T) {
|
|||||||
server := &Server{Handler: handler, ReadTimeout: 0.25 * second, WriteTimeout: 0.25 * second}
|
server := &Server{Handler: handler, ReadTimeout: 0.25 * second, WriteTimeout: 0.25 * second}
|
||||||
go server.Serve(l)
|
go server.Serve(l)
|
||||||
|
|
||||||
url := fmt.Sprintf("http://localhost:%d/", addr.Port)
|
url := fmt.Sprintf("http://%s/", addr)
|
||||||
|
|
||||||
// Hit the HTTP server successfully.
|
// Hit the HTTP server successfully.
|
||||||
tr := &Transport{DisableKeepAlives: true} // they interfere with this test
|
tr := &Transport{DisableKeepAlives: true} // they interfere with this test
|
||||||
@ -265,7 +265,7 @@ func TestServerTimeouts(t *testing.T) {
|
|||||||
|
|
||||||
// Slow client that should timeout.
|
// Slow client that should timeout.
|
||||||
t1 := time.Nanoseconds()
|
t1 := time.Nanoseconds()
|
||||||
conn, err := net.Dial("tcp", fmt.Sprintf("localhost:%d", addr.Port))
|
conn, err := net.Dial("tcp", addr.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Dial: %v", err)
|
t.Fatalf("Dial: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user