2017-10-26 20:52:29 +00:00
|
|
|
// HTTP parts go1.8+
|
|
|
|
|
|
|
|
//+build go1.8
|
|
|
|
|
2018-02-14 20:39:11 +00:00
|
|
|
package httplib
|
2017-10-26 20:52:29 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2018-02-14 20:39:11 +00:00
|
|
|
// Initialise the http.Server for post go1.8
|
2017-10-26 20:52:29 +00:00
|
|
|
func initServer(s *http.Server) {
|
|
|
|
s.ReadHeaderTimeout = 10 * time.Second // time to send the headers
|
|
|
|
s.IdleTimeout = 60 * time.Second // time to keep idle connections open
|
|
|
|
}
|
2018-02-19 14:02:19 +00:00
|
|
|
|
|
|
|
// closeServer closes the server in a non graceful way
|
|
|
|
func closeServer(s *http.Server) error {
|
|
|
|
return s.Close()
|
|
|
|
}
|