2017-10-27 04:52:29 +08:00
|
|
|
// HTTP parts go1.8+
|
|
|
|
|
|
|
|
//+build go1.8
|
|
|
|
|
2018-02-15 04:39:11 +08:00
|
|
|
package httplib
|
2017-10-27 04:52:29 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2018-02-15 04:39:11 +08:00
|
|
|
// Initialise the http.Server for post go1.8
|
2017-10-27 04:52:29 +08: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 22:02:19 +08:00
|
|
|
|
|
|
|
// closeServer closes the server in a non graceful way
|
|
|
|
func closeServer(s *http.Server) error {
|
|
|
|
return s.Close()
|
|
|
|
}
|