From: Russ Cox Date: Mon, 18 Apr 2011 20:03:24 +0000 (-0400) Subject: http: fix IP confusion in TestServerTimeouts X-Git-Tag: weekly.2011-04-27~112 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=857f17d346b41979d7f1db8a1d21f4fd2a6e79b1;p=gostls13.git 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 --- diff --git a/src/pkg/http/serve_test.go b/src/pkg/http/serve_test.go index 4dce3781de..c3c7b8d330 100644 --- a/src/pkg/http/serve_test.go +++ b/src/pkg/http/serve_test.go @@ -247,7 +247,7 @@ func TestServerTimeouts(t *testing.T) { server := &Server{Handler: handler, ReadTimeout: 0.25 * second, WriteTimeout: 0.25 * second} go server.Serve(l) - url := fmt.Sprintf("http://localhost:%d/", addr.Port) + url := fmt.Sprintf("http://%s/", addr) // Hit the HTTP server successfully. tr := &Transport{DisableKeepAlives: true} // they interfere with this test @@ -265,7 +265,7 @@ func TestServerTimeouts(t *testing.T) { // Slow client that should timeout. t1 := time.Nanoseconds() - conn, err := net.Dial("tcp", fmt.Sprintf("localhost:%d", addr.Port)) + conn, err := net.Dial("tcp", addr.String()) if err != nil { t.Fatalf("Dial: %v", err) }