move Connection header so it is applied to failed authentication

attempts as well.

ok @davecgh
This commit is contained in:
David Hill 2014-02-07 20:59:20 -05:00
parent 476000193f
commit 642c834ada

View file

@ -166,11 +166,11 @@ func (s *rpcServer) Start() {
ReadTimeout: time.Second * rpcAuthTimeoutSeconds, ReadTimeout: time.Second * rpcAuthTimeoutSeconds,
} }
rpcServeMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { rpcServeMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Connection", "close")
if _, err := s.checkAuth(r, true); err != nil { if _, err := s.checkAuth(r, true); err != nil {
jsonAuthFail(w, r, s) jsonAuthFail(w, r, s)
return return
} }
w.Header().Set("Connection", "close")
jsonRPCRead(w, r, s) jsonRPCRead(w, r, s)
}) })