From a4095fac05a4a430ceb2c9a95bd71e3541b9d93b Mon Sep 17 00:00:00 2001 From: James Mills Date: Wed, 14 Sep 2016 16:25:14 +1000 Subject: [PATCH] Fix use of ResponseWriter.WriteInfo and ResponseWriter.WriteError --- gopher.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gopher.go b/gopher.go index 6987a33..3f48508 100644 --- a/gopher.go +++ b/gopher.go @@ -938,6 +938,10 @@ func (w *response) Write(b []byte) (int, error) { } func (w *response) WriteError(err string) error { + if w.rt == 0 { + w.rt = 2 + } + if w.rt != 2 { _, e := w.w.Write([]byte(err)) return e @@ -954,6 +958,10 @@ func (w *response) WriteError(err string) error { } func (w *response) WriteInfo(msg string) error { + if w.rt == 0 { + w.rt = 2 + } + if w.rt != 2 { _, e := w.w.Write([]byte(msg)) return e