close connection on error

This commit is contained in:
Matt Drollette
2014-12-20 01:14:26 -06:00
parent bb7c6029e4
commit e35e6fdb2a

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"crypto/tls"
"io"
"log"
"net/http"
"os"
"strconv"
@@ -54,7 +55,11 @@ func NewServer(prefix string, trustProxy bool) *Server {
}
errorHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Connection", "close")
w.WriteHeader(http.StatusNotFound)
if _, err := w.Write(nil); nil != err {
log.Println(err)
}
})
mux := http.NewServeMux()