Commit 0cc48e84 authored by Matt Holt's avatar Matt Holt Committed by GitHub

Merge pull request #1374 from mholt/go18timeouts

Set Go 1.8's ReadHeaderTimeout and IdleTimeout
parents 58053fce d264a2cf
......@@ -400,11 +400,10 @@ func makeHTTPServer(addr string, group []*SiteConfig) *http.Server {
}
// set the final values on the server
// TODO: ReadHeaderTimeout and IdleTimeout require Go 1.8
s.ReadTimeout = min.ReadTimeout
// s.ReadHeaderTimeout = min.ReadHeaderTimeout
s.ReadHeaderTimeout = min.ReadHeaderTimeout
s.WriteTimeout = min.WriteTimeout
// s.IdleTimeout = min.IdleTimeout
s.IdleTimeout = min.IdleTimeout
return s
}
......
......@@ -100,15 +100,14 @@ func TestMakeHTTPServer(t *testing.T) {
if got, want := actual.ReadTimeout, tc.expected.ReadTimeout; got != want {
t.Errorf("Test %d: Expected ReadTimeout=%v, but was %v", i, want, got)
}
// TODO: ReadHeaderTimeout and IdleTimeout require Go 1.8
// if got, want := actual.ReadHeaderTimeout, tc.expected.ReadHeaderTimeout; got != want {
// t.Errorf("Test %d: Expected ReadHeaderTimeout=%v, but was %v", i, want, got)
// }
if got, want := actual.ReadHeaderTimeout, tc.expected.ReadHeaderTimeout; got != want {
t.Errorf("Test %d: Expected ReadHeaderTimeout=%v, but was %v", i, want, got)
}
if got, want := actual.WriteTimeout, tc.expected.WriteTimeout; got != want {
t.Errorf("Test %d: Expected WriteTimeout=%v, but was %v", i, want, got)
}
// if got, want := actual.IdleTimeout, tc.expected.IdleTimeout; got != want {
// t.Errorf("Test %d: Expected IdleTimeout=%v, but was %v", i, want, got)
// }
if got, want := actual.IdleTimeout, tc.expected.IdleTimeout; got != want {
t.Errorf("Test %d: Expected IdleTimeout=%v, but was %v", i, want, got)
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment