Closed
Description
go1.3.1 run the following http server: ``` package main import ( "fmt" "net/http" "time" ) func handler(w http.ResponseWriter, r *http.Request) { time.Sleep(2 * time.Second) msg := []byte("Hello world!\n") n, err := w.Write(msg) fmt.Printf("Wrote %d out of %d bytes\n", n, len(msg)) fmt.Println("Error was:", err) } func main() { http.HandleFunc("/", handler) server := http.Server{ Addr: ":8123", ReadTimeout: time.Second, WriteTimeout: time.Second, } server.ListenAndServe() } ``` What happens: The Write always succeeds in this handler, and the connection is left open hanging the client. What should happen: - Connection closed due to timeout - Preferably return an error when writes fail (though this may not be feasible due to internal buffering)